Mesa (master): radeon/llvm: Fix LLVM diagnostic error reporting

Tom Stellard tstellar at kemper.freedesktop.org
Tue Jul 15 16:06:32 UTC 2014


Module: Mesa
Branch: master
Commit: 0d711e719e7c5b5a4a34521af97d84f3fb628efd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d711e719e7c5b5a4a34521af97d84f3fb628efd

Author: Tom Stellard <thomas.stellard at amd.com>
Date:   Thu Jul 10 13:06:52 2014 -0400

radeon/llvm: Fix LLVM diagnostic error reporting

We were trying to print the error message after disposing the
message object.

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

---

 src/gallium/drivers/radeon/radeon_llvm_emit.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c
index 6a394b2..1b17dd4 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
@@ -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);
 	}
 }
 




More information about the mesa-commit mailing list