From: Ted Kremenek Date: Fri, 22 Feb 2008 20:13:09 +0000 (+0000) Subject: Modified clang driver option -dump-live-variables to (optionally) use the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bfc10c961212fe2701c717efa134ce9cb55b38cf;p=clang Modified clang driver option -dump-live-variables to (optionally) use the --analyze-function option to analyze specific functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47498 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index 316bcd4c7b..fd7768cacc 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -516,6 +516,8 @@ namespace { class LivenessVisitor : public CFGVisitor { SourceManager *SM; public: + LivenessVisitor(const std::string& fname) : CFGVisitor(fname) {} + virtual void Initialize(ASTContext &Context) { SM = &Context.getSourceManager(); } @@ -528,8 +530,8 @@ namespace { }; } // end anonymous namespace -ASTConsumer *clang::CreateLiveVarAnalyzer() { - return new LivenessVisitor(); +ASTConsumer *clang::CreateLiveVarAnalyzer(const std::string& fname) { + return new LivenessVisitor(fname); } //===----------------------------------------------------------------------===// diff --git a/Driver/ASTConsumers.h b/Driver/ASTConsumers.h index a0745cd792..85940c86f6 100644 --- a/Driver/ASTConsumers.h +++ b/Driver/ASTConsumers.h @@ -36,7 +36,7 @@ ASTConsumer *CreateASTViewer(); ASTConsumer *CreateCFGDumper(bool ViewGraphs, const std::string& FName); -ASTConsumer *CreateLiveVarAnalyzer(); +ASTConsumer *CreateLiveVarAnalyzer(const std::string& fname); ASTConsumer *CreateDeadStoreChecker(Diagnostic &Diags); diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 15384c5f1c..89e0bad4d0 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -982,7 +982,7 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile, AnalyzeSpecificFunction); case AnalysisLiveVariables: - return CreateLiveVarAnalyzer(); + return CreateLiveVarAnalyzer(AnalyzeSpecificFunction); case WarnDeadStores: return CreateDeadStoreChecker(Diag);