From 02c642e8f40562fcc9d440977f232c021b9d4353 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 31 Jul 2007 21:33:24 +0000 Subject: [PATCH] remove more explicit accesses to the canonical type pointer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40653 91177308-0d34-0410-b5e6-96231b3b80d8 --- Sema/SemaDecl.cpp | 14 +++++++------- Sema/SemaType.cpp | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 722452b51a..e052af8254 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -381,7 +381,7 @@ Sema::ParseDeclarator(Scope *S, Declarator &D, ExprTy *init, } // 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(R.getCanonicalType())) { + if (const ArrayType *ary = R->getAsArrayType()) { if (VerifyConstantArrayType(ary, D.getIdentifierLoc())) return 0; } @@ -399,7 +399,7 @@ Sema::ParseDeclarator(Scope *S, Declarator &D, ExprTy *init, 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(R.getCanonicalType())) { + if (const ArrayType *ary = R->getAsArrayType()) { if (VerifyConstantArrayType(ary, D.getIdentifierLoc())) return 0; } @@ -738,7 +738,7 @@ Sema::DeclTy *Sema::ParseField(Scope *S, DeclTy *TagDecl, // 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(T.getCanonicalType())) { + if (const ArrayType *ary = T->getAsArrayType()) { if (VerifyConstantArrayType(ary, Loc)) return 0; } @@ -771,10 +771,10 @@ void Sema::ParseRecordBody(SourceLocation RecLoc, DeclTy *RecDecl, 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(FDTy)) { + if (FDTy->isFunctionType()) { Diag(FD->getLocation(), diag::err_field_declared_as_function, FD->getName()); delete FD; @@ -785,7 +785,7 @@ void Sema::ParseRecordBody(SourceLocation RecLoc, DeclTy *RecDecl, if (FDTy->isIncompleteType()) { if (i != NumFields-1 || // ... that the last member ... Record->getKind() != Decl::Struct || // ... of a structure ... - !isa(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 @@ void Sema::ParseRecordBody(SourceLocation RecLoc, DeclTy *RecDecl, /// 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(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) { diff --git a/Sema/SemaType.cpp b/Sema/SemaType.cpp index 7085d833fd..a1dd1f7cda 100644 --- a/Sema/SemaType.cpp +++ b/Sema/SemaType.cpp @@ -125,7 +125,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { switch (DeclType.Kind) { default: assert(0 && "Unknown decltype!"); case DeclaratorChunk::Pointer: - if (isa(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 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { Diag(D.getIdentifierLoc(), diag::err_illegal_decl_array_of_references, D.getIdentifier()->getName()); T = RT->getReferenceeType(); - } else if (RecordType *EltTy =dyn_cast(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()) { -- 2.40.0