[PATCH] D45463: [AST] Print correct tag decl for tag specifier
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 10 19:39:30 PDT 2018
rsmith added inline comments.
================
Comment at: include/clang/AST/Type.h:4852-4855
+/// \brief Represents a type occurrence that either (1) refers to the type
+/// using an elaborated type keyword, e.g., struct S, (2) refers to the type
+/// via a qualified name, e.g., N::M::type, (3) owns a (re)declaration of that
+/// type, or (4) some combination of those.
----------------
I think it's better to keep this as-is: the "owns a (re)declaration" case is a special case of using an elaborated type keyword.
================
Comment at: include/clang/AST/Type.h:4905
+ ///
+ /// FIXME: This is set for tag types but not necessarily other types.
+ /// FIXME: The TypeDecl returned is not always exactly faithful to the
----------------
Are there other types for which it would be meaningful? (If not, we could store and expose this as a `TagDecl` instead.)
================
Comment at: include/clang/AST/Type.h:4906-4916
+ /// FIXME: The TypeDecl returned is not always exactly faithful to the
+ /// original source because, when building the AST, the parser (1) adds
+ /// all attributes declared on a tag to all later redeclarations of that
+ /// tag (that is, tag occurrences declaring an attribute or member list),
+ /// and (2) drops attributes declared on a tag after an occurrence of that
+ /// tag declaring a member list. When printing the AST, the first change
+ /// should not affect semantics or diagnostics because it merely reveals
----------------
You can use `isInherited()` on the attribute to find out whether it was written on that declaration or inherited.
https://reviews.llvm.org/D45463
More information about the cfe-commits
mailing list