Fix a problem related to rewrite of anonymous unions.

(fixes radar 6948022)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93186 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2010-01-11 21:17:32 +00:00
Родитель c027e54d66
Коммит 97fd83a8d8
2 изменённых файлов: 33 добавлений и 2 удалений

Просмотреть файл

@ -739,9 +739,10 @@ void StmtPrinter::VisitCallExpr(CallExpr *Call) {
void StmtPrinter::VisitMemberExpr(MemberExpr *Node) { void StmtPrinter::VisitMemberExpr(MemberExpr *Node) {
// FIXME: Suppress printing implicit bases (like "this") // FIXME: Suppress printing implicit bases (like "this")
PrintExpr(Node->getBase()); PrintExpr(Node->getBase());
if (FieldDecl *FD = dyn_cast<FieldDecl>(Node->getMemberDecl()))
if (FD->isAnonymousStructOrUnion())
return;
OS << (Node->isArrow() ? "->" : "."); OS << (Node->isArrow() ? "->" : ".");
// FIXME: Suppress printing references to unnamed objects
// representing anonymous unions/structs
if (NestedNameSpecifier *Qualifier = Node->getQualifier()) if (NestedNameSpecifier *Qualifier = Node->getQualifier())
Qualifier->print(OS, Policy); Qualifier->print(OS, Policy);

Просмотреть файл

@ -0,0 +1,30 @@
// RUN: %clang_cc1 -rewrite-objc -o - %s
// rdar://6948022
typedef unsigned int uint32_t;
typedef struct {
union {
uint32_t daysOfWeek;
uint32_t dayOfMonth;
};
uint32_t nthOccurrence;
} OSPatternSpecificData;
@interface NSNumber
+ (NSNumber *)numberWithLong:(long)value;
@end
@interface OSRecurrence {
OSPatternSpecificData _pts;
}
- (void)_setTypeSpecificInfoOnRecord;
@end
@implementation OSRecurrence
- (void)_setTypeSpecificInfoOnRecord
{
[NSNumber numberWithLong:(_pts.dayOfMonth >= 31 ? -1 : _pts.dayOfMonth)];
}
@end