[cfe-commits] r169412 - in /cfe/trunk: lib/AST/DeclPrinter.cpp test/Index/comment-to-html-xml-conversion.cpp unittests/AST/DeclPrinterTest.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Dec 5 11:54:12 PST 2012
Author: fjahanian
Date: Wed Dec 5 13:54:11 2012
New Revision: 169412
URL: http://llvm.org/viewvc/llvm-project?rev=169412&view=rev
Log:
Testing C++ declarations embedded in
<declaration> tag of Comment XML.
Added DeclPrint support for constructors
and fix tests accordingly.
This is wip. // rdar://12378714
Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp
cfe/trunk/unittests/AST/DeclPrinterTest.cpp
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=169412&r1=169411&r2=169412&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Wed Dec 5 13:54:11 2012
@@ -547,6 +547,8 @@
}
Out << ")";
}
+ if (!Proto.empty())
+ Out << Proto;
}
else
AFT->getResultType().print(Out, Policy, Proto);
Modified: cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp?rev=169412&r1=169411&r2=169412&view=diff
==============================================================================
--- cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp (original)
+++ cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp Wed Dec 5 13:54:11 2012
@@ -593,7 +593,7 @@
/// \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 at comment_to_xml_conversion_01@F at 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 at comment_to_xml_conversion_01@F at 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();
Modified: cfe/trunk/unittests/AST/DeclPrinterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/DeclPrinterTest.cpp?rev=169412&r1=169411&r2=169412&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/DeclPrinterTest.cpp (original)
+++ cfe/trunk/unittests/AST/DeclPrinterTest.cpp Wed Dec 5 13:54:11 2012
@@ -412,8 +412,7 @@
" A();"
"};",
constructorDecl(ofClass(hasName("A"))).bind("id"),
- ""));
- // WRONG; Should be: "A();"
+ "A()"));
}
TEST(DeclPrinter, TestCXXConstructorDecl2) {
@@ -422,8 +421,7 @@
" 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 @@
" 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 @@
" 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 @@
" 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 @@
" explicit A(int a);"
"};",
constructorDecl(ofClass(hasName("A"))).bind("id"),
- ""));
+ "A(int a)"));
// WRONG; Should be: "explicit A(int a);"
}
@@ -472,7 +467,7 @@
" constexpr A();"
"};",
constructorDecl(ofClass(hasName("A"))).bind("id"),
- ""));
+ "A()"));
// WRONG; Should be: "constexpr A();"
}
@@ -482,8 +477,8 @@
" 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 @@
" A() = delete;"
"};",
constructorDecl(ofClass(hasName("A"))).bind("id"),
- " = delete"));
- // WRONG; Should be: "A() = delete;"
+ "A() = delete"));
}
TEST(DeclPrinter, TestCXXConstructorDecl10) {
@@ -503,8 +497,7 @@
" 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)
More information about the cfe-commits
mailing list