[cfe-commits] r120729 - in /cfe/trunk: lib/AST/ASTContext.cpp test/Sema/transparent-union.c
Peter Collingbourne
peter at pcc.me.uk
Thu Dec 2 12:02:29 PST 2010
Author: pcc
Date: Thu Dec 2 14:02:29 2010
New Revision: 120729
URL: http://llvm.org/viewvc/llvm-project?rev=120729&view=rev
Log:
Merge transparent union types using member's canonical param type
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/Sema/transparent-union.c
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=120729&r1=120728&r2=120729&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Dec 2 14:02:29 2010
@@ -4736,7 +4736,7 @@
if (UD->hasAttr<TransparentUnionAttr>()) {
for (RecordDecl::field_iterator it = UD->field_begin(),
itend = UD->field_end(); it != itend; ++it) {
- QualType ET = it->getType();
+ QualType ET = getCanonicalParamType(it->getType());
QualType MT = mergeTypes(ET, SubType, OfBlockPointer, Unqualified);
if (!MT.isNull())
return MT;
Modified: cfe/trunk/test/Sema/transparent-union.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/transparent-union.c?rev=120729&r1=120728&r2=120729&view=diff
==============================================================================
--- cfe/trunk/test/Sema/transparent-union.c (original)
+++ cfe/trunk/test/Sema/transparent-union.c Thu Dec 2 14:02:29 2010
@@ -2,6 +2,7 @@
typedef union {
int *ip;
float *fp;
+ long *__restrict rlp;
} TU __attribute__((transparent_union));
void f(TU); // expected-note{{passing argument to parameter here}}
@@ -26,6 +27,9 @@
void ffp(TU);
void ffp(float *f) {}
+void flp(TU);
+void flp(long *l) {}
+
void fvp(TU); // expected-note{{previous declaration is here}}
void fvp(void *p) {} // expected-error{{conflicting types}}
More information about the cfe-commits
mailing list