aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend/CompilerInstance.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-01-30 21:47:07 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-01-30 21:47:07 +0000
commit6228ca00121669ec06a19df4fad87d5049c097cf (patch)
tree9b1fc82ed352c75da4bf37c7b31a5c83f41c8e37 /include/clang/Frontend/CompilerInstance.h
parent95c9ce952dd90f0ef66660c905fe99c51b7e835d (diff)
CompilerInstance: Change to not contain the CompilerInvocation object.
This allows clients to install their own CompilerInvocation object, which is important for clients that may wish to create references to things like LangOptions whose lifetime will extend past that of the CompilerInstance. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r--include/clang/Frontend/CompilerInstance.h57
1 files changed, 33 insertions, 24 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index edafe623a4..8f12b54be9 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -62,7 +62,7 @@ class CompilerInstance {
bool OwnsLLVMContext;
/// The options used in this compiler instance.
- CompilerInvocation Invocation;
+ llvm::OwningPtr<CompilerInvocation> Invocation;
/// The diagnostics engine instance.
llvm::OwningPtr<Diagnostic> Diagnostics;
@@ -161,82 +161,91 @@ public:
/// @name Compiler Invocation and Options
/// {
- CompilerInvocation &getInvocation() { return Invocation; }
- const CompilerInvocation &getInvocation() const { return Invocation; }
- void setInvocation(const CompilerInvocation &Value) { Invocation = Value; }
+ bool hasInvocation() const { return Invocation != 0; }
+
+ CompilerInvocation &getInvocation() {
+ assert(Invocation && "Compiler instance has no invocation!");
+ return *Invocation;
+ }
+
+ CompilerInvocation *takeInvocation() { return Invocation.take(); }
+
+ /// setInvocation - Replace the current invocation; the compiler instance
+ /// takes ownership of \arg Value.
+ void setInvocation(CompilerInvocation *Value);
/// }
/// @name Forwarding Methods
/// {
AnalyzerOptions &getAnalyzerOpts() {
- return Invocation.getAnalyzerOpts();
+ return Invocation->getAnalyzerOpts();
}
const AnalyzerOptions &getAnalyzerOpts() const {
- return Invocation.getAnalyzerOpts();
+ return Invocation->getAnalyzerOpts();
}
CodeGenOptions &getCodeGenOpts() {
- return Invocation.getCodeGenOpts();
+ return Invocation->getCodeGenOpts();
}
const CodeGenOptions &getCodeGenOpts() const {
- return Invocation.getCodeGenOpts();
+ return Invocation->getCodeGenOpts();
}
DependencyOutputOptions &getDependencyOutputOpts() {
- return Invocation.getDependencyOutputOpts();
+ return Invocation->getDependencyOutputOpts();
}
const DependencyOutputOptions &getDependencyOutputOpts() const {
- return Invocation.getDependencyOutputOpts();
+ return Invocation->getDependencyOutputOpts();
}
DiagnosticOptions &getDiagnosticOpts() {
- return Invocation.getDiagnosticOpts();
+ return Invocation->getDiagnosticOpts();
}
const DiagnosticOptions &getDiagnosticOpts() const {
- return Invocation.getDiagnosticOpts();
+ return Invocation->getDiagnosticOpts();
}
FrontendOptions &getFrontendOpts() {
- return Invocation.getFrontendOpts();
+ return Invocation->getFrontendOpts();
}
const FrontendOptions &getFrontendOpts() const {
- return Invocation.getFrontendOpts();
+ return Invocation->getFrontendOpts();
}
HeaderSearchOptions &getHeaderSearchOpts() {
- return Invocation.getHeaderSearchOpts();
+ return Invocation->getHeaderSearchOpts();
}
const HeaderSearchOptions &getHeaderSearchOpts() const {
- return Invocation.getHeaderSearchOpts();
+ return Invocation->getHeaderSearchOpts();
}
LangOptions &getLangOpts() {
- return Invocation.getLangOpts();
+ return Invocation->getLangOpts();
}
const LangOptions &getLangOpts() const {
- return Invocation.getLangOpts();
+ return Invocation->getLangOpts();
}
PreprocessorOptions &getPreprocessorOpts() {
- return Invocation.getPreprocessorOpts();
+ return Invocation->getPreprocessorOpts();
}
const PreprocessorOptions &getPreprocessorOpts() const {
- return Invocation.getPreprocessorOpts();
+ return Invocation->getPreprocessorOpts();
}
PreprocessorOutputOptions &getPreprocessorOutputOpts() {
- return Invocation.getPreprocessorOutputOpts();
+ return Invocation->getPreprocessorOutputOpts();
}
const PreprocessorOutputOptions &getPreprocessorOutputOpts() const {
- return Invocation.getPreprocessorOutputOpts();
+ return Invocation->getPreprocessorOutputOpts();
}
TargetOptions &getTargetOpts() {
- return Invocation.getTargetOpts();
+ return Invocation->getTargetOpts();
}
const TargetOptions &getTargetOpts() const {
- return Invocation.getTargetOpts();
+ return Invocation->getTargetOpts();
}
/// }