When Sema::ClassifyName() finds an invalid ivar reference, return an
invalid expression rather than the far-more-generic "error". Fixes a
mild regression in error recovery uncovered by the GCC testsuite.
llvm-svn: 130128
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 05a077b..d07bd4b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -411,11 +411,7 @@
// unqualified lookup mechanism.
if (!SS.isSet() && CurMethod && !isResultTypeOrTemplate(Result, NextToken)) {
ExprResult E = LookupInObjCMethod(Result, S, Name, true);
-
- if (E.isInvalid())
- return NameClassification::Error();
-
- if (E.get())
+ if (E.get() || E.isInvalid())
return E;
// Synthesize ivars lazily.
@@ -430,12 +426,8 @@
// FIXME: This is strange. Shouldn't we just take the ivar returned
// from SynthesizeProvisionalIvar and continue with that?
- E = LookupInObjCMethod(Result, S, Name, true);
-
- if (E.isInvalid())
- return NameClassification::Error();
-
- if (E.get())
+ E = LookupInObjCMethod(Result, S, Name, true);
+ if (E.get() || E.isInvalid())
return E;
}
}