<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi Hans,<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Tue, May 15, 2018 at 6:23 AM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This broke the ast-print-record-decl.c test on Windows, see for<br>
example <a href="http://lab.llvm.org:8011/builders/clang-with-thin-lto-windows/builds/9066" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/<wbr>builders/clang-with-thin-lto-<wbr>windows/builds/9066</a><br>
<br>
One way to reproduce the failure on Linux is to pass a Windows triple<br>
to this ast-print command:<br>
<br>
--- a/test/Misc/ast-print-record-<wbr>decl.c<br>
+++ b/test/Misc/ast-print-record-<wbr>decl.c<br>
@@ -54,7 +54,7 @@<br>
 //   RUN:        -DKW=struct -DBASES=' : B' -o - -xc++ %s \<br>
<span class="gmail-"> //   RUN: | FileCheck --check-prefixes=CHECK,LLVM %s<br>
 //<br>
</span>-//   RUN: %clang_cc1 -verify -ast-print -DKW=struct -DBASES=' : B' -xc++ %s \<br>
+//   RUN: %clang_cc1 -verify -triple i686-pc-win32 -ast-print<br>
<span class="gmail-">-DKW=struct -DBASES=' : B' -xc++ %s \<br>
 //   RUN: > %t.cpp<br>
</span><span class="gmail-"> //   RUN: FileCheck --check-prefixes=CHECK,PRINT,<wbr>PRINT-CXX -DKW=struct \<br>
 //   RUN:           -DBASES=' : B' %s --input-file %t.cpp<br>
<br>
</span>What's happening is that on Windows, "__single_inheritance(1)" is<br>
printed before T1. But if I change the test to allow that in the<br>
output, it still doesn't pass as Clang doesn't seem able to parse it.<br></blockquote><div><br></div><div>The underlying bug is present at least as far back as 
4.0.1.  The bug is revealed by an earlier patch, r332281, simply because
 it introduces this test.<div><br></div><div>There are two parts to this bug.  First, implicit attributes shouldn't print as that's not faithful to the original source.  I'm addressing that at</div><div><br></div><div><a href="https://reviews.llvm.org/D46894">https://reviews.llvm.org/D46894</a><br></div><div><br></div><div>Second, when this attribute is explicit, the "(1)" shouldn't print as it's not part of the accepted syntax.  I'll address that in another patch.<br></div><div></div><div><br></div><div>Thanks.<br></div><div><br></div><div>Joel<br></div><div class="gmail_extra"></div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I've worked around the problem by adding a Linux triple here in<br>
r332335, but someone should probably look into it properly.<br>
<br>
Thanks,<br>
Hans<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
On Tue, May 15, 2018 at 2:44 AM, Joel E. Denny via cfe-commits<br>
<<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
> Author: jdenny<br>
> Date: Mon May 14 17:44:14 2018<br>
> New Revision: 332314<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=332314&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=332314&view=rev</a><br>
> Log:<br>
> [AST] Fix printing tag decl groups in decl contexts<br>
><br>
> For example, given:<br>
><br>
>   struct T1 {<br>
>     struct T2 *p0;<br>
>   };<br>
><br>
> -ast-print produced:<br>
><br>
>   struct T1 {<br>
>     struct T2;<br>
>     struct T2 *p0;<br>
>   };<br>
><br>
> Compiling that produces a warning that the first struct T2 declaration<br>
> does not declare anything.<br>
><br>
> Details:<br>
><br>
> A tag decl group is one or more decls that share a type specifier that<br>
> is a tag decl (that is, a struct/union/class/enum decl).  Within<br>
> functions, the parser builds such a tag decl group as part of a<br>
> DeclStmt.  However, in decl contexts, such as file scope or a member<br>
> list, the parser does not group together the members of a tag decl<br>
> group.  Previously, detection of tag decl groups during printing was<br>
> implemented but only if the tag decl was unnamed.  Otherwise, as in<br>
> the above example, the members of the group did not print together and<br>
> so sometimes introduced warnings.<br>
><br>
> This patch extends detection of tag decl groups in decl contexts to<br>
> any tag decl that is recorded in the AST as not free-standing.<br>
><br>
> Reviewed by: rsmith<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D45465" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D45465</a><br>
><br>
> Modified:<br>
>     cfe/trunk/lib/AST/DeclPrinter.<wbr>cpp<br>
>     cfe/trunk/test/Misc/ast-print-<wbr>enum-decl.c<br>
>     cfe/trunk/test/Misc/ast-print-<wbr>record-decl.c<br>
>     cfe/trunk/test/Sema/ast-print.<wbr>c<br>
>     cfe/trunk/test/SemaCXX/ast-<wbr>print.cpp<br>
</div></div></blockquote></div><br></div></div>