Skip to content

Commit 97f827b

Browse files
committed
Revert scope level change because it causes use-after-scope
1 parent 3dec04f commit 97f827b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,12 +1517,14 @@ 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
1522+
std::string str;
15201523

15211524
// Dumping the full instruction is expensive because the operands etc.
15221525
// likely make the string unique per instruction instance, hence we
15231526
// offer a choice whether to only print the instruction name.
15241527
if (ClEmbedFaultingInst == MSanEmbedFaultingInstructionMode::Full) {
1525-
std::string str;
15261528
llvm::raw_string_ostream buf(str);
15271529
Instruction->print(buf);
15281530
InstNameStrRef = StringRef(str);

0 commit comments

Comments
 (0)