aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-03-28 17:56:49 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-03-28 17:56:49 +0000
commita78eca20429e55b041bffcea1938cd0df07a6ebd (patch)
treef21a05e69d3519bbf9d801c786ffd87088dabe9e /lib/Sema/SemaExpr.cpp
parent253955ca25c7e7049963b5db613c0cd15d66e4f8 (diff)
objective-c: Improve diagnostics and
provide 'fixit' hint when dictionary index is not of proper type. // rdar://11062080 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index ae5257fecb..6b30643db9 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3115,19 +3115,19 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
BaseExpr = LHSExp;
IndexExpr = RHSExp;
ResultType = PTy->getPointeeType();
- } else if (const PointerType *PTy = RHSTy->getAs<PointerType>()) {
- // Handle the uncommon case of "123[Ptr]".
- BaseExpr = RHSExp;
- IndexExpr = LHSExp;
- ResultType = PTy->getPointeeType();
} else if (const ObjCObjectPointerType *PTy =
- LHSTy->getAs<ObjCObjectPointerType>()) {
+ LHSTy->getAs<ObjCObjectPointerType>()) {
BaseExpr = LHSExp;
IndexExpr = RHSExp;
Result = BuildObjCSubscriptExpression(RLoc, BaseExpr, IndexExpr, 0, 0);
if (!Result.isInvalid())
return Owned(Result.take());
ResultType = PTy->getPointeeType();
+ } else if (const PointerType *PTy = RHSTy->getAs<PointerType>()) {
+ // Handle the uncommon case of "123[Ptr]".
+ BaseExpr = RHSExp;
+ IndexExpr = LHSExp;
+ ResultType = PTy->getPointeeType();
} else if (const ObjCObjectPointerType *PTy =
RHSTy->getAs<ObjCObjectPointerType>()) {
// Handle the uncommon case of "123[Ptr]".