aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-12 00:24:10 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-12 00:24:10 +0000
commit5746f1ff6286f5e5bd7fc28e5e2031f18e4676c9 (patch)
tree0d9a3f5886d4bac9f279278644f1dfa9c5a07831
parentc8d8ac5f454311d0154d2d080196cc150edbb2d6 (diff)
Move AnalyzerOptions into CompilerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86906 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Frontend/AnalysisConsumer.h5
-rw-r--r--include/clang/Frontend/CompilerInvocation.h9
-rw-r--r--tools/clang-cc/clang-cc.cpp14
3 files changed, 20 insertions, 8 deletions
diff --git a/include/clang/Frontend/AnalysisConsumer.h b/include/clang/Frontend/AnalysisConsumer.h
index 34054a7aa0..cb08ce2251 100644
--- a/include/clang/Frontend/AnalysisConsumer.h
+++ b/include/clang/Frontend/AnalysisConsumer.h
@@ -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
diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h
index fc0b95284d..6e231d359f 100644
--- a/include/clang/Frontend/CompilerInvocation.h
+++ b/include/clang/Frontend/CompilerInvocation.h
@@ -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;
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 5cce02ff4b..9ef0877456 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -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());