hans added a comment.

Here's a reproducer of what's happening in our case. It's using the 
preprocessor because that's the easiest, but the real problem for us is that 
the debug info is pointing to the wrong file (and that it's different depending 
on the symlinkedness of the include).

  $ cat /tmp/foo.h
  #ifdef X
  #undef X
  int x;
  #endif
  
  #ifdef Y
  #undef Y
  int y;
  #endif
  
  $ ln -s /tmp/foo.h /tmp/bar.h
  
  $ cat /tmp/a.cc
  #define X
  #include "foo.h"
  #define Y
  #include "bar.h"
  
  $ build/bin/clang -E -o - /tmp/a.cc
  # 1 "/tmp/a.cc"
  # 1 "<built-in>" 1
  # 1 "<built-in>" 3
  # 437 "<built-in>" 3
  # 1 "<command line>" 1
  # 1 "<built-in>" 2
  # 1 "/tmp/a.cc" 2
  
  # 1 "/tmp/foo.h" 1
  
  
  int x;
  # 3 "/tmp/a.cc" 2
  
  # 1 "/tmp/foo.h" 1
  
  
  
  
  
  
  
  int y;
  # 5 "/tmp/a.cc" 2

Note that the second `# 1 "/tmp/foo.h" 1` should really be `bar.h`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135220

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

Reply via email to