]> granicus.if.org Git - clang/commitdiff
Testing C++ declarations embedded in
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 5 Dec 2012 19:54:11 +0000 (19:54 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 5 Dec 2012 19:54:11 +0000 (19:54 +0000)
<declaration> tag of Comment XML.
Added DeclPrint support for constructors
and fix tests accordingly.
This is wip. // rdar://12378714

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169412 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclPrinter.cpp
test/Index/comment-to-html-xml-conversion.cpp
unittests/AST/DeclPrinterTest.cpp

index d06ccc51577eb78aa069c86a667d5ef117191406..95d56b69d7b4dd4262628a58236ba33a2ad420fa 100644 (file)
@@ -547,6 +547,8 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
         }
         Out << ")";
       }
+      if (!Proto.empty())
+        Out << Proto;
     }
     else
       AFT->getResultType().print(Out, Policy, Proto);
index e9d2ad5e180b4641c615b8e85a15b290a9460f74..2809415c6cccf8cf552b995f51d91261ff3b5916 100644 (file)
@@ -593,7 +593,7 @@ class comment_to_xml_conversion_01 {
   /// \param aaa Blah blah.
   comment_to_xml_conversion_01(int aaa);
 
-// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:3: CXXConstructor=comment_to_xml_conversion_01:{{.*}} FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="3"><Name>comment_to_xml_conversion_01</Name><USR>c:@C@comment_to_xml_conversion_01@F@comment_to_xml_conversion_01#I#</USR><Declaration></Declaration><Parameters><Parameter><Name>aaa</Name><Index>0</Index><Direction isExplicit="0">in</Direction><Discussion><Para> Blah blah.</Para></Discussion></Parameter></Parameters></Function>]
+// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:3: CXXConstructor=comment_to_xml_conversion_01:{{.*}} FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="3"><Name>comment_to_xml_conversion_01</Name><USR>c:@C@comment_to_xml_conversion_01@F@comment_to_xml_conversion_01#I#</USR><Declaration>comment_to_xml_conversion_01(int aaa)</Declaration><Parameters><Parameter><Name>aaa</Name><Index>0</Index><Direction isExplicit="0">in</Direction><Discussion><Para> Blah blah.</Para></Discussion></Parameter></Parameters></Function>]
 
   /// Aaa.
   ~comment_to_xml_conversion_01();
index a2fc839b9c8e5299c7c8a7a5091c42e54001820a..a770022e05403aa981980a4fc7e254009b113df1 100644 (file)
@@ -412,8 +412,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl1) {
     "  A();"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    ""));
-    // WRONG; Should be: "A();"
+    "A()"));
 }
 
 TEST(DeclPrinter, TestCXXConstructorDecl2) {
@@ -422,8 +421,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl2) {
     "  A(int a);"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    ""));
-    // WRONG; Should be: "A(int a);"
+    "A(int a)"));
 }
 
 TEST(DeclPrinter, TestCXXConstructorDecl3) {
@@ -432,8 +430,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl3) {
     "  A(const A &a);"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    ""));
-    // WRONG; Should be: "A(const A &a);"
+    "A(const A &a)"));
 }
 
 TEST(DeclPrinter, TestCXXConstructorDecl4) {
@@ -442,8 +439,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl4) {
     "  A(const A &a, int = 0);"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    ""));
-    // WRONG; Should be: "A(const A &a, int = 0);"
+    "A(const A &a, int = 0)"));
 }
 
 TEST(DeclPrinter, TestCXXConstructorDecl5) {
@@ -452,8 +448,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl5) {
     "  A(const A &&a);"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    ""));
-    // WRONG; Should be: "A(const A &&a);"
+    "A(const A &&a)"));
 }
 
 TEST(DeclPrinter, TestCXXConstructorDecl6) {
@@ -462,7 +457,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl6) {
     "  explicit A(int a);"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    ""));
+    "A(int a)"));
     // WRONG; Should be: "explicit A(int a);"
 }
 
@@ -472,7 +467,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl7) {
     "  constexpr A();"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    ""));
+    "A()"));
     // WRONG; Should be: "constexpr A();"
 }
 
@@ -482,8 +477,8 @@ TEST(DeclPrinter, TestCXXConstructorDecl8) {
     "  A() = default;"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    ""));
-    // WRONG; Should be: "A() = default;"
+    "A() noexcept"));
+    // WRONG; Should be: "A() = delete;"
 }
 
 TEST(DeclPrinter, TestCXXConstructorDecl9) {
@@ -492,8 +487,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl9) {
     "  A() = delete;"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    " = delete"));
-    // WRONG; Should be: "A() = delete;"
+    "A() = delete"));
 }
 
 TEST(DeclPrinter, TestCXXConstructorDecl10) {
@@ -503,8 +497,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl10) {
     "  A(const A &a);"
     "};",
     constructorDecl(ofClass(hasName("A"))).bind("id"),
-    ""));
-    // WRONG; Should be: "A(const A &a);"
+    "A<T...>(const A<T...> &a)"));
 }
 
 #if !defined(_MSC_VER)