diff options
author | Brad King <brad.king@kitware.com> | 2014-04-09 18:55:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-04-09 20:44:12 (GMT) |
commit | 56465b5cda39e39676b66d26372c4767dd92ae3b (patch) | |
tree | 7d7785e2cfb1dfd983d9e19f13189accfcc59fc8 /src | |
parent | 400ddd7f60e02ffc85db7507475dab36e5544b9d (diff) | |
download | CastXML-56465b5cda39e39676b66d26372c4767dd92ae3b.zip CastXML-56465b5cda39e39676b66d26372c4767dd92ae3b.tar.gz CastXML-56465b5cda39e39676b66d26372c4767dd92ae3b.tar.bz2 |
Output: Pass full Options struct to our ASTVisitor
Pass the full structure instead of just the StartNames field.
We may need information about other options later.
Diffstat (limited to 'src')
-rw-r--r-- | src/Output.cxx | 20 | ||||
-rw-r--r-- | src/Output.h | 6 | ||||
-rw-r--r-- | src/RunClang.cxx | 2 |
3 files changed, 16 insertions, 12 deletions
diff --git a/src/Output.cxx b/src/Output.cxx index 6afee3b..5925ee4 100644 --- a/src/Output.cxx +++ b/src/Output.cxx @@ -15,6 +15,7 @@ */ #include "Output.h" +#include "Options.h" #include "Utils.h" #include "clang/AST/ASTContext.h" @@ -31,6 +32,8 @@ #include <fstream> #include <iostream> #include <queue> +#include <string> +#include <vector> //---------------------------------------------------------------------------- class ASTVisitorBase @@ -340,7 +343,7 @@ class ASTVisitor: public ASTVisitorBase private: // List of starting declaration names. - std::vector<std::string> const& StartNames; + Options const& Opts; // Total number of nodes to be dumped. unsigned int NodeCount; @@ -373,9 +376,9 @@ public: ASTVisitor(clang::CompilerInstance& ci, clang::ASTContext const& ctx, llvm::raw_ostream& os, - std::vector<std::string> const& startNames): + Options const& opts): ASTVisitorBase(ci, ctx, os), - StartNames(startNames), + Opts(opts), NodeCount(0), FileCount(0), RequireComplete(true) {} @@ -1551,10 +1554,11 @@ void ASTVisitor::LookupStart(clang::DeclContext const* dc, void ASTVisitor::HandleTranslationUnit(clang::TranslationUnitDecl const* tu) { // Add the starting nodes for the dump. - if(!this->StartNames.empty()) { + if(!this->Opts.StartNames.empty()) { // Use the specified starting locations. - for(std::vector<std::string>::const_iterator i = this->StartNames.begin(), - e = this->StartNames.end(); i != e; ++i) { + for(std::vector<std::string>::const_iterator + i = this->Opts.StartNames.begin(), e = this->Opts.StartNames.end(); + i != e; ++i) { this->LookupStart(tu, *i); } } else { @@ -1591,8 +1595,8 @@ void ASTVisitor::HandleTranslationUnit(clang::TranslationUnitDecl const* tu) void outputXML(clang::CompilerInstance& ci, clang::ASTContext const& ctx, llvm::raw_ostream& os, - std::vector<std::string> const& startNames) + Options const& opts) { - ASTVisitor v(ci, ctx, os, startNames); + ASTVisitor v(ci, ctx, os, opts); v.HandleTranslationUnit(ctx.getTranslationUnitDecl()); } diff --git a/src/Output.h b/src/Output.h index 1391dba..5314916 100644 --- a/src/Output.h +++ b/src/Output.h @@ -17,8 +17,6 @@ #define CASTXML_OUTPUT_H #include <cxsys/Configure.hxx> -#include <string> -#include <vector> namespace llvm { class raw_ostream; @@ -29,10 +27,12 @@ namespace clang { class ASTContext; } +struct Options; + /// outputXML - Print a gccxml-compatible AST dump. void outputXML(clang::CompilerInstance& ci, clang::ASTContext const& ctx, llvm::raw_ostream& os, - std::vector<std::string> const& startNames); + Options const& opts); #endif // CASTXML_OUTPUT_H diff --git a/src/RunClang.cxx b/src/RunClang.cxx index 13ba54a..2961757 100644 --- a/src/RunClang.cxx +++ b/src/RunClang.cxx @@ -104,7 +104,7 @@ public: } void HandleTranslationUnit(clang::ASTContext& ctx) { - outputXML(this->CI, ctx, this->OS, this->Opts.StartNames); + outputXML(this->CI, ctx, this->OS, this->Opts); } }; |