give LLVMContext an inline asm diagnostic hook member.
authorChris Lattner <sabre@nondot.org>
Tue, 6 Apr 2010 00:44:45 +0000 (00:44 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 6 Apr 2010 00:44:45 +0000 (00:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100506 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/LLVMContext.h
lib/VMCore/LLVMContext.cpp
lib/VMCore/LLVMContextImpl.cpp
lib/VMCore/LLVMContextImpl.h

index ea7f4a2d8e9db10c8e58d58fdd017079cfe848dc..43548407f681cb55970bee424ed206476f1b0aae 100644 (file)
@@ -50,6 +50,24 @@ public:
   /// custom metadata IDs registered in this LLVMContext.   ID #0 is not used,
   /// so it is filled in as an empty string.
   void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
+  
+  /// setInlineAsmDiagnosticHandler - This method sets a handler that is invoked
+  /// when problems with inline asm are detected by the backend.  The first
+  /// argument is a function pointer (of type SourceMgr::DiagHandlerTy) and the
+  /// second is a context pointer that gets passed into the DiagHandler.
+  ///
+  /// LLVMContext doesn't take ownership or interpreter either of these
+  /// pointers.
+  void setInlineAsmDiagnosticHandler(void *DiagHandler, void *DiagContext = 0);
+
+  /// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
+  /// setInlineAsmDiagnosticHandler.
+  void *getInlineAsmDiagnosticHandler() const;
+
+  /// getInlineAsmDiagnosticContext - Return the diagnostic context set by
+  /// setInlineAsmDiagnosticHandler.
+  void *getInlineAsmDiagnosticContext() const;
+  
 };
 
 /// getGlobalContext - Returns a global context.  This is for LLVM clients that
index 2a870ec6cfd94d2b9f41c2636fd8664e752e6f81..3244f2842c4fdf0b2662b54185b7bdcfb61d72fd 100644 (file)
@@ -33,6 +33,23 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) {
 }
 LLVMContext::~LLVMContext() { delete pImpl; }
 
+void LLVMContext::setInlineAsmDiagnosticHandler(void *DiagHandler, 
+                                                void *DiagContext) {
+  pImpl->InlineAsmDiagHandler = DiagHandler;
+  pImpl->InlineAsmDiagContext = DiagContext;
+}
+
+/// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
+/// setInlineAsmDiagnosticHandler.
+void *LLVMContext::getInlineAsmDiagnosticHandler() const {
+  return pImpl->InlineAsmDiagHandler;
+}
+
+/// getInlineAsmDiagnosticContext - Return the diagnostic context set by
+/// setInlineAsmDiagnosticHandler.
+void *LLVMContext::getInlineAsmDiagnosticContext() const {
+  return pImpl->InlineAsmDiagContext;
+}
 
 #ifndef NDEBUG
 /// isValidName - Return true if Name is a valid custom metadata handler name.
@@ -73,5 +90,3 @@ void LLVMContext::getMDKindNames(SmallVectorImpl<StringRef> &Names) const {
     // MD Handlers are numbered from 1.
     Names[I->second] = I->first();
 }
-
-
index b4553ddc1b9f4f899bfbab2252894b9db0cc68b0..e71157f44020c608a9b488a5f1d1e5d2807fcbd0 100644 (file)
@@ -30,6 +30,9 @@ LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
     Int32Ty(C, 32),
     Int64Ty(C, 64),
     AlwaysOpaqueTy(new OpaqueType(C)) {
+  InlineAsmDiagHandler = 0;
+  InlineAsmDiagContext = 0;
+      
   // Make sure the AlwaysOpaqueTy stays alive as long as the Context.
   AlwaysOpaqueTy->addRef();
   OpaqueTypes.insert(AlwaysOpaqueTy);
index d4ebf8044d8b8e33f02e5a868cc9504226716502..4876f5d5075a894b7377630f81dd37306c7d2fbb 100644 (file)
@@ -115,6 +115,8 @@ public:
   
 class LLVMContextImpl {
 public:
+  void *InlineAsmDiagHandler, *InlineAsmDiagContext;
+  
   typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt*, 
                          DenseMapAPIntKeyInfo> IntMapTy;
   IntMapTy IntConstants;