diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index 5ed970bf7b..ec90674e0c 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -1838,6 +1838,7 @@ void StmtPrinter::VisitBlockExpr(BlockExpr *Node) { } OS << ')'; } + OS << "{ }"; } void StmtPrinter::VisitOpaqueValueExpr(OpaqueValueExpr *Node) { diff --git a/test/Index/comment-c-decls.c b/test/Index/comment-c-decls.c new file mode 100644 index 0000000000..e91f9b93eb --- /dev/null +++ b/test/Index/comment-c-decls.c @@ -0,0 +1,104 @@ +// 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 %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. +*/ +int global_function(); +// CHECK: int global_function() + +/** + * \param x1 Aaa. +*/ +extern void external_function(int x1); +// CHECK: extern void external_function(int x1) + +/** + * \brief global variable; +*/ +int global_variable; +// CHECK: int global_variable + +/** + * \brief local variable; +*/ +static int static_variable; +// CHECK: static int static_variable + +/** + * \brief external variable +*/ +extern int external_variable; +// CHECK: extern int external_variable + +int global_function() { + /** + * \brief a local variable + */ + int local = 10; + return local; +} +// CHECK: int global_function() +// CHECK: int local = 10 + +/** + * \brief initialized decl. +*/ +int initialized_global = 100; +// CHECK: int initialized_global = 100 + +/** + * \brief typedef example +*/ +typedef int INT_T; +// CHECK: typedef int INT_T + +/** + * \brief aggregate type example +*/ +struct S { +/** + * \brief iS1; +*/ + int iS1; +/** + * \brief dS1; +*/ + double dS1; +}; +// CHECK: struct S {\n} +// CHECK: int iS1 +// CHECK: double dS1 + +/** + * \brief enum e; +*/ +enum e { + One, +/** + * \brief Two; +*/ + Two, + Three +}; +// CHECK: enum e {\n} +// CHECK: Two + +/** + *\brief block declaration +*/ +int (^Block) (int i, int j); +// CHECK: int (^Block)(int, int) + +/** + *\brief block declaration +*/ +int (^Block1) (int i, int j) = ^(int i, int j) { return i + j; }; +// CHECK: int (^Block1)(int, int) = ^(int i, int j){ }