const auto *InternalDependency =
Result.Nodes.getNodeAs<NestedNameSpecifierLoc>("InternalDep");
- diag(InternalDependency->getBeginLoc(),
+ SourceLocation LocAtFault =
+ Result.SourceManager->getSpellingLoc(InternalDependency->getBeginLoc());
+
+ if (!LocAtFault.isValid())
+ return;
+
+ diag(LocAtFault,
"do not reference any 'internal' namespaces; those implementation "
"details are reserved to Abseil");
}
void MacroUse() {
USE_INTERNAL(Function); // no-warning
USE_EXTERNAL(Function);
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil
+ // CHECK-MESSAGES: :[[@LINE-5]]:25: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil
}
+
+class A : absl::container_internal::InternalStruct {};
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil
+
+template <typename T>
+class B : absl::container_internal::InternalTemplate<T> {};
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil
+
+template <typename T> class C : absl::container_internal::InternalTemplate<T> {
+public:
+ template <typename U> static C Make(U *p) { return C{}; }
+};
+// CHECK-MESSAGES: :[[@LINE-4]]:33: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil