[PATCH] D45465: [AST] Fix printing tag decl groups in decl contexts
Joel E. Denny via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 9 15:38:25 PDT 2018
jdenny created this revision.
jdenny added reviewers: rsmith, hfinkel.
jdenny added a dependency: D45463: [AST] Print correct tag decl for tag specifier.
For example, given:
struct T1 {
struct T2 *p0;
};
-ast-print produced:
struct T1 {
struct T2;
struct T2 *p0;
};
Compiling that produces a warning that the first struct T2 declaration
does not declare anything.
Details:
A tag decl group is one or more decls that share a type specifier that
is a tag decl (that is, a struct/union/class/enum decl). Within
functions, the parser builds such a tag decl group as part of a
DeclStmt. However, in decl contexts, such as file scope or a member
list, the parser does not group together the members of a tag decl
group. Previously, detection of tag decl groups during printing was
implemented but only if the tag decl was unnamed. Otherwise, as in
the above example, the members of the group did not print together and
so sometimes introduced warnings.
This patch extends detection of tag decl groups in decl contexts to
any tag decl that is recorded in the AST as not free-standing.
https://reviews.llvm.org/D45465
Files:
lib/AST/DeclPrinter.cpp
test/Misc/ast-print-enum-decl.c
test/Misc/ast-print-record-decl.c
test/Sema/ast-print.c
test/SemaCXX/ast-print.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45465.141756.patch
Type: text/x-patch
Size: 10457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180409/8f19c2ee/attachment-0001.bin>
More information about the cfe-commits
mailing list