================
@@ -1341,9 +1341,22 @@ class ASTReader
   serialization::InputFile getInputFile(ModuleFile &F, unsigned ID,
                                         bool Complain = true);
 
+  /// Buffer we use as temporary storage backing resolved paths.
+  SmallString<256> PathBuf;
----------------
benlangmuir wrote:

@ChuanqiXu9 a static local would be global to the process instead of the 
compilation, which is unsafe if you have two independent `CompilerInstance` 
running in parallel.

@jansvoboda11 just an idea: would it help if we change the return type to some 
RAII object that takes temporary ownership of the path buffer? It would prevent 
the new kind of misuse: multiple calls to `ResolveImportedPath` with 
overlapping lifetimes for their results. It wouldn't prevent escaping a 
StringRef in callers (e.g. when calling `visitInputFile`), but that's also true 
today with `std::string`.

https://github.com/llvm/llvm-project/pull/113984
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to