diff --git a/Sources/idt/idt.cc b/Sources/idt/idt.cc index cfc7d2b..1a8f9a8 100644 --- a/Sources/idt/idt.cc +++ b/Sources/idt/idt.cc @@ -436,7 +436,9 @@ class visitor : public clang::RecursiveASTVisitor { // Insert the annotation immediately before the tag name, which is the // position returned by getLocation. clang::LangOptions LO = RD->getASTContext().getLangOpts(); - clang::SourceLocation SLoc = RD->getLocation(); + clang::SourceLocation SLoc = RD->getQualifier() + ? RD->getQualifierLoc().getBeginLoc() + : RD->getLocation(); const clang::SourceLocation location = context_.getFullLoc(SLoc).getExpansionLoc(); unexported_public_interface(RD, location) diff --git a/Tests/QualifiedRecordNames.hh b/Tests/QualifiedRecordNames.hh new file mode 100644 index 0000000..389b9d6 --- /dev/null +++ b/Tests/QualifiedRecordNames.hh @@ -0,0 +1,29 @@ +// RUN: %idt --export-macro=IDT_TEST_ABI %s 2>&1 | %FileCheck %s + +namespace ContainerNamespace { + // CHECK-NOT: QualifiedRecordNames.hh:[[@LINE+1]]:{{.*}} + struct QualifiedNameClass; +} + +// CHECK: QualifiedRecordNames.hh:[[@LINE+1]]:8: remark: unexported public interface 'QualifiedNameClass' +struct ContainerNamespace::QualifiedNameClass { +// CHECK-NOT: QualifiedRecordNames.hh:[[@LINE-1]]:{{.*}} + + // CHECK-NOT: QualifiedRecordNames.hh:[[@LINE+1]]:{{.*}} + virtual void method(); +}; + +// CHECK-NOT: QualifiedRecordNames.hh:[[@LINE+1]]:{{.*}} +struct ContainerClass { + // CHECK-NOT: QualifiedRecordNames.hh:[[@LINE+1]]:{{.*}} + struct QualifiedNameClass; +}; + +// CHECK: QualifiedRecordNames.hh:[[@LINE+1]]:8: remark: unexported public interface 'QualifiedNameClass' +struct ContainerClass::QualifiedNameClass { +// CHECK-NOT: QualifiedRecordNames.hh:[[@LINE-1]]:{{.*}} + + // CHECK-NOT: QualifiedRecordNames.hh:[[@LINE+1]]:{{.*}} + virtual void method(); +}; +