[cfe-commits] r95987 - /cfe/trunk/lib/AST/ASTImporter.cpp

Douglas Gregor dgregor at apple.com
Fri Feb 12 09:23:40 PST 2010


Author: dgregor
Date: Fri Feb 12 11:23:39 2010
New Revision: 95987

URL: http://llvm.org/viewvc/llvm-project?rev=95987&view=rev
Log:
Simplify incomplete-array merging code in the AST importer, thanks to
Daniel's suggestion.

Modified:
    cfe/trunk/lib/AST/ASTImporter.cpp

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=95987&r1=95986&r2=95987&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Fri Feb 12 11:23:39 2010
@@ -1038,30 +1038,20 @@
             break;
           }
 
-          if (const IncompleteArrayType *FoundArray
-                = Importer.getToContext().getAsIncompleteArrayType(
-                                                        FoundVar->getType())) {
-            if (const ConstantArrayType *TArray
-                  = Importer.getToContext().getAsConstantArrayType(T)) {
-              if (Importer.getToContext().typesAreCompatible(
-                                               TArray->getElementType(), 
-                                               FoundArray->getElementType())) {
-                FoundVar->setType(T);
-                MergeWithVar = FoundVar;
-                break;
-              }
-            }
-          } else if (const IncompleteArrayType *TArray
-                        = Importer.getToContext().getAsIncompleteArrayType(T)) {
-            if (const ConstantArrayType *FoundArray
-                   = Importer.getToContext().getAsConstantArrayType(
-                                                         FoundVar->getType())) {
-              if (Importer.getToContext().typesAreCompatible(
-                                               TArray->getElementType(), 
-                                               FoundArray->getElementType())) {
-                MergeWithVar = FoundVar;
-                break;
-              }
+          const ArrayType *FoundArray
+            = Importer.getToContext().getAsArrayType(FoundVar->getType());
+          const ArrayType *TArray
+            = Importer.getToContext().getAsArrayType(T);
+          if (FoundArray && TArray) {
+            if (isa<IncompleteArrayType>(FoundArray) &&
+                isa<ConstantArrayType>(TArray)) {
+              FoundVar->setType(T);
+              MergeWithVar = FoundVar;
+              break;
+            } else if (isa<IncompleteArrayType>(TArray) &&
+                       isa<ConstantArrayType>(FoundArray)) {
+              MergeWithVar = FoundVar;
+              break;
             }
           }
 





More information about the cfe-commits mailing list