summaryrefslogtreecommitdiff
path: root/include/llvm-c
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-04-16 17:45:04 +0000
committerTom Stellard <thomas.stellard@amd.com>2014-04-16 17:45:04 +0000
commit57f45392e2439a9251d1a267ccf0a62c0bf36c0d (patch)
treecb1f03f4b8e0e372d349d148c8abfb4e4f3f9c60 /include/llvm-c
parent8cafc53ee45880107c8a2a3b0e3f23e830e0ffaf (diff)
downloadllvm-57f45392e2439a9251d1a267ccf0a62c0bf36c0d.tar.gz
llvm-57f45392e2439a9251d1a267ccf0a62c0bf36c0d.tar.bz2
llvm-57f45392e2439a9251d1a267ccf0a62c0bf36c0d.tar.xz
Added new functionality to LLVM C API to use DiagnosticInfo to handle errors
Patch by: Darren Powell git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206407 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm-c')
-rw-r--r--include/llvm-c/Core.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index 50c5e3ac46..df2de2441a 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -124,6 +124,12 @@ typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
* @see llvm::Use */
typedef struct LLVMOpaqueUse *LLVMUseRef;
+
+/**
+ * @see llvm::DiagnosticInfo
+ */
+typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef;
+
typedef enum {
LLVMZExtAttribute = 1<<0,
LLVMSExtAttribute = 1<<1,
@@ -400,6 +406,13 @@ typedef enum {
the old one */
} LLVMAtomicRMWBinOp;
+typedef enum {
+ LLVMDSError,
+ LLVMDSWarning,
+ LLVMDSRemark,
+ LLVMDSNote
+} LLVMDiagnosticSeverity;
+
/**
* @}
*/
@@ -453,6 +466,8 @@ void LLVMEnablePrettyStackTrace(void);
* @{
*/
+typedef void (*LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *);
+
/**
* Create a new context.
*
@@ -467,6 +482,13 @@ LLVMContextRef LLVMContextCreate(void);
LLVMContextRef LLVMGetGlobalContext(void);
/**
+ * Set the diagnostic handler for this context.
+ */
+void LLVMContextSetDiagnosticHandler(LLVMContextRef C,
+ LLVMDiagnosticHandler Handler,
+ void *DiagnosticContext);
+
+/**
* Destroy a context instance.
*
* This should be called for every call to LLVMContextCreate() or memory
@@ -474,6 +496,21 @@ LLVMContextRef LLVMGetGlobalContext(void);
*/
void LLVMContextDispose(LLVMContextRef C);
+/**
+ * Return a string representation of the DiagnosticInfo. Use
+ * LLVMDisposeMessage to free the string.
+ *
+ * @see DiagnosticInfo::print()
+ */
+char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI);
+
+/**
+ * Return an enum LLVMDiagnosticSeverity.
+ *
+ * @see DiagnosticInfo::getSeverity()
+ */
+LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI);
+
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char* Name,
unsigned SLen);
unsigned LLVMGetMDKindID(const char* Name, unsigned SLen);