[cfe-commits] r120736 - in /cfe/trunk: lib/AST/ASTContext.cpp test/Sema/transparent-union.c
Peter Collingbourne
peter at pcc.me.uk
Thu Dec 2 13:00:07 PST 2010
Author: pcc
Date: Thu Dec 2 15:00:06 2010
New Revision: 120736
URL: http://llvm.org/viewvc/llvm-project?rev=120736&view=rev
Log:
Merge transparent union types using member's unqualified 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=120736&r1=120735&r2=120736&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Dec 2 15:00:06 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 = getCanonicalParamType(it->getType());
+ QualType ET = it->getType().getUnqualifiedType();
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=120736&r1=120735&r2=120736&view=diff
==============================================================================
--- cfe/trunk/test/Sema/transparent-union.c (original)
+++ cfe/trunk/test/Sema/transparent-union.c Thu Dec 2 15:00:06 2010
@@ -3,6 +3,7 @@
int *ip;
float *fp;
long *__restrict rlp;
+ void *vpa[1];
} TU __attribute__((transparent_union));
void f(TU); // expected-note{{passing argument to parameter here}}
@@ -39,6 +40,9 @@
void fi(TU); // expected-note{{previous declaration is here}}
void fi(int i) {} // expected-error{{conflicting types}}
+void fvpp(TU); // expected-note{{previous declaration is here}}
+void fvpp(void **v) {} // expected-error{{conflicting types}}
+
/* FIXME: we'd like to just use an "int" here and align it differently
from the normal "int", but if we do so we lose the alignment
information from the typedef within the compiler. */
More information about the cfe-commits
mailing list