[PATCH] D135220: [clang] Update ModuleMap::getModuleMapFile* to use FileEntryRef

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 13 10:25:57 PDT 2022


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



More information about the cfe-commits mailing list