summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/NamedDeclPrinterTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2015-11-09 16:45:17 +0000
committerAlexander Kornienko <alexfh@google.com>2015-11-09 16:45:17 +0000
commit4f35532dbe645f4a349ea63951d659334359abd9 (patch)
tree0d902c5247183a6f51bfe21aa6514f8cc10cc29e /clang/unittests/AST/NamedDeclPrinterTest.cpp
parent3f5dfc256204b4f4825fbfbfc7c9f985f4e78422 (diff)
downloadbcm5719-llvm-4f35532dbe645f4a349ea63951d659334359abd9.tar.gz
bcm5719-llvm-4f35532dbe645f4a349ea63951d659334359abd9.zip
Adjust printQualifiedName to handle unscoped enums in a way similar to anonymous namespaces.
Patch by Sterling Augustine! Differential revision: http://reviews.llvm.org/D14459 llvm-svn: 252488
Diffstat (limited to 'clang/unittests/AST/NamedDeclPrinterTest.cpp')
-rw-r--r--clang/unittests/AST/NamedDeclPrinterTest.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/clang/unittests/AST/NamedDeclPrinterTest.cpp b/clang/unittests/AST/NamedDeclPrinterTest.cpp
index cf97a0abf6c..92df4577ac7 100644
--- a/clang/unittests/AST/NamedDeclPrinterTest.cpp
+++ b/clang/unittests/AST/NamedDeclPrinterTest.cpp
@@ -131,3 +131,45 @@ TEST(NamedDeclPrinter, TestNamespace2) {
"A",
"A"));
}
+
+TEST(NamedDeclPrinter, TestUnscopedUnnamedEnum) {
+ ASSERT_TRUE(PrintedWrittenNamedDeclCXX11Matches(
+ "enum { A };",
+ "A",
+ "A"));
+}
+
+TEST(NamedDeclPrinter, TestNamedEnum) {
+ ASSERT_TRUE(PrintedWrittenNamedDeclCXX11Matches(
+ "enum X { A };",
+ "A",
+ "X::A"));
+}
+
+TEST(NamedDeclPrinter, TestScopedNamedEnum) {
+ ASSERT_TRUE(PrintedWrittenNamedDeclCXX11Matches(
+ "enum class X { A };",
+ "A",
+ "X::A"));
+}
+
+TEST(NamedDeclPrinter, TestClassWithUnscopedUnnamedEnum) {
+ ASSERT_TRUE(PrintedWrittenNamedDeclCXX11Matches(
+ "class X { enum { A }; };",
+ "A",
+ "X::A"));
+}
+
+TEST(NamedDeclPrinter, TestClassWithUnscopedNamedEnum) {
+ ASSERT_TRUE(PrintedWrittenNamedDeclCXX11Matches(
+ "class X { enum Y { A }; };",
+ "A",
+ "X::Y::A"));
+}
+
+TEST(NamedDeclPrinter, TestClassWithScopedNamedEnum) {
+ ASSERT_TRUE(PrintedWrittenNamedDeclCXX11Matches(
+ "class X { enum class Y { A }; };",
+ "A",
+ "X::Y::A"));
+}
OpenPOWER on IntegriCloud