[cfe-commits] r70092 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp

Chris Lattner sabre at nondot.org
Sat Apr 25 15:50:56 PDT 2009


Author: lattner
Date: Sat Apr 25 17:50:55 2009
New Revision: 70092

URL: http://llvm.org/viewvc/llvm-project?rev=70092&view=rev
Log:
minor diagnostics improvements.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=70092&r1=70091&r2=70092&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sat Apr 25 17:50:55 2009
@@ -946,8 +946,9 @@
 
 
 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<

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Apr 25 17:50:55 2009
@@ -1636,13 +1636,13 @@
     // 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 @@
         // 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(),





More information about the cfe-commits mailing list