[PATCH] D49466: Initial implementation of -fmacro-prefix-map and -ffile-prefix-map

Joerg Sonnenberger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 1 11:38:41 PDT 2018


joerg added inline comments.


================
Comment at: lib/Lex/PPMacroExpansion.cpp:1460
+  for (const auto &Entry : MacroPrefixMap)
+    if (Path.startswith(Entry.first))
+      return (Twine(Entry.second) + Path.substr(Entry.first.size())).str();
----------------
Lekensteyn wrote:
> dankm wrote:
> > dankm wrote:
> > > joerg wrote:
> > > > This doesn't handle directory vs string prefix prefix correctly, does it? At the very least, it should have a test case :)
> > > Good catch. I expect not. But on the other hand, it's exactly what debug-prefix-map does :)
> > > 
> > > I'll add test cases in a future review. My first goal was getting something sort-of working.
> > There should be a test, but apparently the debug prefix map code also does this.
> > 
> > What do you think the correct behaviour should be? a string prefix, or a directory prefix?
> It should be a string prefix (like GCC)
I disagree. I consider it a bug in GCC that it is a string prefix. It's quite inconsistent as well.


Repository:
  rC Clang

https://reviews.llvm.org/D49466





More information about the cfe-commits mailing list