[PATCH] D76385: Allow remapping Clang module include paths

Jonas Devlieghere via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 18 15:46:38 PDT 2020


JDevlieghere added inline comments.


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:2488
+  auto RemapPath = [&](std::string &Path) {
+    Path = remapDIPath(Path);
+    StringRef Relative(Path);
----------------
aprantl wrote:
> Is this legal?
> 
> remapDIPath takes a StringRef to Path. Is the sret value going to be a temporary or are we modifying the contents of the string while reading from it in remapDIPath?
No, this returns a `std::string` so you're returning a StringRef to a stack-allocated temporary. The lambda should return a `std::string` too. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76385/new/

https://reviews.llvm.org/D76385





More information about the cfe-commits mailing list