[PATCH] D124874: [clang] add -fmodule-file-home-is-cwd

Richard Howell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 9 07:19:53 PDT 2022


rmaz added inline comments.


================
Comment at: clang/lib/Serialization/ASTWriter.cpp:1231-1236
+    SmallString<128> BaseDir(CWD->getName());
+    cleanPathForOutput(Context.getSourceManager().getFileManager(), BaseDir);
+    BaseDirectory.assign(BaseDir.begin(), BaseDir.end());
+  } else if (WritingModule && WritingModule->Directory) {
     SmallString<128> BaseDir(WritingModule->Directory->getName());
     cleanPathForOutput(Context.getSourceManager().getFileManager(), BaseDir);
----------------
urnathan wrote:
> This looks unfortunately duplicatey.  Any less-worse way of avoiding that?
It could be moved into the `else` clause at the cost of complicating the `if` statement with another case and adding another nested `if`. I thought it was simpler like this, but can change if you prefer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124874



More information about the cfe-commits mailing list