]> granicus.if.org Git - clang/commitdiff
Move AnalyzerOptions into CompilerInvocation.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 12 Nov 2009 00:24:10 +0000 (00:24 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 12 Nov 2009 00:24:10 +0000 (00:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86906 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/AnalysisConsumer.h
include/clang/Frontend/CompilerInvocation.h
tools/clang-cc/clang-cc.cpp

index 34054a7aa00e959e83ca498cd4514cab4abb3189..cb08ce22512820aa1eae3c0a13e3b344cfd256c0 100644 (file)
@@ -12,6 +12,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+#ifndef LLVM_CLANG_FRONTEND_ANALYSISCONSUMER_H
+#define LLVM_CLANG_FRONTEND_ANALYSISCONSUMER_H
+
 #include <string>
 #include <vector>
 
@@ -73,3 +76,5 @@ ASTConsumer* CreateAnalysisConsumer(const Preprocessor &pp,
                                     const AnalyzerOptions& Opts);
 
 }
+
+#endif
index fc0b95284d12d3f40aa2a480cbd6bc61bf92b6b4..6e231d359fb6a8dab73686724627cb80f765860f 100644 (file)
@@ -11,6 +11,7 @@
 #define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H_
 
 #include "clang/Basic/LangOptions.h"
+#include "clang/Frontend/AnalysisConsumer.h"
 #include "clang/Frontend/CompileOptions.h"
 #include "clang/Frontend/DependencyOutputOptions.h"
 #include "clang/Frontend/DiagnosticOptions.h"
@@ -29,6 +30,9 @@ namespace clang {
 /// compiler, including data such as the include paths, the code generation
 /// options, the warning flags, and so on.
 class CompilerInvocation {
+  /// Options controlling the static analyzer.
+  AnalyzerOptions AnalyzerOpts;
+
   /// Options controlling IRgen and the backend.
   CompileOptions CompileOpts;
 
@@ -67,6 +71,11 @@ public:
   /// @name Option Subgroups
   /// @{
 
+  AnalyzerOptions &getAnalyzerOpts() { return AnalyzerOpts; }
+  const AnalyzerOptions &getAnalyzerOpts() const {
+    return AnalyzerOpts;
+  }
+
   CompileOptions &getCompileOpts() { return CompileOpts; }
   const CompileOptions &getCompileOpts() const {
     return CompileOpts;
index 5cce02ff4ba8ced07239b31235f47b5e784e17b9..9ef08774561579aa51a5b3f5794f6545c36c3732 100644 (file)
@@ -658,14 +658,10 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts,
     Consumer.reset(CreateHTMLPrinter(OS.get(), PP));
     break;
 
-  case RunAnalysis: {
-    AnalyzerOptions AnalyzerOpts;
-    // FIXME: Move into CompilerInvocation.
-    InitializeAnalyzerOptions(AnalyzerOpts);
+  case RunAnalysis:
     Consumer.reset(CreateAnalysisConsumer(PP, CompOpts.getOutputFile(),
-                                          AnalyzerOpts));
+                                          CompOpts.getAnalyzerOpts()));
     break;
-  }
 
   case GeneratePCH: {
     const std::string &Sysroot = CompOpts.getHeaderSearchOpts().Sysroot;
@@ -1065,14 +1061,16 @@ static void ConstructCompilerInvocation(CompilerInvocation &Opts,
   InitializeCompileOptions(Opts.getCompileOpts(), Target);
 
   // Initialize language options.
-  LangOptions LangInfo;
-
+  //
   // FIXME: These aren't used during operations on ASTs. Split onto a separate
   // code path to make this obvious.
   if (LK != langkind_ast)
     InitializeLangOptions(Opts.getLangOpts(), LK, Target,
                           Opts.getCompileOpts());
 
+  // Initialize the static analyzer options.
+  InitializeAnalyzerOptions(Opts.getAnalyzerOpts());
+
   // Initialize the dependency output options (-M...).
   InitializeDependencyOutputOptions(Opts.getDependencyOutputOpts());