From: Chandler Carruth Date: Sun, 1 May 2011 07:49:26 +0000 (+0000) Subject: Simplify the flow of some of the array type trait code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06207f6f5f248f678498d61d6dbb36774b7fe5ae;p=clang Simplify the flow of some of the array type trait code. Completely remove a switch which selected between the same two types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130649 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index acbe4154ca..7a7aabeafe 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -2996,22 +2996,13 @@ ExprResult Sema::BuildArrayTypeTrait(ArrayTypeTrait ATT, Expr* DimExpr, SourceLocation RParen) { QualType T = TSInfo->getType(); - - uint64_t Value; - if (!T->isDependentType()) - Value = EvaluateArrayTypeTrait(*this, ATT, T, DimExpr, KWLoc); - else + if (T->isDependentType()) return ExprError(); - // Select trait result type. - QualType ResultType; - switch (ATT) { - case ATT_ArrayRank: ResultType = Context.IntTy; break; - case ATT_ArrayExtent: ResultType = Context.IntTy; break; - } - + uint64_t Value = EvaluateArrayTypeTrait(*this, ATT, T, DimExpr, KWLoc); return Owned(new (Context) ArrayTypeTraitExpr(KWLoc, ATT, TSInfo, Value, - DimExpr, RParen, ResultType)); + DimExpr, RParen, + Context.IntTy)); } ExprResult Sema::ActOnExpressionTrait(ExpressionTrait ET,