forked from include-what-you-use/include-what-you-use
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang compat] Fix explicit instantiation handling
llvm/llvm-project@1202837 removed TemplateSpecializationType child node from ClassTemplateSpecializationDecl, replacing it just with template arguments. To maintain instantiation scanning, the new InstantiatedTemplateVisitor interface and other functions have been introduced which don't require TemplateSpecializationType. They may be further reused for handling the cases then a specific TemplateSpecializationType is lost. The comment in VisitClassTemplateSpecializationDecl was wrong: it is not clang but IWYU GetLocation function which attributes ClassTemplateSpecializationDecl to the original template location. An exception for explicit instantiations has been added to it. However, method declarations should still be attributed to the class template definition, hence the change for them to maintain the old behavior. Because GetLocation doesn't "canonicalize" explicit instantiation locations now, the change in VisitTemplateSpecializationType is needed to handle the cases when the instantiation is explicit (as opposed to implicit ones). Besides, it looks more straightforward to report template declarations directly, not through ClassTemplateSpecializationDecl. A couple of new test cases added to make sure that the work has been done properly. One functional change: explicit instantiation definitions don't require explicit instantiation declarations. I think it was just useless.
- Loading branch information
1 parent
53ce70e
commit 4f620e8
Showing
8 changed files
with
151 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters