[llvm] r174860 - Revert "Rename LLVMContext diagnostic handler types and functions."

Bob Wilson bob.wilson at apple.com
Sun Feb 10 21:37:07 PST 2013


Author: bwilson
Date: Sun Feb 10 23:37:07 2013
New Revision: 174860

URL: http://llvm.org/viewvc/llvm-project?rev=174860&view=rev
Log:
Revert "Rename LLVMContext diagnostic handler types and functions."

This reverts my commit 171047. Now that I've removed my misguided attempt to
support backend warnings, these diagnostics are only about inline assembly.
It would take quite a bit more work to generalize them properly, so I'm
just reverting this.

Modified:
    llvm/trunk/include/llvm/IR/LLVMContext.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
    llvm/trunk/lib/IR/LLVMContext.cpp
    llvm/trunk/lib/IR/LLVMContextImpl.cpp
    llvm/trunk/lib/IR/LLVMContextImpl.h

Modified: llvm/trunk/include/llvm/IR/LLVMContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/LLVMContext.h?rev=174860&r1=174859&r2=174860&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/LLVMContext.h (original)
+++ llvm/trunk/include/llvm/IR/LLVMContext.h Sun Feb 10 23:37:07 2013
@@ -58,39 +58,27 @@ public:
   void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
   
   
-  typedef void (*DiagHandlerTy)(const SMDiagnostic&, void *Context,
-                                unsigned LocCookie);
+  typedef void (*InlineAsmDiagHandlerTy)(const SMDiagnostic&, void *Context,
+                                         unsigned LocCookie);
   
-  /// setDiagnosticHandler - This method sets a handler that is invoked
-  /// when problems are detected by the backend.  The first argument is a
-  /// function pointer and the second is a context pointer that gets passed
-  /// into the DiagHandler.
+  /// 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 and the second is a context pointer that
+  /// gets passed into the DiagHandler.
   ///
   /// LLVMContext doesn't take ownership or interpret either of these
   /// pointers.
-  void setDiagnosticHandler(DiagHandlerTy DiagHandler, void *DiagContext = 0);
+  void setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
+                                     void *DiagContext = 0);
 
-  /// getDiagnosticHandler - Return the diagnostic handler set by
-  /// setDiagnosticHandler.
-  DiagHandlerTy getDiagnosticHandler() const;
+  /// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
+  /// setInlineAsmDiagnosticHandler.
+  InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler() const;
 
-  /// getDiagnosticContext - Return the diagnostic context set by
-  /// setDiagnosticHandler.
-  void *getDiagnosticContext() const;
+  /// getInlineAsmDiagnosticContext - Return the diagnostic context set by
+  /// setInlineAsmDiagnosticHandler.
+  void *getInlineAsmDiagnosticContext() const;
   
-  /// FIXME: Temporary copies of the old names; to be removed as soon as
-  /// clang switches to the new ones.
-  typedef DiagHandlerTy InlineAsmDiagHandlerTy;
-  void setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
-                                     void *DiagContext = 0) {
-    setDiagnosticHandler(DiagHandler, DiagContext);
-  }
-  InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler() const {
-    return getDiagnosticHandler();
-  }
-  void *getInlineAsmDiagnosticContext() const {
-    return getDiagnosticContext();
-  }
   
   /// emitError - Emit an error message to the currently installed error handler
   /// with optional location information.  This function returns, so code should

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp?rev=174860&r1=174859&r2=174860&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Sun Feb 10 23:37:07 2013
@@ -38,7 +38,7 @@ using namespace llvm;
 namespace {
   struct SrcMgrDiagInfo {
     const MDNode *LocInfo;
-    LLVMContext::DiagHandlerTy DiagHandler;
+    LLVMContext::InlineAsmDiagHandlerTy DiagHandler;
     void *DiagContext;
   };
 }
@@ -88,15 +88,15 @@ void AsmPrinter::EmitInlineAsm(StringRef
   SourceMgr SrcMgr;
   SrcMgrDiagInfo DiagInfo;
 
-  // If the current LLVMContext has a diagnostic handler, set it in SourceMgr.
+  // If the current LLVMContext has an inline asm handler, set it in SourceMgr.
   LLVMContext &LLVMCtx = MMI->getModule()->getContext();
   bool HasDiagHandler = false;
-  if (LLVMCtx.getDiagnosticHandler() != 0) {
+  if (LLVMCtx.getInlineAsmDiagnosticHandler() != 0) {
     // If the source manager has an issue, we arrange for srcMgrDiagHandler
     // to be invoked, getting DiagInfo passed into it.
     DiagInfo.LocInfo = LocMDNode;
-    DiagInfo.DiagHandler = LLVMCtx.getDiagnosticHandler();
-    DiagInfo.DiagContext = LLVMCtx.getDiagnosticContext();
+    DiagInfo.DiagHandler = LLVMCtx.getInlineAsmDiagnosticHandler();
+    DiagInfo.DiagContext = LLVMCtx.getInlineAsmDiagnosticContext();
     SrcMgr.setDiagHandler(srcMgrDiagHandler, &DiagInfo);
     HasDiagHandler = true;
   }

Modified: llvm/trunk/lib/IR/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContext.cpp?rev=174860&r1=174859&r2=174860&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContext.cpp (original)
+++ llvm/trunk/lib/IR/LLVMContext.cpp Sun Feb 10 23:37:07 2013
@@ -73,22 +73,24 @@ void LLVMContext::removeModule(Module *M
 // Recoverable Backend Errors
 //===----------------------------------------------------------------------===//
 
-void LLVMContext::setDiagnosticHandler(DiagHandlerTy DiagHandler,
-                                       void *DiagContext) {
-  pImpl->DiagHandler = DiagHandler;
-  pImpl->DiagContext = DiagContext;
-}
-
-/// getDiagnosticHandler - Return the diagnostic handler set by
-/// setDiagnosticHandler.
-LLVMContext::DiagHandlerTy LLVMContext::getDiagnosticHandler() const {
-  return pImpl->DiagHandler;
-}
-
-/// getDiagnosticContext - Return the diagnostic context set by
-/// setDiagnosticHandler.
-void *LLVMContext::getDiagnosticContext() const {
-  return pImpl->DiagContext;
+void LLVMContext::
+setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
+                              void *DiagContext) {
+  pImpl->InlineAsmDiagHandler = DiagHandler;
+  pImpl->InlineAsmDiagContext = DiagContext;
+}
+
+/// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
+/// setInlineAsmDiagnosticHandler.
+LLVMContext::InlineAsmDiagHandlerTy
+LLVMContext::getInlineAsmDiagnosticHandler() const {
+  return pImpl->InlineAsmDiagHandler;
+}
+
+/// getInlineAsmDiagnosticContext - Return the diagnostic context set by
+/// setInlineAsmDiagnosticHandler.
+void *LLVMContext::getInlineAsmDiagnosticContext() const {
+  return pImpl->InlineAsmDiagContext;
 }
 
 void LLVMContext::emitError(const Twine &ErrorStr) {
@@ -107,7 +109,7 @@ void LLVMContext::emitError(const Instru
 
 void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) {
   // If there is no error handler installed, just print the error and exit.
-  if (pImpl->DiagHandler == 0) {
+  if (pImpl->InlineAsmDiagHandler == 0) {
     errs() << "error: " << ErrorStr << "\n";
     exit(1);
   }
@@ -115,7 +117,7 @@ void LLVMContext::emitError(unsigned Loc
   // If we do have an error handler, we can report the error and keep going.
   SMDiagnostic Diag("", SourceMgr::DK_Error, ErrorStr.str());
 
-  pImpl->DiagHandler(Diag, pImpl->DiagContext, LocCookie);
+  pImpl->InlineAsmDiagHandler(Diag, pImpl->InlineAsmDiagContext, LocCookie);
 }
 
 //===----------------------------------------------------------------------===//

Modified: llvm/trunk/lib/IR/LLVMContextImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.cpp?rev=174860&r1=174859&r2=174860&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.cpp (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.cpp Sun Feb 10 23:37:07 2013
@@ -35,8 +35,8 @@ LLVMContextImpl::LLVMContextImpl(LLVMCon
     Int16Ty(C, 16),
     Int32Ty(C, 32),
     Int64Ty(C, 64) {
-  DiagHandler = 0;
-  DiagContext = 0;
+  InlineAsmDiagHandler = 0;
+  InlineAsmDiagContext = 0;
   NamedStructTypesUniqueID = 0;
 }
 

Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=174860&r1=174859&r2=174860&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.h Sun Feb 10 23:37:07 2013
@@ -236,8 +236,8 @@ public:
   /// will be automatically deleted if this context is deleted.
   SmallPtrSet<Module*, 4> OwnedModules;
   
-  LLVMContext::DiagHandlerTy DiagHandler;
-  void *DiagContext;
+  LLVMContext::InlineAsmDiagHandlerTy InlineAsmDiagHandler;
+  void *InlineAsmDiagContext;
   
   typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt*, 
                          DenseMapAPIntKeyInfo> IntMapTy;





More information about the llvm-commits mailing list