lh123 updated this revision to Diff 232770.
lh123 added a comment.
Address comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71172/new/
https://reviews.llvm.org/D71172
Files:
clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
Index: clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
===================================================================
--- clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
+++ clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
@@ -61,7 +61,9 @@
llvm::StringSaver Saver(Alloc);
llvm::cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, *FS,
llvm::StringRef(Cmd.Directory));
- Cmd.CommandLine.assign(Argv.begin(), Argv.end());
+ // Don't assign directly, Argv aliases CommandLine
+ std::vector<std::string> ExpandedArgv(Argv.begin(), Argv.end());
+ Cmd.CommandLine = std::move(ExpandedArgv);
}
return Cmds;
}
Index: clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
===================================================================
--- clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
+++ clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp
@@ -61,7 +61,9 @@
llvm::StringSaver Saver(Alloc);
llvm::cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, *FS,
llvm::StringRef(Cmd.Directory));
- Cmd.CommandLine.assign(Argv.begin(), Argv.end());
+ // Don't assign directly, Argv aliases CommandLine
+ std::vector<std::string> ExpandedArgv(Argv.begin(), Argv.end());
+ Cmd.CommandLine = std::move(ExpandedArgv);
}
return Cmds;
}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits