mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-03 14:31:10 +00:00
Rename LLVMContext diagnostic handler types and functions.
These are now generally used for all diagnostics from the backend, not just for inline assembly, so this drops the "InlineAsm" from the names. No functional change. (I've left aliases for the old names but only for long enough to let me switch over clang to use the new ones.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171047 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3d662d5586
commit
04de315694
@ -58,27 +58,39 @@ public:
|
|||||||
void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
|
void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
|
||||||
|
|
||||||
|
|
||||||
typedef void (*InlineAsmDiagHandlerTy)(const SMDiagnostic&, void *Context,
|
typedef void (*DiagHandlerTy)(const SMDiagnostic&, void *Context,
|
||||||
unsigned LocCookie);
|
unsigned LocCookie);
|
||||||
|
|
||||||
/// setInlineAsmDiagnosticHandler - This method sets a handler that is invoked
|
/// setDiagnosticHandler - This method sets a handler that is invoked
|
||||||
/// when problems with inline asm are detected by the backend. The first
|
/// when problems are detected by the backend. The first argument is a
|
||||||
/// argument is a function pointer and the second is a context pointer that
|
/// function pointer and the second is a context pointer that gets passed
|
||||||
/// gets passed into the DiagHandler.
|
/// into the DiagHandler.
|
||||||
///
|
///
|
||||||
/// LLVMContext doesn't take ownership or interpret either of these
|
/// LLVMContext doesn't take ownership or interpret either of these
|
||||||
/// pointers.
|
/// pointers.
|
||||||
void setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
|
void setDiagnosticHandler(DiagHandlerTy DiagHandler, void *DiagContext = 0);
|
||||||
void *DiagContext = 0);
|
|
||||||
|
|
||||||
/// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
|
/// getDiagnosticHandler - Return the diagnostic handler set by
|
||||||
/// setInlineAsmDiagnosticHandler.
|
/// setDiagnosticHandler.
|
||||||
InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler() const;
|
DiagHandlerTy getDiagnosticHandler() const;
|
||||||
|
|
||||||
/// getInlineAsmDiagnosticContext - Return the diagnostic context set by
|
/// getDiagnosticContext - Return the diagnostic context set by
|
||||||
/// setInlineAsmDiagnosticHandler.
|
/// setDiagnosticHandler.
|
||||||
void *getInlineAsmDiagnosticContext() const;
|
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
|
/// emitError - Emit an error message to the currently installed error handler
|
||||||
/// with optional location information. This function returns, so code should
|
/// with optional location information. This function returns, so code should
|
||||||
|
@ -38,7 +38,7 @@ using namespace llvm;
|
|||||||
namespace {
|
namespace {
|
||||||
struct SrcMgrDiagInfo {
|
struct SrcMgrDiagInfo {
|
||||||
const MDNode *LocInfo;
|
const MDNode *LocInfo;
|
||||||
LLVMContext::InlineAsmDiagHandlerTy DiagHandler;
|
LLVMContext::DiagHandlerTy DiagHandler;
|
||||||
void *DiagContext;
|
void *DiagContext;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -88,15 +88,15 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode,
|
|||||||
SourceMgr SrcMgr;
|
SourceMgr SrcMgr;
|
||||||
SrcMgrDiagInfo DiagInfo;
|
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();
|
LLVMContext &LLVMCtx = MMI->getModule()->getContext();
|
||||||
bool HasDiagHandler = false;
|
bool HasDiagHandler = false;
|
||||||
if (LLVMCtx.getInlineAsmDiagnosticHandler() != 0) {
|
if (LLVMCtx.getDiagnosticHandler() != 0) {
|
||||||
// If the source manager has an issue, we arrange for srcMgrDiagHandler
|
// If the source manager has an issue, we arrange for srcMgrDiagHandler
|
||||||
// to be invoked, getting DiagInfo passed into it.
|
// to be invoked, getting DiagInfo passed into it.
|
||||||
DiagInfo.LocInfo = LocMDNode;
|
DiagInfo.LocInfo = LocMDNode;
|
||||||
DiagInfo.DiagHandler = LLVMCtx.getInlineAsmDiagnosticHandler();
|
DiagInfo.DiagHandler = LLVMCtx.getDiagnosticHandler();
|
||||||
DiagInfo.DiagContext = LLVMCtx.getInlineAsmDiagnosticContext();
|
DiagInfo.DiagContext = LLVMCtx.getDiagnosticContext();
|
||||||
SrcMgr.setDiagHandler(srcMgrDiagHandler, &DiagInfo);
|
SrcMgr.setDiagHandler(srcMgrDiagHandler, &DiagInfo);
|
||||||
HasDiagHandler = true;
|
HasDiagHandler = true;
|
||||||
}
|
}
|
||||||
|
@ -73,24 +73,22 @@ void LLVMContext::removeModule(Module *M) {
|
|||||||
// Recoverable Backend Errors
|
// Recoverable Backend Errors
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
void LLVMContext::
|
void LLVMContext::setDiagnosticHandler(DiagHandlerTy DiagHandler,
|
||||||
setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
|
void *DiagContext) {
|
||||||
void *DiagContext) {
|
pImpl->DiagHandler = DiagHandler;
|
||||||
pImpl->InlineAsmDiagHandler = DiagHandler;
|
pImpl->DiagContext = DiagContext;
|
||||||
pImpl->InlineAsmDiagContext = DiagContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
|
/// getDiagnosticHandler - Return the diagnostic handler set by
|
||||||
/// setInlineAsmDiagnosticHandler.
|
/// setDiagnosticHandler.
|
||||||
LLVMContext::InlineAsmDiagHandlerTy
|
LLVMContext::DiagHandlerTy LLVMContext::getDiagnosticHandler() const {
|
||||||
LLVMContext::getInlineAsmDiagnosticHandler() const {
|
return pImpl->DiagHandler;
|
||||||
return pImpl->InlineAsmDiagHandler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getInlineAsmDiagnosticContext - Return the diagnostic context set by
|
/// getDiagnosticContext - Return the diagnostic context set by
|
||||||
/// setInlineAsmDiagnosticHandler.
|
/// setDiagnosticHandler.
|
||||||
void *LLVMContext::getInlineAsmDiagnosticContext() const {
|
void *LLVMContext::getDiagnosticContext() const {
|
||||||
return pImpl->InlineAsmDiagContext;
|
return pImpl->DiagContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMContext::emitError(const Twine &ErrorStr) {
|
void LLVMContext::emitError(const Twine &ErrorStr) {
|
||||||
@ -123,7 +121,7 @@ void LLVMContext::emitWarning(const Instruction *I, const Twine &ErrorStr) {
|
|||||||
|
|
||||||
void LLVMContext::emitError(unsigned LocCookie, 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 there is no error handler installed, just print the error and exit.
|
||||||
if (pImpl->InlineAsmDiagHandler == 0) {
|
if (pImpl->DiagHandler == 0) {
|
||||||
errs() << "error: " << ErrorStr << "\n";
|
errs() << "error: " << ErrorStr << "\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -131,12 +129,12 @@ void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) {
|
|||||||
// If we do have an error handler, we can report the error and keep going.
|
// If we do have an error handler, we can report the error and keep going.
|
||||||
SMDiagnostic Diag("", SourceMgr::DK_Error, ErrorStr.str());
|
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) {
|
void LLVMContext::emitWarning(unsigned LocCookie, const Twine &ErrorStr) {
|
||||||
// If there is no handler installed, just print the warning.
|
// If there is no handler installed, just print the warning.
|
||||||
if (pImpl->InlineAsmDiagHandler == 0) {
|
if (pImpl->DiagHandler == 0) {
|
||||||
errs() << "warning: " << ErrorStr << "\n";
|
errs() << "warning: " << ErrorStr << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -144,7 +142,7 @@ void LLVMContext::emitWarning(unsigned LocCookie, const Twine &ErrorStr) {
|
|||||||
// If we do have a handler, we can report the warning.
|
// If we do have a handler, we can report the warning.
|
||||||
SMDiagnostic Diag("", SourceMgr::DK_Warning, ErrorStr.str());
|
SMDiagnostic Diag("", SourceMgr::DK_Warning, ErrorStr.str());
|
||||||
|
|
||||||
pImpl->InlineAsmDiagHandler(Diag, pImpl->InlineAsmDiagContext, LocCookie);
|
pImpl->DiagHandler(Diag, pImpl->DiagContext, LocCookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -35,8 +35,8 @@ LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
|
|||||||
Int16Ty(C, 16),
|
Int16Ty(C, 16),
|
||||||
Int32Ty(C, 32),
|
Int32Ty(C, 32),
|
||||||
Int64Ty(C, 64) {
|
Int64Ty(C, 64) {
|
||||||
InlineAsmDiagHandler = 0;
|
DiagHandler = 0;
|
||||||
InlineAsmDiagContext = 0;
|
DiagContext = 0;
|
||||||
NamedStructTypesUniqueID = 0;
|
NamedStructTypesUniqueID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,8 +236,8 @@ public:
|
|||||||
/// will be automatically deleted if this context is deleted.
|
/// will be automatically deleted if this context is deleted.
|
||||||
SmallPtrSet<Module*, 4> OwnedModules;
|
SmallPtrSet<Module*, 4> OwnedModules;
|
||||||
|
|
||||||
LLVMContext::InlineAsmDiagHandlerTy InlineAsmDiagHandler;
|
LLVMContext::DiagHandlerTy DiagHandler;
|
||||||
void *InlineAsmDiagContext;
|
void *DiagContext;
|
||||||
|
|
||||||
typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt*,
|
typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt*,
|
||||||
DenseMapAPIntKeyInfo> IntMapTy;
|
DenseMapAPIntKeyInfo> IntMapTy;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user