]> granicus.if.org Git - clang/commitdiff
Return true in case of error, which is what other functions do.
authorAnders Carlsson <andersca@mac.com>
Fri, 17 Aug 2007 15:44:17 +0000 (15:44 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 17 Aug 2007 15:44:17 +0000 (15:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41140 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaChecking.cpp
Sema/SemaExpr.cpp

index ed4c898349689e4df38a4142ab1d8028d49bfc25..1917d6317d87c9754f4ae1f17b34a6e3c7aab636 100644 (file)
@@ -47,7 +47,7 @@ Sema::CheckFunctionCall(Expr *Fn,
   // Search the KnownFunctionIDs for the identifier.
   unsigned i = 0, e = id_num_known_functions;
   for (; i != e; ++i) { if (KnownFunctionIDs[i] == FnInfo) break; }
-  if (i == e) return true;
+  if (i == e) return false;
   
   // Printf checking.
   if (i <= id_vprintf) {
@@ -74,7 +74,7 @@ Sema::CheckFunctionCall(Expr *Fn,
                         FDecl, format_idx, Args, NumArgsInCall);
   }
   
-  return true;
+  return false;
 }
 
 /// CheckBuiltinCFStringArgument - Checks that the argument to the builtin
@@ -90,7 +90,7 @@ bool Sema::CheckBuiltinCFStringArgument(Expr* Arg)
     Diag(Arg->getLocStart(),
          diag::err_cfstring_literal_not_string_constant,
          Arg->getSourceRange());
-    return false;
+    return true;
   }
   
   const char *Data = Literal->getStrData();
@@ -112,7 +112,7 @@ bool Sema::CheckBuiltinCFStringArgument(Expr* Arg)
     }
   }
   
-  return true;
+  return false;
 }
 
 /// CheckPrintfArguments - Check calls to printf (and similar functions) for
index 64769c83d473983856e3ec8552067cbb742beb64..3ca766b3a091dcb7bc70ed8a187fbaa4c942c228 100644 (file)
@@ -561,7 +561,7 @@ ParseCallExpr(ExprTy *fn, SourceLocation LParenLoc,
   if (ImplicitCastExpr *IcExpr = dyn_cast<ImplicitCastExpr>(Fn))
     if (DeclRefExpr *DRExpr = dyn_cast<DeclRefExpr>(IcExpr->getSubExpr()))
       if (FunctionDecl *FDecl = dyn_cast<FunctionDecl>(DRExpr->getDecl()))
-        if (!CheckFunctionCall(Fn, LParenLoc, RParenLoc, FDecl, Args, NumArgsInCall))
+        if (CheckFunctionCall(Fn, LParenLoc, RParenLoc, FDecl, Args, NumArgsInCall))
           return true;
 
   return new CallExpr(Fn, Args, NumArgsInCall, resultType, RParenLoc);