[PATCH] D76869: [Clang] Restore replace_path_prefix instead of startswith

Sylvain Audi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 11:49:24 PDT 2020


saudi marked an inline comment as done.
saudi added inline comments.


================
Comment at: clang/lib/Lex/PPMacroExpansion.cpp:1545
       remapMacroPath(FN, PPOpts->MacroPrefixMap);
+      Lexer::Stringify(FN);
       OS << '"' << FN << '"';
----------------
MaskRay wrote:
> Does this need to be swapped?
`Lexer::Stringify` doubles backslashes in Windows-style paths.

So, without this patch, using the `-fmacro-prefix-map=[X]:[Y]` requires doubling backslashes for `[X]`, whereas `-fdebug-prefix-map=` requires single backslashes.

Also, in the tests : `%clang -E -fmacro-prefix-map=%p=A:\UNLIKELY_PATH=empty`  would never match `%p` prefix on Windows platform, as `%p` contains single blackslashes.




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

https://reviews.llvm.org/D76869





More information about the llvm-commits mailing list