]> granicus.if.org Git - clang/commitdiff
remove more explicit accesses to the canonical type pointer.
authorChris Lattner <sabre@nondot.org>
Tue, 31 Jul 2007 21:33:24 +0000 (21:33 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 31 Jul 2007 21:33:24 +0000 (21:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40653 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaDecl.cpp
Sema/SemaType.cpp

index 722452b51a4d886c4c876f9ec9e761e4f1d09d9c..e052af82548214cac1000e12550c7c0e1821a5d1 100644 (file)
@@ -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<ArrayType>(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<ArrayType>(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<ArrayType>(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<FunctionType>(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<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 @@ 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<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) {
index 7085d833fd3aac7dcc2739e8a484623b685354e4..a1dd1f7cda5018b2305cde820ce0b07d3ee0ae22 100644 (file)
@@ -125,7 +125,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
     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 @@ 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<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()) {