]> granicus.if.org Git - clang/commitdiff
minor diagnostics improvements.
authorChris Lattner <sabre@nondot.org>
Sat, 25 Apr 2009 22:50:55 +0000 (22:50 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 25 Apr 2009 22:50:55 +0000 (22:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70092 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaExpr.cpp

index 0210ceff468a599155ab0694e970f2ad1cc9c020..19f31577106875b7020e5abfe5b12efb95478c90 100644 (file)
@@ -946,8 +946,9 @@ def err_arithmetic_nonfragile_interface : Error<
 
 
 def err_typecheck_subscript_value : Error<
-  "subscripted value is neither array nor pointer">;
-def err_typecheck_subscript : Error<"array subscript is not an integer">;
+  "subscripted value is not an array, pointer, or vector">;
+def err_typecheck_subscript_not_integer : Error<
+  "array subscript is not an integer">;
 def err_subscript_function_type : Error<
   "subscript of pointer to function type %0">;
 def err_subscript_incomplete_type : Error<
index 6e86e71bd4a9eec7721e9446dea793cdad4fcf0f..873dd53f12c222ce7c0ac774e14804874aa6aea0 100644 (file)
@@ -1636,13 +1636,13 @@ Sema::ActOnArraySubscriptExpr(Scope *S, ExprArg Base, SourceLocation LLoc,
     // FIXME: need to deal with const...
     ResultType = VTy->getElementType();
   } else {
-    return ExprError(Diag(LHSExp->getLocStart(),
-      diag::err_typecheck_subscript_value) << RHSExp->getSourceRange());
+    return ExprError(Diag(LLoc, diag::err_typecheck_subscript_value)
+       << LHSExp->getSourceRange() << RHSExp->getSourceRange());
   }
   // C99 6.5.2.1p1
   if (!IndexExpr->getType()->isIntegerType() && !IndexExpr->isTypeDependent())
-    return ExprError(Diag(IndexExpr->getLocStart(),
-      diag::err_typecheck_subscript) << IndexExpr->getSourceRange());
+    return ExprError(Diag(LLoc, diag::err_typecheck_subscript_not_integer)
+                     << IndexExpr->getSourceRange());
 
   // C99 6.5.2.1p1: "shall have type "pointer to *object* type". Similarly,
   // C++ [expr.sub]p1: The type "T" shall be a completely-defined object 
@@ -4586,7 +4586,7 @@ Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
         // FIXME: Leaks Res
         if (!Idx->isTypeDependent() && !Idx->getType()->isIntegerType())
           return ExprError(Diag(Idx->getLocStart(),
-                                diag::err_typecheck_subscript)
+                                diag::err_typecheck_subscript_not_integer)
             << Idx->getSourceRange());
 
         Res = new (Context) ArraySubscriptExpr(Res, Idx, AT->getElementType(),