[llvm-branch-commits] [cfe-branch] r214839 - Merging r214734:

Bill Wendling isanbard at gmail.com
Mon Aug 4 22:19:17 PDT 2014


Author: void
Date: Tue Aug  5 00:19:17 2014
New Revision: 214839

URL: http://llvm.org/viewvc/llvm-project?rev=214839&view=rev
Log:
Merging r214734:
------------------------------------------------------------------------
r214734 | ogoffart | 2014-08-04 10:28:05 -0700 (Mon, 04 Aug 2014) | 7 lines

Fix crash when assiging to a property with an invalid type

This is a regression from clang 3.4

Set the result to ExprError and returns true, rather than simply
returns false because errors have been reported already and returning
false show a confusing error
------------------------------------------------------------------------

Added:
    cfe/branches/release_35/test/SemaObjCXX/property-invalid-type.mm
      - copied unchanged from r214734, cfe/trunk/test/SemaObjCXX/property-invalid-type.mm
Modified:
    cfe/branches/release_35/   (props changed)
    cfe/branches/release_35/lib/Sema/SemaPseudoObject.cpp

Propchange: cfe/branches/release_35/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug  5 00:19:17 2014
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:213609,213611,213613,213741,213834,213840,213902,213912-213913,213993,213998-213999,214008,214050,214060,214119,214208,214222,214369,214390,214471,214777
+/cfe/trunk:213609,213611,213613,213741,213834,213840,213902,213912-213913,213993,213998-213999,214008,214050,214060,214119,214208,214222,214369,214390,214471,214734,214777
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_35/lib/Sema/SemaPseudoObject.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/lib/Sema/SemaPseudoObject.cpp?rev=214839&r1=214838&r2=214839&view=diff
==============================================================================
--- cfe/branches/release_35/lib/Sema/SemaPseudoObject.cpp (original)
+++ cfe/branches/release_35/lib/Sema/SemaPseudoObject.cpp Tue Aug  5 00:19:17 2014
@@ -845,7 +845,12 @@ bool ObjCPropertyOpBuilder::tryBuildGetO
   if (!S.getLangOpts().CPlusPlus) return false;
 
   findGetter();
-  assert(Getter && "property has no setter and no getter!");
+  if (!Getter) {
+    // The property has no setter and no getter! This can happen if the type is
+    // invalid. Error have already been reported.
+    result = ExprError();
+    return true;
+  }
 
   // Only do this if the getter returns an l-value reference type.
   QualType resultType = Getter->getReturnType();





More information about the llvm-branch-commits mailing list