kimgr added a comment.

I think we're seeing similar new behavior in IWYU, I've been meaning to bring 
it up on cfe-dev. But since it might be relevant here, I'll add our 
observations.

To us, it looks like friends in templates form their own redecl chain. An 
example:

  // template.h
  void foo();
  
  template<class T>
  struct Template {
    friend void foo();
  };
  
  // foo.h
  inline void foo() {
  }
  
  // main.cpp
  #include "template.h"
  #include "foo.h"
  
  Template<int> i;
  
  int main() {
    foo();  // attributed to Template<T>::foo
  }

This behavior changed in r283207.

We never got to the bottom of whether the redecl shuffling is correct or not, 
so we decided to just work around it, our code here:
https://github.com/include-what-you-use/include-what-you-use/blob/master/iwyu_ast_util.cc#L842

Relevant to this patch, I wonder if you're also about to work around a more 
central problem?


Repository:
  rL LLVM

https://reviews.llvm.org/D28399



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

Reply via email to