summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBolshakov <bolsh.andrey@yandex.ru>2022-07-20 18:54:10 +0300
committerKim Gräsman <kim.grasman@gmail.com>2023-02-25 16:25:01 +0100
commitdb25b0d50b97f6754552813cd2f6161cac9f822f (patch)
tree85cac077957b2f167953bae2d37be9a5722dd2ba
parent8e6be6b2a517739677dfe64eeed745e700e303a9 (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.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/iwyu.cc b/iwyu.cc
index c456676..bf08cbc 100644
--- a/iwyu.cc
+++ b/iwyu.cc
@@ -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_)