[compiler-rt] r194687 - [UBSan] Update UBSan location rendering to match r194686

Alexey Samsonov samsonov at google.com
Thu Nov 14 01:54:10 PST 2013


Author: samsonov
Date: Thu Nov 14 03:54:10 2013
New Revision: 194687

URL: http://llvm.org/viewvc/llvm-project?rev=194687&view=rev
Log:
[UBSan] Update UBSan location rendering to match r194686

Modified:
    compiler-rt/trunk/lib/ubsan/ubsan_diag.cc

Modified: compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_diag.cc?rev=194687&r1=194686&r2=194687&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_diag.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag.cc Thu Nov 14 03:54:10 2013
@@ -77,27 +77,29 @@ static void PrintHex(UIntMax Val) {
 }
 
 static void renderLocation(Location Loc) {
+  InternalScopedString LocBuffer(1024);
   switch (Loc.getKind()) {
   case Location::LK_Source: {
     SourceLocation SLoc = Loc.getSourceLocation();
     if (SLoc.isInvalid())
-      Printf("<unknown>");
+      LocBuffer.append("<unknown>");
     else
-      PrintSourceLocation(SLoc.getFilename(), SLoc.getLine(), SLoc.getColumn());
+      PrintSourceLocation(&LocBuffer, SLoc.getFilename(), SLoc.getLine(),
+                          SLoc.getColumn());
     break;
   }
   case Location::LK_Module:
-    PrintModuleAndOffset(Loc.getModuleLocation().getModuleName(),
+    PrintModuleAndOffset(&LocBuffer, Loc.getModuleLocation().getModuleName(),
                          Loc.getModuleLocation().getOffset());
     break;
   case Location::LK_Memory:
-    Printf("%p", Loc.getMemoryLocation());
+    LocBuffer.append("%p", Loc.getMemoryLocation());
     break;
   case Location::LK_Null:
-    Printf("<unknown>");
+    LocBuffer.append("<unknown>");
     break;
   }
-  Printf(":");
+  Printf("%s:", LocBuffer.data());
 }
 
 static void renderText(const char *Message, const Diag::Arg *Args) {





More information about the llvm-commits mailing list