forked from OSchip/llvm-project
Fix pretty-printing for unnamed unions.
This is just a couple of minor fixes to account for the existence of ElaboratedType. llvm-svn: 188209
This commit is contained in:
parent
e2358c1deb
commit
24b3fed69f
|
@ -260,6 +260,8 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) {
|
|||
QualType CurDeclType = getDeclType(*D);
|
||||
if (!Decls.empty() && !CurDeclType.isNull()) {
|
||||
QualType BaseType = GetBaseType(CurDeclType);
|
||||
if (!BaseType.isNull() && isa<ElaboratedType>(BaseType))
|
||||
BaseType = cast<ElaboratedType>(BaseType)->getNamedType();
|
||||
if (!BaseType.isNull() && isa<TagType>(BaseType) &&
|
||||
cast<TagType>(BaseType)->getDecl() == Decls[0]) {
|
||||
Decls.push_back(*D);
|
||||
|
|
|
@ -1003,6 +1003,8 @@ void TypePrinter::printInjectedClassNameAfter(const InjectedClassNameType *T,
|
|||
|
||||
void TypePrinter::printElaboratedBefore(const ElaboratedType *T,
|
||||
raw_ostream &OS) {
|
||||
if (Policy.SuppressTag && isa<TagType>(T->getNamedType()))
|
||||
return;
|
||||
OS << TypeWithKeyword::getKeywordName(T->getKeyword());
|
||||
if (T->getKeyword() != ETK_None)
|
||||
OS << " ";
|
||||
|
|
|
@ -153,3 +153,14 @@ void test13() {
|
|||
__c11_atomic_load(&i, 0);
|
||||
}
|
||||
|
||||
|
||||
// CHECK: void test14() {
|
||||
// CHECK: struct X {
|
||||
// CHECK: union {
|
||||
// CHECK: int x;
|
||||
// CHECK: } x;
|
||||
// CHECK: };
|
||||
// CHECK: }
|
||||
void test14() {
|
||||
struct X { union { int x; } x; };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue