diff options
author | Brad King <brad.king@kitware.com> | 2014-01-13 20:06:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-02-26 16:54:50 (GMT) |
commit | 242191122a06bd7c4934e0670d38da2de42cdba2 (patch) | |
tree | 05e73edefca31dd8454a53343c5af843bed68f20 /src/Output.h | |
parent | cf203e1c6933a409a65811bc7a3c771c71f4e53d (diff) | |
download | CastXML-242191122a06bd7c4934e0670d38da2de42cdba2.zip CastXML-242191122a06bd7c4934e0670d38da2de42cdba2.tar.gz CastXML-242191122a06bd7c4934e0670d38da2de42cdba2.tar.bz2 |
Set up Clang AST visitor infrastructure for XML output
Create an API to perform the AST walk and XML output generation.
Create a queue that can hold both clang::Decl and clang::QualType nodes.
Add the main translation unit Decl to the queue. Follow the queue until
empty while adding new nodes to the queue only if they represent
complete types or declarations. Then queue the incomplete nodes and
follow the queue again until empty. This will allow all complete class
types to be output as needed followed by types that are referenced but
do not need complete output (like a pointed-to type).
Use "clang/AST/DeclNodes.inc" and "clang/AST/TypeNodes.def" to dispatch
visitation to a method dedicated to each AST node kind/type-class. Use
a visitor base class to provide an implementation for every visitation
method that simply reports the node as Unimplemented. This will allow
us to incrementally implement output for each AST node.
Diffstat (limited to 'src/Output.h')
-rw-r--r-- | src/Output.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Output.h b/src/Output.h new file mode 100644 index 0000000..8798492 --- /dev/null +++ b/src/Output.h @@ -0,0 +1,36 @@ +/* + Copyright Kitware, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +#ifndef CASTXML_OUTPUT_H +#define CASTXML_OUTPUT_H + +#include <cxsys/Configure.hxx> +#include <string> + +namespace llvm { + class raw_ostream; +} + +namespace clang { + class CompilerInstance; + class ASTContext; +} + +/// outputXML - Print a gccxml-compatible AST dump. +void outputXML(clang::CompilerInstance& ci, + clang::ASTContext const& ctx, + llvm::raw_ostream& os); + +#endif // CASTXML_OUTPUT_H |