diff options
author | Bolshakov <bolsh.andrey@yandex.ru> | 2022-07-20 18:54:10 +0300 |
---|---|---|
committer | Kim Gräsman <kim.grasman@gmail.com> | 2023-02-25 16:25:01 +0100 |
commit | db25b0d50b97f6754552813cd2f6161cac9f822f (patch) | |
tree | 85cac077957b2f167953bae2d37be9a5722dd2ba | |
parent | 8e6be6b2a517739677dfe64eeed745e700e303a9 (diff) |
Don't report into template definition file
Reporting of symbol usage in one file depending on another file analysis
seems strange. It could make some sense in order to note that template
definition file provides some internal stuff, but this form of analysis
depends on from which file it is performed and could not work when
performing analysis of the sole template definition file.
-rw-r--r-- | iwyu.cc | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -2971,12 +2971,9 @@ class InstantiatedTemplateVisitor const char* comment = nullptr, UseFlags extra_use_flags = 0) override { const SourceLocation actual_used_loc = GetLocOfTemplateThatProvides(decl); - if (actual_used_loc.isValid()) { - // If a template is responsible for this decl, then we don't add - // it to the cache; the cache is only for decls that the - // original caller is responsible for. - Base::ReportDeclUse(actual_used_loc, decl, comment, extra_use_flags); - } else { + // Report use only if template doesn't itself provide the declaration. + if (!actual_used_loc.isValid() || + GetFileEntry(actual_used_loc) == GetFileEntry(caller_loc())) { // Let all the currently active types and decls know about this // report, so they can update their cache entries. for (CacheStoringScope* storer : cache_storers_) |