================
@@ -5354,108 +5354,87 @@ std::string CompilerInvocation::computeContextHash()
const {
return toString(llvm::APInt(64, Hash), 36, /*Signed=*/false);
}
-void CompilerInvocationBase::visitPathsImpl(
- llvm::function_ref<bool(std::string &)> Predicate) {
-#define RETURN_IF(PATH)
\
+void CowCompilerInvocation::visitMutPaths(
+ llvm::function_ref<VisitMutResult(StringRef, std::string &)> Cb) {
+ std::string NewValue;
+
+#define RETURN_IF(OPTS, PATH)
\
do {
\
- if (Predicate(PATH))
\
+ VisitMutResult Res = Cb(PATH, NewValue);
\
+ if (Res.Replace) {
\
+ (void)ensureOwned(OPTS);
\
+ PATH = "";
\
----------------
benlangmuir wrote:
This is very minor, but `.clear()` optimizes better than assignment to empty
string. Despite the compiler being able to detect the string has length 0 it
still ends up calling out to library functions.
https://github.com/llvm/llvm-project/pull/205686
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits