]> granicus.if.org Git - clang/commitdiff
SemaInit.cpp: give both IsStringInit() functions the same return type.
authorHans Wennborg <hans@hanshq.net>
Thu, 16 May 2013 09:22:40 +0000 (09:22 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 16 May 2013 09:22:40 +0000 (09:22 +0000)
This addresses Richard's comment on r181880.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181995 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaInit.cpp

index a3b78787e43ed1f543eb0fbb2de819339e1ae069..f7b53b2be21092a5d31066793f6805d50c2b3dc7 100644 (file)
@@ -120,11 +120,12 @@ static StringInitFailureKind IsStringInit(Expr *Init, const ArrayType *AT,
   llvm_unreachable("missed a StringLiteral kind?");
 }
 
-static bool IsStringInit(Expr* init, QualType declType, ASTContext& Context) {
+static StringInitFailureKind IsStringInit(Expr *init, QualType declType,
+                                          ASTContext &Context) {
   const ArrayType *arrayType = Context.getAsArrayType(declType);
   if (!arrayType)
-    return false;
-  return IsStringInit(init, arrayType, Context) == SIF_None;
+    return SIF_Other;
+  return IsStringInit(init, arrayType, Context);
 }
 
 /// Update the type of a string literal, including any surrounding parentheses,
@@ -712,7 +713,8 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity,
     }
 
     if (StructuredIndex == 1 &&
-        IsStringInit(StructuredList->getInit(0), T, SemaRef.Context)) {
+        IsStringInit(StructuredList->getInit(0), T, SemaRef.Context) ==
+            SIF_None) {
       unsigned DK = diag::warn_excess_initializers_in_char_array_initializer;
       if (SemaRef.getLangOpts().CPlusPlus) {
         DK = diag::err_excess_initializers_in_char_array_initializer;