Author: Sam McCall Date: 2021-12-15T21:59:54+01:00 New Revision: 62bcb75ce5108c2536b8bf7f4428034d418b9c0b
URL: https://github.com/llvm/llvm-project/commit/62bcb75ce5108c2536b8bf7f4428034d418b9c0b DIFF: https://github.com/llvm/llvm-project/commit/62bcb75ce5108c2536b8bf7f4428034d418b9c0b.diff LOG: [AST] Add more testcases to QualTypeNamesTest. NFC These all currently pass, but are tricky cases not currently covered. https://reviews.llvm.org/D114251 would break them in its current state. Added: Modified: clang/unittests/Tooling/QualTypeNamesTest.cpp Removed: ################################################################################ diff --git a/clang/unittests/Tooling/QualTypeNamesTest.cpp b/clang/unittests/Tooling/QualTypeNamesTest.cpp index 4ae6861751b8..336a27e69be5 100644 --- a/clang/unittests/Tooling/QualTypeNamesTest.cpp +++ b/clang/unittests/Tooling/QualTypeNamesTest.cpp @@ -92,6 +92,9 @@ TEST(QualTypeNameTest, getFullyQualifiedName) { "OuterTemplateClass<A::B::Class0>::Inner"; Visitor.ExpectedQualTypeNames["CheckM"] = "const A::B::Class0 *"; Visitor.ExpectedQualTypeNames["CheckN"] = "const X *"; + Visitor.ExpectedQualTypeNames["ttp_using"] = + "OuterTemplateClass<A::B::Class0>"; + Visitor.ExpectedQualTypeNames["alias_of_template"] = "ABTemplate0IntInt"; Visitor.runOver( "int CheckInt;\n" "template <typename T>\n" @@ -124,6 +127,9 @@ TEST(QualTypeNameTest, getFullyQualifiedName) { "}\n" "using A::B::Class0;\n" "void Function(Class0 CheckF);\n" + "OuterTemplateClass<Class0> ttp_using;\n" + "using ABTemplate0IntInt = A::B::Template0<int, int>;\n" + "void Function(ABTemplate0IntInt alias_of_template);\n" "using namespace A::B::C;\n" "void Function(MyInt CheckG);\n" "void f() {\n" @@ -182,6 +188,25 @@ TEST(QualTypeNameTest, getFullyQualifiedName) { " struct A { typedef int X; };" "}"); + TypeNameVisitor DoubleUsing; + DoubleUsing.ExpectedQualTypeNames["direct"] = "a::A<0>"; + DoubleUsing.ExpectedQualTypeNames["indirect"] = "b::B"; + DoubleUsing.ExpectedQualTypeNames["double_indirect"] = "b::B"; + DoubleUsing.runOver(R"cpp( + namespace a { + template<int> class A {}; + A<0> direct; + } + namespace b { + using B = ::a::A<0>; + B indirect; + } + namespace b { + using ::b::B; + B double_indirect; + } + )cpp"); + TypeNameVisitor GlobalNsPrefix; GlobalNsPrefix.WithGlobalNsPrefix = true; GlobalNsPrefix.ExpectedQualTypeNames["IntVal"] = "int"; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits