[cfe-commits] r65389 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Chris Lattner sabre at nondot.org
Tue Feb 24 13:54:34 PST 2009


Author: lattner
Date: Tue Feb 24 15:54:33 2009
New Revision: 65389

URL: http://llvm.org/viewvc/llvm-project?rev=65389&view=rev
Log:
some minor cleanups, handle ObjCEncodeExpr in a couple places.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=65389&r1=65388&r2=65389&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Feb 24 15:54:33 2009
@@ -1149,10 +1149,9 @@
 }
 
 StringLiteral *Sema::IsStringLiteralInit(Expr *Init, QualType DeclType) {
-  const ArrayType *AT = Context.getAsArrayType(DeclType);
-  if (AT && AT->getElementType()->isCharType()) {
-    return dyn_cast<StringLiteral>(Init->IgnoreParens());
-  }
+  if (const ArrayType *AT = Context.getAsArrayType(DeclType))
+    if (AT->getElementType()->isCharType())
+      return dyn_cast<StringLiteral>(Init->IgnoreParens());
   return 0;
 }
 
@@ -2194,6 +2193,7 @@
            CheckArithmeticConstantExpression(ASE->getIdx());
   }
   case Expr::StringLiteralClass:
+  case Expr::ObjCEncodeExprClass:
   case Expr::PredefinedExprClass:
     return false;
   case Expr::UnaryOperatorClass: {
@@ -2217,6 +2217,7 @@
   case Expr::ParenExprClass:
     return CheckAddressConstantExpression(cast<ParenExpr>(Init)->getSubExpr());
   case Expr::StringLiteralClass:
+  case Expr::ObjCEncodeExprClass:
   case Expr::ObjCStringLiteralClass:
     return false;
   case Expr::CallExprClass:
@@ -2576,9 +2577,8 @@
 }
 
 bool Sema::CheckForConstantInitializer(Expr *Init, QualType DclT) {
-  if (Init->isConstantInitializer(Context)) {
+  if (Init->isConstantInitializer(Context))
     return false;
-  }
   InitializerElementNotConstant(Init);
   return true;
 





More information about the cfe-commits mailing list