From: Saleem Abdulrasool Date: Thu, 20 Apr 2017 22:23:10 +0000 (+0000) Subject: Sema: protect against ObjC++ typo-correction failure X-Git-Tag: llvmorg-5.0.0-rc1~7114 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f5f5c2c2f3123c47359eb702a7ee50f1b0e27ae;p=platform%2Fupstream%2Fllvm.git 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. llvm-svn: 300909 --- diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 693b5c0..f4a97f5 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -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); diff --git a/clang/test/SemaObjCXX/pr32725.mm b/clang/test/SemaObjCXX/pr32725.mm new file mode 100644 index 0000000..8d7d116 --- /dev/null +++ b/clang/test/SemaObjCXX/pr32725.mm @@ -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@-1{{use of undeclared identifier 'RW_HAS_OVERFLOW_REFCOUNT}}