llvm.org GIT mirror llvm / 29e13e0
Print empty structs as {} rather than { }. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100787 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
4 changed file(s) with 15 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
226226 const StructType *STy = cast(Ty);
227227 if (STy->isPacked())
228228 OS << '<';
229 OS << "{ ";
229 OS << '{';
230230 for (StructType::element_iterator I = STy->element_begin(),
231231 E = STy->element_end(); I != E; ++I) {
232 OS << ' ';
232233 CalcTypeName(*I, TypeStack, OS);
233 if (next(I) != STy->element_end())
234 if (next(I) == STy->element_end())
235 OS << ' ';
236 else
234237 OS << ',';
235 OS << ' ';
236238 }
237239 OS << '}';
238240 if (STy->isPacked())
241243 }
242244 case Type::UnionTyID: {
243245 const UnionType *UTy = cast(Ty);
244 OS << "union { ";
246 OS << "union {";
245247 for (StructType::element_iterator I = UTy->element_begin(),
246248 E = UTy->element_end(); I != E; ++I) {
249 OS << ' ';
247250 CalcTypeName(*I, TypeStack, OS);
248 if (next(I) != UTy->element_end())
251 if (next(I) == UTy->element_end())
252 OS << ' ';
253 else
249254 OS << ',';
250 OS << ' ';
251255 }
252256 OS << '}';
253257 break;
0 // PR 1417
11
2 // RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep "struct.anon = type \{ \}"
2 // RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep "struct.anon = type \{\}"
33
44 struct { } *X;
22
33 declare void @g(i8*)
44
5 declare { }* @llvm.invariant.start(i64, i8* nocapture) nounwind readonly
5 declare {}* @llvm.invariant.start(i64, i8* nocapture) nounwind readonly
66
77 define i8 @f() {
88 %a = alloca i8 ; [#uses=4]
99 store i8 0, i8* %a
10 %i = call { }* @llvm.invariant.start(i64 1, i8* %a) ; <{ }*> [#uses=0]
11 ; CHECK: call { }* @llvm.invariant.start
10 %i = call {}* @llvm.invariant.start(i64 1, i8* %a) ; <{}*> [#uses=0]
11 ; CHECK: call {}* @llvm.invariant.start
1212 call void @g(i8* %a)
1313 %r = load i8* %a ; [#uses=1]
1414 ret i8 %r
187187 %X = call {} @test8a(i32 5, i32* %P)
188188 ret void
189189 ; CHECK: define void @test8b
190 ; CHECK-NEXT: call { } @test8a
190 ; CHECK-NEXT: call {} @test8a
191191 ; CHECK-NEXT: ret void
192192 }
193193