[llvm-branch-commits] [cfe-branch] r214840 - Merging r214735:
Bill Wendling
isanbard at gmail.com
Mon Aug 4 22:19:37 PDT 2014
Author: void
Date: Tue Aug 5 00:19:37 2014
New Revision: 214840
URL: http://llvm.org/viewvc/llvm-project?rev=214840&view=rev
Log:
Merging r214735:
------------------------------------------------------------------------
r214735 | ogoffart | 2014-08-04 10:28:11 -0700 (Mon, 04 Aug 2014) | 1 line
Fix crash when accessing a property of an invalid interface
------------------------------------------------------------------------
Modified:
cfe/branches/release_35/ (props changed)
cfe/branches/release_35/lib/Sema/SemaPseudoObject.cpp
cfe/branches/release_35/test/SemaObjCXX/property-invalid-type.mm
Propchange: cfe/branches/release_35/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 5 00:19:37 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,214734,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-214735,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=214840&r1=214839&r2=214840&view=diff
==============================================================================
--- cfe/branches/release_35/lib/Sema/SemaPseudoObject.cpp (original)
+++ cfe/branches/release_35/lib/Sema/SemaPseudoObject.cpp Tue Aug 5 00:19:37 2014
@@ -284,7 +284,7 @@ namespace {
bool tryBuildGetOfReference(Expr *op, ExprResult &result);
bool findSetter(bool warn=true);
bool findGetter();
- bool DiagnoseUnsupportedPropertyUse();
+ void DiagnoseUnsupportedPropertyUse();
Expr *rebuildAndCaptureObject(Expr *syntacticBase) override;
ExprResult buildGet() override;
@@ -642,7 +642,7 @@ bool ObjCPropertyOpBuilder::findSetter(b
return false;
}
-bool ObjCPropertyOpBuilder::DiagnoseUnsupportedPropertyUse() {
+void ObjCPropertyOpBuilder::DiagnoseUnsupportedPropertyUse() {
if (S.getCurLexicalContext()->isObjCContainer() &&
S.getCurLexicalContext()->getDeclKind() != Decl::ObjCCategoryImpl &&
S.getCurLexicalContext()->getDeclKind() != Decl::ObjCImplementation) {
@@ -650,10 +650,8 @@ bool ObjCPropertyOpBuilder::DiagnoseUnsu
S.Diag(RefExpr->getLocation(),
diag::err_property_function_in_objc_container);
S.Diag(prop->getLocation(), diag::note_property_declare);
- return true;
}
}
- return false;
}
/// Capture the base object of an Objective-C property expression.
@@ -679,10 +677,10 @@ Expr *ObjCPropertyOpBuilder::rebuildAndC
/// Load from an Objective-C property reference.
ExprResult ObjCPropertyOpBuilder::buildGet() {
findGetter();
- if (!Getter && DiagnoseUnsupportedPropertyUse())
- return ExprError();
-
- assert(Getter);
+ if (!Getter) {
+ DiagnoseUnsupportedPropertyUse();
+ return ExprError();
+ }
if (SyntacticRefExpr)
SyntacticRefExpr->setIsMessagingGetter();
@@ -720,10 +718,10 @@ ExprResult ObjCPropertyOpBuilder::buildG
/// value being set as the value of the property operation.
ExprResult ObjCPropertyOpBuilder::buildSet(Expr *op, SourceLocation opcLoc,
bool captureSetValueAsResult) {
- bool hasSetter = findSetter(false);
- if (!hasSetter && DiagnoseUnsupportedPropertyUse())
- return ExprError();
- assert(hasSetter); (void) hasSetter;
+ if (!findSetter(false)) {
+ DiagnoseUnsupportedPropertyUse();
+ return ExprError();
+ }
if (SyntacticRefExpr)
SyntacticRefExpr->setIsMessagingSetter();
Modified: cfe/branches/release_35/test/SemaObjCXX/property-invalid-type.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/test/SemaObjCXX/property-invalid-type.mm?rev=214840&r1=214839&r2=214840&view=diff
==============================================================================
--- cfe/branches/release_35/test/SemaObjCXX/property-invalid-type.mm (original)
+++ cfe/branches/release_35/test/SemaObjCXX/property-invalid-type.mm Tue Aug 5 00:19:37 2014
@@ -7,6 +7,7 @@
@end
@interface I ()
@property A* response; // expected-error {{unknown type name 'A'}}
+ at property int helper;
@end
@implementation I
@synthesize response;
@@ -16,4 +17,7 @@
}
@end
-
+void foo(I *i)
+{
+ i.helper;
+}
More information about the llvm-branch-commits
mailing list