Hi Peter and Gabor, This change is causing a failure of the test "Clang :: ASTMerge/struct/test.c" on the PS4 Windows bot:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7609 FAIL: Clang :: ASTMerge/struct/test.c (18568 of 32374) ******************** TEST 'Clang :: ASTMerge/struct/test.c' FAILED ******************** Script: -- C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin/clang.EXE -cc1 -internal-isystem C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\lib\clang\5.0.0\include -nostdsysteminc -emit-pch -o C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\tools\clang\test\ASTMerge\struct\Output\test.c.tmp.1.ast C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\ASTMerge\struct/Inputs/struct1.c C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin/clang.EXE -cc1 -internal-isystem C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\lib\clang\5.0.0\include -nostdsysteminc -emit-pch -o C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\tools\clang\test\ASTMerge\struct\Output\test.c.tmp.2.ast C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\ASTMerge\struct/Inputs/struct2.c not C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin/clang.EXE -cc1 -internal-isystem C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\lib\clang\5.0.0\include -nostdsysteminc -ast-merge C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\tools\clang\test\ASTMerge\struct\Output\test.c.tmp.1.ast -ast-merge C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\tools\clang\test\ASTMerge\struct\Output\test.c.tmp.2.ast -fsyntax-only C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\ASTMerge\struct\test.c 2>&1 | C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\FileCheck.EXE C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\ASTMerge\struct\test.c -- Exit Code: 1 Command Output (stdout): -- $ "C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin/clang.EXE" "-cc1" "-internal-isystem" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\lib\clang\5.0.0\include" "-nostdsysteminc" "-emit-pch" "-o" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\tools\clang\test\ASTMerge\struct\Output\test.c.tmp.1.ast" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\ASTMerge\struct/Inputs/struct1.c" $ "C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin/clang.EXE" "-cc1" "-internal-isystem" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\lib\clang\5.0.0\include" "-nostdsysteminc" "-emit-pch" "-o" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\tools\clang\test\ASTMerge\struct\Output\test.c.tmp.2.ast" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\ASTMerge\struct/Inputs/struct2.c" $ "not" "C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin/clang.EXE" "-cc1" "-internal-isystem" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\lib\clang\5.0.0\include" "-nostdsysteminc" "-ast-merge" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\tools\clang\test\ASTMerge\struct\Output\test.c.tmp.1.ast" "-ast-merge" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\tools\clang\test\ASTMerge\struct\Output\test.c.tmp.2.ast" "-fsyntax-only" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\ASTMerge\struct\test.c" $ "C:/Buildbot/Slave/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/llvm.obj/./bin\FileCheck.EXE" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\ASTMerge\struct\test.c" # command stderr: C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\test\ASTMerge\struct\test.c:47:11: error: expected string not found in input // CHECK: struct1.c:130:7: warning: type 'struct DeepUnnamedError::(anonymous at [[PATH_TO_INPUTS:.+]]/struct1.c:130:7)' has incompatible definitions in different translation units ^ <stdin>:125:1: note: scanning from here S13 x13; ^ error: command failed with exit status: 1 -- ******************** Can you investigate? Douglas Yung > -----Original Message----- > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of > Gabor Horvath via cfe-commits > Sent: Monday, April 03, 2017 4:57 > To: cfe-commits@lists.llvm.org > Subject: r299355 - [ASTImporter] Fix for importing unnamed structs > > Author: xazax > Date: Mon Apr 3 06:57:11 2017 > New Revision: 299355 > > URL: http://llvm.org/viewvc/llvm-project?rev=299355&view=rev > Log: > [ASTImporter] Fix for importing unnamed structs > > Patch by Peter Szecsi! > > Differential Revision: https://reviews.llvm.org/D30876 > > Modified: > cfe/trunk/lib/AST/ASTImporter.cpp > cfe/trunk/test/ASTMerge/struct/Inputs/struct1.c > cfe/trunk/test/ASTMerge/struct/Inputs/struct2.c > cfe/trunk/test/ASTMerge/struct/test.c > > Modified: cfe/trunk/lib/AST/ASTImporter.cpp > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=299355&r1=299354&r2=299355&view= > diff > ============================================================================== > --- cfe/trunk/lib/AST/ASTImporter.cpp (original) > +++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Apr 3 06:57:11 2017 > @@ -1221,6 +1221,10 @@ static Optional<unsigned> findUntaggedSt > // If the field looks like this: > // struct { ... } A; > QualType FieldType = F->getType(); > + // In case of nested structs. > + while (const auto *ElabType = dyn_cast<ElaboratedType>(FieldType)) { > + FieldType = ElabType->getNamedType(); > + } > if (const auto *RecType = dyn_cast<RecordType>(FieldType)) { > const RecordDecl *RecDecl = RecType->getDecl(); > if (RecDecl->getDeclContext() == Owner && @@ -3020,9 +3024,8 @@ Decl > *ASTNodeImporter::VisitRecordDecl(R > } > > if (RecordDecl *FoundRecord = dyn_cast<RecordDecl>(Found)) { > - if (D->isAnonymousStructOrUnion() && > - FoundRecord->isAnonymousStructOrUnion()) { > - // If both anonymous structs/unions are in a record context, make > sure > + if (!SearchName) { > + // If both unnamed structs/unions are in a record context, > + make sure > // they occur in the same location in the context records. > if (Optional<unsigned> Index1 > = findUntaggedStructOrUnionIndex(D)) { > > Modified: cfe/trunk/test/ASTMerge/struct/Inputs/struct1.c > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/test/ASTMerge/struct/Inputs/struct1.c?rev=299355&r1=299354&r > 2=299355&view=diff > ============================================================================== > --- cfe/trunk/test/ASTMerge/struct/Inputs/struct1.c (original) > +++ cfe/trunk/test/ASTMerge/struct/Inputs/struct1.c Mon Apr 3 06:57:11 > +++ 2017 > @@ -77,3 +77,65 @@ typedef struct { > } S13; > > S13 x13; > + > +// Matches > +struct Unnamed { > + union { > + struct { > + int i; > + } S; > + struct { > + float i; > + } R; > + } U; > +} x14; > + > +// Matches > +struct DeepUnnamed { > + union { > + union { > + struct { > + long i; > + } S; > + struct { > + int i; > + } R; > + } U1; > + union { > + struct { > + long i; > + } S; > + struct { > + float i; > + } T; > + } U2; > + } U; > + struct { > + long i; > + } V; > +} x15; > + > +// Mismatch due to unnamed struct used internally struct > +DeepUnnamedError { > + union { > + union { > + struct { > + long i; > + } S; > + struct { > + int i; > + } R; > + } U1; > + union { > + struct { > + long i; // Mismatch here. > + } S; > + struct { > + float i; > + } T; > + } U2; > + } U; > + struct { > + long i; > + } V; > +} x16; > > Modified: cfe/trunk/test/ASTMerge/struct/Inputs/struct2.c > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/test/ASTMerge/struct/Inputs/struct2.c?rev=299355&r1=299354&r > 2=299355&view=diff > ============================================================================== > --- cfe/trunk/test/ASTMerge/struct/Inputs/struct2.c (original) > +++ cfe/trunk/test/ASTMerge/struct/Inputs/struct2.c Mon Apr 3 06:57:11 > +++ 2017 > @@ -74,3 +74,65 @@ typedef struct { > } S13; > > S13 x13; > + > +// Matches > +struct Unnamed { > + union { > + struct { > + int i; > + } S; > + struct { > + float i; > + } R; > + } U; > +} x14; > + > +// Matches > +struct DeepUnnamed { > + union { > + union { > + struct { > + long i; > + } S; > + struct { > + int i; > + } R; > + } U1; > + union { > + struct { > + long i; > + } S; > + struct { > + float i; > + } T; > + } U2; > + } U; > + struct { > + long i; > + } V; > +} x15; > + > +// Mismatch due to unnamed struct used internally struct > +DeepUnnamedError { > + union { > + union { > + struct { > + long i; > + } S; > + struct { > + int i; > + } R; > + } U1; > + union { > + struct { > + float i; // Mismatch here. > + } S; > + struct { > + float i; > + } T; > + } U2; > + } U; > + struct { > + long i; > + } V; > +} x16; > > Modified: cfe/trunk/test/ASTMerge/struct/test.c > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/test/ASTMerge/struct/test.c?rev=299355&r1=299354&r2=299355&v > iew=diff > ============================================================================== > --- cfe/trunk/test/ASTMerge/struct/test.c (original) > +++ cfe/trunk/test/ASTMerge/struct/test.c Mon Apr 3 06:57:11 2017 > @@ -44,4 +44,12 @@ > // CHECK: struct2.c:72:7: note: field 'i' has type 'int' here // CHECK: > struct2.c:76:5: error: external variable 'x13' declared with incompatible > types in different translation units ('S13' vs. 'S13') // CHECK: > struct1.c:79:5: note: declared here with type 'S13' > -// CHECK: 9 warnings and 8 errors generated > +// CHECK: struct1.c:130:7: warning: type 'struct > +DeepUnnamedError::(anonymous at [[PATH_TO_INPUTS:.+]]/struct1.c:130:7)' > +has incompatible definitions in different translation units // CHECK: > +struct1.c:131:14: note: field 'i' has type 'long' here // CHECK: > +struct2.c:128:15: note: field 'i' has type 'float' here // CHECK: > +struct1.c:129:5: warning: type 'union DeepUnnamedError::(anonymous at > +[[PATH_TO_INPUTS]]/struct1.c:129:5)' has incompatible definitions in > +different translation units // CHECK: struct1.c:132:9: note: field 'S' has > type 'struct (anonymous struct at [[PATH_TO_INPUTS]]/struct1.c:130:7)' here // > CHECK: struct2.c:129:9: note: field 'S' has type 'struct (anonymous struct at > [[PATH_TO_INPUTS]]/struct2.c:127:7)' here // CHECK: struct2.c:138:3: error: > external variable 'x16' declared with incompatible types in different > translation units ('struct DeepUnnamedError' vs. 'struct DeepUnnamedError') // > CHECK: struct1.c:141:3: note: declared here with type 'struct > DeepUnnamedError' > +// CHECK: 11 warnings and 9 errors generated > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits