From d014542e1c6710d2c230b65b0cfcb8302a596b21 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 12 Feb 2010 17:23:39 +0000 Subject: [PATCH] Simplify incomplete-array merging code in the AST importer, thanks to Daniel's suggestion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95987 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTImporter.cpp | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index 5993e9ac34..ea5b68f162 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -1038,30 +1038,20 @@ Decl *ASTNodeImporter::VisitVarDecl(VarDecl *D) { 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(FoundArray) && + isa(TArray)) { + FoundVar->setType(T); + MergeWithVar = FoundVar; + break; + } else if (isa(TArray) && + isa(FoundArray)) { + MergeWithVar = FoundVar; + break; } } -- 2.40.0