r300909 - Sema: protect against ObjC++ typo-correction failure
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 20 15:23:10 PDT 2017
Author: compnerd
Date: Thu Apr 20 17:23:10 2017
New Revision: 300909
URL: http://llvm.org/viewvc/llvm-project?rev=300909&view=rev
Log:
Sema: protect against ObjC++ typo-correction failure
ObjC++ has two different types of "pointer" types (ObjCClassPointerType
and PointerType). Both can be indirected through. However, the former
is not a member expression. Ensure that we do not try to rebuild the
MRE in that case.
Added:
cfe/trunk/test/SemaObjCXX/pr32725.mm
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=300909&r1=300908&r2=300909&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu Apr 20 17:23:10 2017
@@ -2220,6 +2220,9 @@ public:
Base = BaseResult.get();
QualType BaseType = Base->getType();
+ if (isArrow && !BaseType->isPointerType())
+ return ExprError();
+
// FIXME: this involves duplicating earlier analysis in a lot of
// cases; we should avoid this when possible.
LookupResult R(getSema(), MemberNameInfo, Sema::LookupMemberName);
Added: cfe/trunk/test/SemaObjCXX/pr32725.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/pr32725.mm?rev=300909&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjCXX/pr32725.mm (added)
+++ cfe/trunk/test/SemaObjCXX/pr32725.mm Thu Apr 20 17:23:10 2017
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify -x objective-c++ %s -o /dev/null
+// REQUIRES: asserts
+
+struct objc_class {
+ unsigned long long bits;
+};
+typedef struct objc_class *Class;
+static void f(Class c) { (void)(c->bits & RW_HAS_OVERFLOW_REFCOUNT); }
+// expected-error at -1{{use of undeclared identifier 'RW_HAS_OVERFLOW_REFCOUNT}}
More information about the cfe-commits
mailing list