rsmith added inline comments.

================
Comment at: lib/AST/DeclPrinter.cpp:393-397
       if (!BaseType.isNull() && isa<ElaboratedType>(BaseType))
         BaseType = cast<ElaboratedType>(BaseType)->getNamedType();
       if (!BaseType.isNull() && isa<TagType>(BaseType) &&
-          cast<TagType>(BaseType)->getDecl() == Decls[0]) {
+          cast<TagType>(BaseType) ==
+              cast<TagDecl>(Decls[0])->getTypeForDecl()) {
----------------
I would think the right thing to check here is that the `ElaboratedType`'s 
`OwnedTagDecl` is `Decls[0]`. Currently, you also allow cases where it's merely 
a redeclaration of that same `TagDecl`, which will combine together 
declarations too often...


================
Comment at: test/Misc/ast-print-record-decl.c:161-171
+  // PRINT-NEXT:    [[KW]] __attribute__((may_alias)) T *p3, *p4;
+  // PRINT-NEXT:  } *p1;
+  KW __attribute__((aligned(64))) T BASES { // expected-warning {{'T' is 
deprecated}}
     int i;
     KW T *p2;
+    // FIXME: For C++, T at p3 loses aligned and deprecated, perhaps because
+    // that RecordDecl isn't in the same redecl list.  Perhaps the redecl lists
----------------
... such as here, for example. Because the two `KW T` declarations redeclare 
the same `TagDecl`, they will get merged by `-ast-print`.


https://reviews.llvm.org/D45465



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to