radeon/llvm: Fix LLVM diagnostic error reporting
authorTom Stellard <thomas.stellard@amd.com>
Thu, 10 Jul 2014 17:06:52 +0000 (13:06 -0400)
committerTom Stellard <thomas.stellard@amd.com>
Tue, 15 Jul 2014 15:55:26 +0000 (11:55 -0400)
We were trying to print the error message after disposing the
message object.

Tested-by and Reviewed-by: Aaron Watry <awatry@gmail.com>

src/gallium/drivers/radeon/radeon_llvm_emit.c

index 6a394b265e441ce00382fa5da02654884d442cfa..1b17dd4613f25eddf1d966c01f09c1733d7ba8dd 100644 (file)
@@ -83,16 +83,13 @@ static LLVMTargetRef get_r600_target() {
 #if HAVE_LLVM >= 0x0305
 
 static void radeonDiagnosticHandler(LLVMDiagnosticInfoRef di, void *context) {
-       unsigned int *diagnosticflag;
-       char *diaginfo_message;
-
-       diaginfo_message = LLVMGetDiagInfoDescription(di);
-       LLVMDisposeMessage(diaginfo_message);
-
-       diagnosticflag = (unsigned int *)context;
        if (LLVMGetDiagInfoSeverity(di) == LLVMDSError) {
+               unsigned int *diagnosticflag = (unsigned int *)context;
+               char *diaginfo_message = LLVMGetDiagInfoDescription(di);
+
                *diagnosticflag = 1;
                fprintf(stderr,"LLVM triggered Diagnostic Handler: %s\n", diaginfo_message);
+               LLVMDisposeMessage(diaginfo_message);
        }
 }