[llvm-commits] [llvm] r100504 - in /llvm/trunk: include/llvm/Support/SourceMgr.h lib/Support/SourceMgr.cpp
Chris Lattner
sabre at nondot.org
Mon Apr 5 17:33:43 PDT 2010
Author: lattner
Date: Mon Apr 5 19:33:43 2010
New Revision: 100504
URL: http://llvm.org/viewvc/llvm-project?rev=100504&view=rev
Log:
give the SourceMgr object a cookie.
Modified:
llvm/trunk/include/llvm/Support/SourceMgr.h
llvm/trunk/lib/Support/SourceMgr.cpp
Modified: llvm/trunk/include/llvm/Support/SourceMgr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=100504&r1=100503&r2=100504&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/SourceMgr.h (original)
+++ llvm/trunk/include/llvm/Support/SourceMgr.h Mon Apr 5 19:33:43 2010
@@ -35,7 +35,8 @@
/// DiagHandlerTy - Clients that want to handle their own diagnostics in a
/// custom way can register a function pointer+context as a diagnostic
/// handler. It gets called each time PrintMessage is invoked.
- typedef void (*DiagHandlerTy)(const SMDiagnostic&, void *Context);
+ typedef void (*DiagHandlerTy)(const SMDiagnostic&, void *Context,
+ unsigned LocCookie);
private:
struct SrcBuffer {
/// Buffer - The memory buffer for the file.
@@ -59,6 +60,7 @@
DiagHandlerTy DiagHandler;
void *DiagContext;
+ unsigned DiagLocCookie;
SourceMgr(const SourceMgr&); // DO NOT IMPLEMENT
void operator=(const SourceMgr&); // DO NOT IMPLEMENT
@@ -71,10 +73,12 @@
}
/// setDiagHandler - Specify a diagnostic handler to be invoked every time
- /// PrintMessage is called.
- void setDiagHandler(DiagHandlerTy DH, void *Ctx = 0) {
+ /// PrintMessage is called. Ctx and Cookie are passed into the handler when
+ /// it is invoked.
+ void setDiagHandler(DiagHandlerTy DH, void *Ctx = 0, unsigned Cookie = 0) {
DiagHandler = DH;
DiagContext = Ctx;
+ DiagLocCookie = Cookie;
}
const SrcBuffer &getBufferInfo(unsigned i) const {
Modified: llvm/trunk/lib/Support/SourceMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=100504&r1=100503&r2=100504&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SourceMgr.cpp (original)
+++ llvm/trunk/lib/Support/SourceMgr.cpp Mon Apr 5 19:33:43 2010
@@ -178,7 +178,8 @@
const char *Type, bool ShowLine) const {
// Report the message with the diagnostic handler if present.
if (DiagHandler) {
- DiagHandler(GetMessage(Loc, Msg, Type, ShowLine), DiagContext);
+ DiagHandler(GetMessage(Loc, Msg, Type, ShowLine),
+ DiagContext, DiagLocCookie);
return;
}
More information about the llvm-commits
mailing list