void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
- typedef void (*InlineAsmDiagHandlerTy)(const SMDiagnostic&, void *Context,
- unsigned LocCookie);
+ typedef void (*DiagHandlerTy)(const SMDiagnostic&, void *Context,
+ unsigned LocCookie);
- /// 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.
+ /// 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.
///
/// LLVMContext doesn't take ownership or interpret either of these
/// pointers.
- void setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
- void *DiagContext = 0);
+ void setDiagnosticHandler(DiagHandlerTy DiagHandler, void *DiagContext = 0);
- /// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
- /// setInlineAsmDiagnosticHandler.
- InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler() const;
+ /// getDiagnosticHandler - Return the diagnostic handler set by
+ /// setDiagnosticHandler.
+ DiagHandlerTy getDiagnosticHandler() const;
- /// getInlineAsmDiagnosticContext - Return the diagnostic context set by
- /// setInlineAsmDiagnosticHandler.
- void *getInlineAsmDiagnosticContext() const;
+ /// getDiagnosticContext - Return the diagnostic context set by
+ /// setDiagnosticHandler.
+ void *getDiagnosticContext() 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
namespace {
struct SrcMgrDiagInfo {
const MDNode *LocInfo;
- LLVMContext::InlineAsmDiagHandlerTy DiagHandler;
+ LLVMContext::DiagHandlerTy DiagHandler;
void *DiagContext;
};
}
SourceMgr SrcMgr;
SrcMgrDiagInfo DiagInfo;
- // If the current LLVMContext has an inline asm handler, set it in SourceMgr.
+ // If the current LLVMContext has a diagnostic handler, set it in SourceMgr.
LLVMContext &LLVMCtx = MMI->getModule()->getContext();
bool HasDiagHandler = false;
- if (LLVMCtx.getInlineAsmDiagnosticHandler() != 0) {
+ if (LLVMCtx.getDiagnosticHandler() != 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.getInlineAsmDiagnosticHandler();
- DiagInfo.DiagContext = LLVMCtx.getInlineAsmDiagnosticContext();
+ DiagInfo.DiagHandler = LLVMCtx.getDiagnosticHandler();
+ DiagInfo.DiagContext = LLVMCtx.getDiagnosticContext();
SrcMgr.setDiagHandler(srcMgrDiagHandler, &DiagInfo);
HasDiagHandler = true;
}
// Recoverable Backend Errors
//===----------------------------------------------------------------------===//
-void LLVMContext::
-setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
- void *DiagContext) {
- pImpl->InlineAsmDiagHandler = DiagHandler;
- pImpl->InlineAsmDiagContext = DiagContext;
+void LLVMContext::setDiagnosticHandler(DiagHandlerTy DiagHandler,
+ void *DiagContext) {
+ pImpl->DiagHandler = DiagHandler;
+ pImpl->DiagContext = DiagContext;
}
-/// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
-/// setInlineAsmDiagnosticHandler.
-LLVMContext::InlineAsmDiagHandlerTy
-LLVMContext::getInlineAsmDiagnosticHandler() const {
- return pImpl->InlineAsmDiagHandler;
+/// getDiagnosticHandler - Return the diagnostic handler set by
+/// setDiagnosticHandler.
+LLVMContext::DiagHandlerTy LLVMContext::getDiagnosticHandler() const {
+ return pImpl->DiagHandler;
}
-/// getInlineAsmDiagnosticContext - Return the diagnostic context set by
-/// setInlineAsmDiagnosticHandler.
-void *LLVMContext::getInlineAsmDiagnosticContext() const {
- return pImpl->InlineAsmDiagContext;
+/// getDiagnosticContext - Return the diagnostic context set by
+/// setDiagnosticHandler.
+void *LLVMContext::getDiagnosticContext() const {
+ return pImpl->DiagContext;
}
void LLVMContext::emitError(const Twine &ErrorStr) {
void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) {
// If there is no error handler installed, just print the error and exit.
- if (pImpl->InlineAsmDiagHandler == 0) {
+ if (pImpl->DiagHandler == 0) {
errs() << "error: " << ErrorStr << "\n";
exit(1);
}
// If we do have an error handler, we can report the error and keep going.
SMDiagnostic Diag("", SourceMgr::DK_Error, ErrorStr.str());
- pImpl->InlineAsmDiagHandler(Diag, pImpl->InlineAsmDiagContext, LocCookie);
+ pImpl->DiagHandler(Diag, pImpl->DiagContext, LocCookie);
}
void LLVMContext::emitWarning(unsigned LocCookie, const Twine &ErrorStr) {
// If there is no handler installed, just print the warning.
- if (pImpl->InlineAsmDiagHandler == 0) {
+ if (pImpl->DiagHandler == 0) {
errs() << "warning: " << ErrorStr << "\n";
return;
}
// If we do have a handler, we can report the warning.
SMDiagnostic Diag("", SourceMgr::DK_Warning, ErrorStr.str());
- pImpl->InlineAsmDiagHandler(Diag, pImpl->InlineAsmDiagContext, LocCookie);
+ pImpl->DiagHandler(Diag, pImpl->DiagContext, LocCookie);
}
//===----------------------------------------------------------------------===//
Int16Ty(C, 16),
Int32Ty(C, 32),
Int64Ty(C, 64) {
- InlineAsmDiagHandler = 0;
- InlineAsmDiagContext = 0;
+ DiagHandler = 0;
+ DiagContext = 0;
NamedStructTypesUniqueID = 0;
}
/// will be automatically deleted if this context is deleted.
SmallPtrSet<Module*, 4> OwnedModules;
- LLVMContext::InlineAsmDiagHandlerTy InlineAsmDiagHandler;
- void *InlineAsmDiagContext;
+ LLVMContext::DiagHandlerTy DiagHandler;
+ void *DiagContext;
typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt*,
DenseMapAPIntKeyInfo> IntMapTy;