[cfe-commits] r169453 - in /cfe/trunk: lib/AST/DeclPrinter.cpp test/Index/comment-cplus-template-decls.cpp

Fariborz Jahanian fjahanian at apple.com
Wed Dec 5 16:09:40 PST 2012


Author: fjahanian
Date: Wed Dec  5 18:09:40 2012
New Revision: 169453

URL: http://llvm.org/viewvc/llvm-project?rev=169453&view=rev
Log:
More C++ testing of declarations embedded in
<declaration> tag of Comment XML  and fixing 
DeclPrint of templates along the way - wip. 
//rdar://12378714

Added:
    cfe/trunk/test/Index/comment-cplus-template-decls.cpp
Modified:
    cfe/trunk/lib/AST/DeclPrinter.cpp

Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=169453&r1=169452&r2=169453&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Wed Dec  5 18:09:40 2012
@@ -1122,7 +1122,7 @@
 void DeclPrinter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
   Out << "using ";
   D->getQualifier()->print(Out, Policy);
-  Out << D->getDeclName();
+  Out << D->getName();
 }
 
 void DeclPrinter::VisitUsingShadowDecl(UsingShadowDecl *D) {

Added: cfe/trunk/test/Index/comment-cplus-template-decls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/comment-cplus-template-decls.cpp?rev=169453&view=auto
==============================================================================
--- cfe/trunk/test/Index/comment-cplus-template-decls.cpp (added)
+++ cfe/trunk/test/Index/comment-cplus-template-decls.cpp Wed Dec  5 18:09:40 2012
@@ -0,0 +1,44 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 std=c++11 %s > %t/out
+// RUN: FileCheck %s < %t/out
+
+// Ensure that XML we generate is not invalid.
+// RUN: FileCheck %s -check-prefix=WRONG < %t/out
+// WRONG-NOT: CommentXMLInvalid
+// rdar://12378714
+
+/**
+ * \brief Aaa
+*/
+template<typename T> struct A {
+/**
+ * \brief Bbb
+*/
+  A();
+/**
+ * \brief Ccc
+*/
+  ~A();
+/**
+ * \brief Ddd
+*/
+  void f() { }
+};
+// CHECK: <Declaration>template <typename T> struct A {\n}</Declaration>
+// CHECL: <Declaration>A<T>()</Declaration>
+// CHECK: <Declaration>void ~A<T>()</Declaration>
+
+/**
+ * \Brief Eee
+*/
+template <typename T> struct D : A<T> {
+/**
+ * \brief
+*/
+  using A<T>::f;
+  
+  void f();
+};
+// CHECK: <Declaration>template <typename T> struct D :  A<T> {\n}</Declaration>
+// CHECK: <Declaration>using A<T>::f</Declaration>





More information about the cfe-commits mailing list