Skip to content

Commit f41479c

Browse files
committed
Move maybeBuf to higher scope too
1 parent 97f827b commit f41479c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,9 +1517,10 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
15171517
if (ClEmbedFaultingInst != MSanEmbedFaultingInstructionMode::None) {
15181518
IRBuilder<> IRB0(Instruction);
15191519
StringRef InstNameStrRef;
1520-
// Keep str at this scope level because it is indirectly needed by
1521-
// CreateGlobalString
1520+
// Keep str and maybeBuf at this scope level because they may be
1521+
// indirectly needed by CreateGlobalString
15221522
std::string str;
1523+
SmallVector<char> maybeBuf;
15231524

15241525
// Dumping the full instruction is expensive because the operands etc.
15251526
// likely make the string unique per instruction instance, hence we
@@ -1533,7 +1534,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
15331534
if (CallInst *CI = dyn_cast<CallInst>(Instruction)) {
15341535
if (CI->getCalledFunction()) {
15351536
Twine description = "call " + CI->getCalledFunction()->getName();
1536-
SmallVector<char> maybeBuf;
15371537
InstNameStrRef = description.toStringRef(maybeBuf);
15381538
} else {
15391539
InstNameStrRef = StringRef("Unknown call");

0 commit comments

Comments
 (0)