diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 8 | ||||
-rw-r--r-- | include/clang/CodeGen/CodeGenAction.h | 23 | ||||
-rw-r--r-- | include/clang/Frontend/ASTConsumers.h | 2 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 21 |
4 files changed, 38 insertions, 16 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index b9087f2c47..586680bbd0 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -26,6 +26,8 @@ namespace llvm { struct fltSemantics; class StringRef; +class LLVMContext; +class Type; } namespace clang { @@ -530,6 +532,12 @@ public: virtual const char *getStaticInitSectionSpecifier() const { return 0; } + + virtual const llvm::Type* adjustInlineAsmType(std::string& Constraint, + const llvm::Type* Ty, + llvm::LLVMContext& Context) const { + return Ty; + } protected: virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return PointerWidth; diff --git a/include/clang/CodeGen/CodeGenAction.h b/include/clang/CodeGen/CodeGenAction.h index 052c6603f5..b55effc6be 100644 --- a/include/clang/CodeGen/CodeGenAction.h +++ b/include/clang/CodeGen/CodeGenAction.h @@ -14,7 +14,6 @@ #include "llvm/ADT/OwningPtr.h" namespace llvm { - class LLVMContext; class Module; } @@ -25,14 +24,9 @@ class CodeGenAction : public ASTFrontendAction { private: unsigned Act; llvm::OwningPtr<llvm::Module> TheModule; - llvm::LLVMContext *VMContext; - bool OwnsVMContext; protected: - /// Create a new code generation action. If the optional \arg _VMContext - /// parameter is supplied, the action uses it without taking ownership, - /// otherwise it creates a fresh LLVM context and takes ownership. - CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext = 0); + CodeGenAction(unsigned _Act); virtual bool hasIRSupport() const; @@ -50,40 +44,37 @@ public: /// been run. The result may be null on failure. llvm::Module *takeModule(); - /// Take the LLVM context used by this action. - llvm::LLVMContext *takeLLVMContext(); - BackendConsumer *BEConsumer; }; class EmitAssemblyAction : public CodeGenAction { public: - EmitAssemblyAction(llvm::LLVMContext *_VMContext = 0); + EmitAssemblyAction(); }; class EmitBCAction : public CodeGenAction { public: - EmitBCAction(llvm::LLVMContext *_VMContext = 0); + EmitBCAction(); }; class EmitLLVMAction : public CodeGenAction { public: - EmitLLVMAction(llvm::LLVMContext *_VMContext = 0); + EmitLLVMAction(); }; class EmitLLVMOnlyAction : public CodeGenAction { public: - EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext = 0); + EmitLLVMOnlyAction(); }; class EmitCodeGenOnlyAction : public CodeGenAction { public: - EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext = 0); + EmitCodeGenOnlyAction(); }; class EmitObjAction : public CodeGenAction { public: - EmitObjAction(llvm::LLVMContext *_VMContext = 0); + EmitObjAction(); }; } diff --git a/include/clang/Frontend/ASTConsumers.h b/include/clang/Frontend/ASTConsumers.h index c45bd40706..e2071df8e3 100644 --- a/include/clang/Frontend/ASTConsumers.h +++ b/include/clang/Frontend/ASTConsumers.h @@ -18,6 +18,8 @@ namespace llvm { class raw_ostream; + class Module; + class LLVMContext; namespace sys { class Path; } } namespace clang { diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 7ea79e5599..430cc603c7 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -19,6 +19,7 @@ #include <string> namespace llvm { +class LLVMContext; class raw_ostream; class raw_fd_ostream; class Timer; @@ -58,6 +59,9 @@ class TargetInfo; /// come in two forms; a short form that reuses the CompilerInstance objects, /// and a long form that takes explicit instances of any required objects. class CompilerInstance { + /// The LLVM context used for this instance. + llvm::OwningPtr<llvm::LLVMContext> LLVMContext; + /// The options used in this compiler instance. llvm::OwningPtr<CompilerInvocation> Invocation; @@ -151,6 +155,23 @@ public: bool ExecuteAction(FrontendAction &Act); /// } + /// @name LLVM Context + /// { + + bool hasLLVMContext() const { return LLVMContext != 0; } + + llvm::LLVMContext &getLLVMContext() const { + assert(LLVMContext && "Compiler instance has no LLVM context!"); + 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); + + /// } /// @name Compiler Invocation and Options /// { |