[cfe-commits] r86906 - in /cfe/trunk: include/clang/Frontend/AnalysisConsumer.h include/clang/Frontend/CompilerInvocation.h tools/clang-cc/clang-cc.cpp

Daniel Dunbar daniel at zuster.org
Wed Nov 11 16:24:10 PST 2009


Author: ddunbar
Date: Wed Nov 11 18:24:10 2009
New Revision: 86906

URL: http://llvm.org/viewvc/llvm-project?rev=86906&view=rev
Log:
Move AnalyzerOptions into CompilerInvocation.

Modified:
    cfe/trunk/include/clang/Frontend/AnalysisConsumer.h
    cfe/trunk/include/clang/Frontend/CompilerInvocation.h
    cfe/trunk/tools/clang-cc/clang-cc.cpp

Modified: cfe/trunk/include/clang/Frontend/AnalysisConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/AnalysisConsumer.h?rev=86906&r1=86905&r2=86906&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/AnalysisConsumer.h (original)
+++ cfe/trunk/include/clang/Frontend/AnalysisConsumer.h Wed Nov 11 18:24:10 2009
@@ -12,6 +12,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+#ifndef LLVM_CLANG_FRONTEND_ANALYSISCONSUMER_H
+#define LLVM_CLANG_FRONTEND_ANALYSISCONSUMER_H
+
 #include <string>
 #include <vector>
 
@@ -73,3 +76,5 @@
                                     const AnalyzerOptions& Opts);
 
 }
+
+#endif

Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=86906&r1=86905&r2=86906&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Wed Nov 11 18:24:10 2009
@@ -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 @@
 /// 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 @@
   /// @name Option Subgroups
   /// @{
 
+  AnalyzerOptions &getAnalyzerOpts() { return AnalyzerOpts; }
+  const AnalyzerOptions &getAnalyzerOpts() const {
+    return AnalyzerOpts;
+  }
+
   CompileOptions &getCompileOpts() { return CompileOpts; }
   const CompileOptions &getCompileOpts() const {
     return CompileOpts;

Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=86906&r1=86905&r2=86906&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov 11 18:24:10 2009
@@ -658,14 +658,10 @@
     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 @@
   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());
 





More information about the cfe-commits mailing list