summaryrefslogtreecommitdiff
path: root/lib/ubsan/ubsan_diag.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ubsan/ubsan_diag.cc')
-rw-r--r--lib/ubsan/ubsan_diag.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/ubsan/ubsan_diag.cc b/lib/ubsan/ubsan_diag.cc
index 158408b7d..fa643658e 100644
--- a/lib/ubsan/ubsan_diag.cc
+++ b/lib/ubsan/ubsan_diag.cc
@@ -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) {