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/Output.cxx | |
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/Output.cxx')
-rw-r--r-- | src/Output.cxx | 20 |
1 files changed, 12 insertions, 8 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()); } |