[cfe-commits] r40653 - in /cfe/trunk/Sema: SemaDecl.cpp SemaType.cpp
Chris Lattner
sabre at nondot.org
Tue Jul 31 14:33:25 PDT 2007
Author: lattner
Date: Tue Jul 31 16:33:24 2007
New Revision: 40653
URL: http://llvm.org/viewvc/llvm-project?rev=40653&view=rev
Log:
remove more explicit accesses to the canonical type pointer.
Modified:
cfe/trunk/Sema/SemaDecl.cpp
cfe/trunk/Sema/SemaType.cpp
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=40653&r1=40652&r2=40653&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Tue Jul 31 16:33:24 2007
@@ -381,7 +381,7 @@
}
// C99 6.7.5.2p2: If an identifier is declared to be an object with
// static storage duration, it shall not have a variable length array.
- if (ArrayType *ary = dyn_cast<ArrayType>(R.getCanonicalType())) {
+ if (const ArrayType *ary = R->getAsArrayType()) {
if (VerifyConstantArrayType(ary, D.getIdentifierLoc()))
return 0;
}
@@ -399,7 +399,7 @@
if (SC == VarDecl::Static) {
// C99 6.7.5.2p2: If an identifier is declared to be an object with
// static storage duration, it shall not have a variable length array.
- if (ArrayType *ary = dyn_cast<ArrayType>(R.getCanonicalType())) {
+ if (const ArrayType *ary = R->getAsArrayType()) {
if (VerifyConstantArrayType(ary, D.getIdentifierLoc()))
return 0;
}
@@ -738,7 +738,7 @@
// C99 6.7.2.1p8: A member of a structure or union may have any type other
// than a variably modified type.
- if (ArrayType *ary = dyn_cast<ArrayType>(T.getCanonicalType())) {
+ if (const ArrayType *ary = T->getAsArrayType()) {
if (VerifyConstantArrayType(ary, Loc))
return 0;
}
@@ -771,10 +771,10 @@
if (!FD) continue; // Already issued a diagnostic.
// Get the type for the field.
- Type *FDTy = FD->getType().getCanonicalType().getTypePtr();
+ Type *FDTy = FD->getType().getTypePtr();
// C99 6.7.2.1p2 - A field may not be a function type.
- if (isa<FunctionType>(FDTy)) {
+ if (FDTy->isFunctionType()) {
Diag(FD->getLocation(), diag::err_field_declared_as_function,
FD->getName());
delete FD;
@@ -785,7 +785,7 @@
if (FDTy->isIncompleteType()) {
if (i != NumFields-1 || // ... that the last member ...
Record->getKind() != Decl::Struct || // ... of a structure ...
- !isa<ArrayType>(FDTy)) { //... may have incomplete array type.
+ !FDTy->isArrayType()) { //... may have incomplete array type.
Diag(FD->getLocation(), diag::err_field_incomplete, FD->getName());
delete FD;
continue;
@@ -804,7 +804,7 @@
/// C99 6.7.2.1p2 - a struct ending in a flexible array member cannot be the
/// field of another structure or the element of an array.
- if (RecordType *FDTTy = dyn_cast<RecordType>(FDTy)) {
+ if (const RecordType *FDTTy = FDTy->getAsRecordType()) {
if (FDTTy->getDecl()->hasFlexibleArrayMember()) {
// If this is a member of a union, then entire union becomes "flexible".
if (Record->getKind() == Decl::Union) {
Modified: cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaType.cpp?rev=40653&r1=40652&r2=40653&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/trunk/Sema/SemaType.cpp Tue Jul 31 16:33:24 2007
@@ -125,7 +125,7 @@
switch (DeclType.Kind) {
default: assert(0 && "Unknown decltype!");
case DeclaratorChunk::Pointer:
- if (isa<ReferenceType>(T.getCanonicalType().getTypePtr())) {
+ if (T->isReferenceType()) {
// C++ 8.3.2p4: There shall be no ... pointers to references ...
Diag(D.getIdentifierLoc(), diag::err_illegal_decl_pointer_to_reference,
D.getIdentifier()->getName());
@@ -171,7 +171,7 @@
Diag(D.getIdentifierLoc(), diag::err_illegal_decl_array_of_references,
D.getIdentifier()->getName());
T = RT->getReferenceeType();
- } else if (RecordType *EltTy =dyn_cast<RecordType>(T.getCanonicalType())){
+ } else if (const RecordType *EltTy = T->getAsRecordType()) {
// If the element type is a struct or union that contains a variadic
// array, reject it: C99 6.7.2.1p2.
if (EltTy->getDecl()->hasFlexibleArrayMember()) {
More information about the cfe-commits
mailing list