forked from OSchip/llvm-project
Fix crash caused by unnamed union or struct when doing ast-print
llvm-svn: 211380
This commit is contained in:
parent
5ec80c2a85
commit
eb57aa65dc
|
@ -1274,10 +1274,12 @@ void StmtPrinter::VisitDesignatedInitExpr(DesignatedInitExpr *Node) {
|
|||
DEnd = Node->designators_end();
|
||||
D != DEnd; ++D) {
|
||||
if (D->isFieldDesignator()) {
|
||||
if (D->getDotLoc().isInvalid())
|
||||
OS << D->getFieldName()->getName() << ":";
|
||||
else
|
||||
if (D->getDotLoc().isInvalid()) {
|
||||
if (IdentifierInfo *II = D->getFieldName())
|
||||
OS << II->getName() << ":";
|
||||
} else {
|
||||
OS << "." << D->getFieldName()->getName();
|
||||
}
|
||||
} else {
|
||||
OS << "[";
|
||||
if (D->isArrayDesignator()) {
|
||||
|
|
|
@ -196,3 +196,15 @@ struct s11 {
|
|||
} f0;
|
||||
int f1;
|
||||
};
|
||||
|
||||
// Unnamed structures.
|
||||
struct s12 {
|
||||
struct {
|
||||
unsigned char aa;
|
||||
unsigned char bb;
|
||||
};
|
||||
};
|
||||
|
||||
void f11() {
|
||||
struct s12 var = { .aa = 33 };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue