Lekensteyn added inline comments.

================
Comment at: lib/CodeGen/CGDebugInfo.cpp:607
   llvm::DIFile *CUFile = DBuilder.createFile(
-      remapDIPath(MainFileName), remapDIPath(getCurrentDirname()), CSInfo,
+      MainFileName, remapDIPath(getCurrentDirname()), CSInfo,
       getSource(SM, SM.getMainFileID()));
----------------
dankm wrote:
> Lekensteyn wrote:
> > Any reason for dropping `remapDIPath` here? Wouldn't this result in the 
> > full path being included even when using:
> > 
> >     clang -fdebug-prefix-map=/full/path/= /full/path/source.c
> Whoops. That probably shouldn't have been included this round. This is a 
> bugfix. MainFileName is already remapped from earlier in this function, this 
> keeps it from remapping twice if you have an empty old prefix.
The remapping was done here:
```c
  std::string MainFileDir;
  if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
    MainFileDir = remapDIPath(MainFile->getDir()->getName());
```

(Observation: the declaration could probably be moved inside the `if` block 
since it is not used outside.)

What about the second case though? For example, assume `/tmp/testdir/mytest.ii`:
```
# 1 "/tmp/mytest.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "/tmp/mytest.c"
int main(int argc, const char *argv[])
{
    return 0;
}
```

What happens if you now compile with `clang -fdebug-prefix-map=/tmp/=/bla/ 
/tmp/testdir/mytest.ii` from `/tmp/testdir`?

Unless this affects the current patch, consider moving it to a separate change.


Repository:
  rC Clang

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

https://reviews.llvm.org/D49466



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to