From fd035e6496665b1f1197868e21cb0a4594e8db6e Mon Sep 17 00:00:00 2001 From: rdivacky Date: Tue, 16 Feb 2010 09:31:36 +0000 Subject: Update clang to r96341. --- include/clang/Frontend/CompilerInstance.h | 74 +++++++++++++++++-------------- 1 file changed, 40 insertions(+), 34 deletions(-) (limited to 'include/clang/Frontend/CompilerInstance.h') diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index edafe62..1be4118 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -58,11 +58,10 @@ class TargetInfo; /// and a long form that takes explicit instances of any required objects. class CompilerInstance { /// The LLVM context used for this instance. - llvm::LLVMContext *LLVMContext; - bool OwnsLLVMContext; + llvm::OwningPtr LLVMContext; /// The options used in this compiler instance. - CompilerInvocation Invocation; + llvm::OwningPtr Invocation; /// The diagnostics engine instance. llvm::OwningPtr Diagnostics; @@ -97,11 +96,10 @@ class CompilerInstance { /// The list of active output files. std::list< std::pair > OutputFiles; + void operator=(const CompilerInstance &); // DO NOT IMPLEMENT + CompilerInstance(const CompilerInstance&); // DO NOT IMPLEMENT public: - /// Create a new compiler instance with the given LLVM context, optionally - /// taking ownership of it. - CompilerInstance(llvm::LLVMContext *_LLVMContext = 0, - bool _OwnsLLVMContext = true); + CompilerInstance(); ~CompilerInstance(); /// @name High-Level Operations @@ -150,93 +148,101 @@ public: return *LLVMContext; } + llvm::LLVMContext *takeLLVMContext() { return LLVMContext.take(); } + /// setLLVMContext - Replace the current LLVM context and take ownership of /// \arg Value. - void setLLVMContext(llvm::LLVMContext *Value, bool TakeOwnership = true) { - LLVMContext = Value; - OwnsLLVMContext = TakeOwnership; - } + void setLLVMContext(llvm::LLVMContext *Value); /// } /// @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(); } /// } -- cgit v1.1