summaryrefslogtreecommitdiffstats
path: root/iwyu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'iwyu.cc')
-rw-r--r--iwyu.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/iwyu.cc b/iwyu.cc
index 18e7ed1..5dbb34b 100644
--- a/iwyu.cc
+++ b/iwyu.cc
@@ -3206,7 +3206,7 @@ class InstantiatedTemplateVisitor
ast_node != caller_ast_node_; ast_node = ast_node->parent()) {
if (preprocessor_info().PublicHeaderIntendsToProvide(
GetFileEntry(ast_node->GetLocation()),
- GetFileEntry(decl)))
+ GetFileEntry(decl->getLocation())))
return ast_node->GetLocation();
}
return SourceLocation(); // an invalid source-loc
@@ -3218,8 +3218,10 @@ class InstantiatedTemplateVisitor
bool IsProvidedByTemplate(const Type* type) const {
type = RemoveSubstTemplateTypeParm(type);
type = RemovePointersAndReferences(type); // get down to the decl
- if (const NamedDecl* decl = TypeToDeclAsWritten(type))
+ if (const NamedDecl* decl = TypeToDeclAsWritten(type)) {
+ decl = GetDefinitionAsWritten(decl);
return GetLocOfTemplateThatProvides(decl).isValid();
+ }
return true; // we always provide non-decl types like int, etc.
}