summaryrefslogtreecommitdiff
path: root/include/llvm/IR/LLVMContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/IR/LLVMContext.h')
-rw-r--r--include/llvm/IR/LLVMContext.h43
1 files changed, 29 insertions, 14 deletions
diff --git a/include/llvm/IR/LLVMContext.h b/include/llvm/IR/LLVMContext.h
index 4cb77701f762..a95634d32c21 100644
--- a/include/llvm/IR/LLVMContext.h
+++ b/include/llvm/IR/LLVMContext.h
@@ -16,6 +16,7 @@
#define LLVM_IR_LLVMCONTEXT_H
#include "llvm-c/Types.h"
+#include "llvm/IR/DiagnosticHandler.h"
#include "llvm/Support/CBindingWrapping.h"
#include "llvm/Support/Options.h"
#include <cstdint>
@@ -99,6 +100,8 @@ public:
MD_section_prefix = 20, // "section_prefix"
MD_absolute_symbol = 21, // "absolute_symbol"
MD_associated = 22, // "associated"
+ MD_callees = 23, // "callees"
+ MD_irr_loop = 24, // "irr_loop"
};
/// Known operand bundle tag IDs, which always have the same value. All
@@ -167,11 +170,6 @@ public:
using InlineAsmDiagHandlerTy = void (*)(const SMDiagnostic&, void *Context,
unsigned LocCookie);
- /// Defines the type of a diagnostic handler.
- /// \see LLVMContext::setDiagnosticHandler.
- /// \see LLVMContext::diagnose.
- using DiagnosticHandlerTy = void (*)(const DiagnosticInfo &DI, void *Context);
-
/// Defines the type of a yield callback.
/// \see LLVMContext::setYieldCallback.
using YieldCallbackTy = void (*)(LLVMContext *Context, void *OpaqueHandle);
@@ -194,26 +192,43 @@ public:
/// setInlineAsmDiagnosticHandler.
void *getInlineAsmDiagnosticContext() const;
- /// setDiagnosticHandler - This method sets a handler that is invoked
- /// when the backend needs to report anything to the user. The first
- /// argument is a function pointer and the second is a context pointer that
- /// gets passed into the DiagHandler. The third argument should be set to
+ /// setDiagnosticHandlerCallBack - This method sets a handler call back
+ /// that is invoked when the backend needs to report anything to the user.
+ /// The first argument is a function pointer and the second is a context pointer
+ /// that gets passed into the DiagHandler. The third argument should be set to
/// true if the handler only expects enabled diagnostics.
///
/// LLVMContext doesn't take ownership or interpret either of these
/// pointers.
- void setDiagnosticHandler(DiagnosticHandlerTy DiagHandler,
- void *DiagContext = nullptr,
+ void setDiagnosticHandlerCallBack(
+ DiagnosticHandler::DiagnosticHandlerTy DiagHandler,
+ void *DiagContext = nullptr, bool RespectFilters = false);
+
+ /// setDiagnosticHandler - This method sets unique_ptr to object of DiagnosticHandler
+ /// to provide custom diagnostic handling. The first argument is unique_ptr of object
+ /// of type DiagnosticHandler or a derived of that. The third argument should be
+ /// set to true if the handler only expects enabled diagnostics.
+ ///
+ /// Ownership of this pointer is moved to LLVMContextImpl.
+ void setDiagnosticHandler(std::unique_ptr<DiagnosticHandler> &&DH,
bool RespectFilters = false);
- /// getDiagnosticHandler - Return the diagnostic handler set by
- /// setDiagnosticHandler.
- DiagnosticHandlerTy getDiagnosticHandler() const;
+ /// getDiagnosticHandlerCallBack - Return the diagnostic handler call back set by
+ /// setDiagnosticHandlerCallBack.
+ DiagnosticHandler::DiagnosticHandlerTy getDiagnosticHandlerCallBack() const;
/// getDiagnosticContext - Return the diagnostic context set by
/// setDiagnosticContext.
void *getDiagnosticContext() const;
+ /// getDiagHandlerPtr - Returns const raw pointer of DiagnosticHandler set by
+ /// setDiagnosticHandler.
+ const DiagnosticHandler *getDiagHandlerPtr() const;
+
+ /// getDiagnosticHandler - transfers owenership of DiagnosticHandler unique_ptr
+ /// to caller.
+ std::unique_ptr<DiagnosticHandler> getDiagnosticHandler();
+
/// \brief Return if a code hotness metric should be included in optimization
/// diagnostics.
bool getDiagnosticsHotnessRequested() const;