r181995 - SemaInit.cpp: give both IsStringInit() functions the same return type.

Hans Wennborg hans at hanshq.net
Thu May 16 02:22:40 PDT 2013


Author: hans
Date: Thu May 16 04:22:40 2013
New Revision: 181995

URL: http://llvm.org/viewvc/llvm-project?rev=181995&view=rev
Log:
SemaInit.cpp: give both IsStringInit() functions the same return type.

This addresses Richard's comment on r181880.

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

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=181995&r1=181994&r2=181995&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu May 16 04:22:40 2013
@@ -120,11 +120,12 @@ static StringInitFailureKind IsStringIni
   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::CheckExplicitInitL
     }
 
     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;





More information about the cfe-commits mailing list