File tree Expand file tree Collapse file tree 2 files changed +35
-4
lines changed Expand file tree Collapse file tree 2 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -1039,12 +1039,12 @@ const PseudoObjectExpr *ObjCMethodCall::getContainingPseudoObjectExpr() const {
1039
1039
1040
1040
static const Expr *
1041
1041
getSyntacticFromForPseudoObjectExpr (const PseudoObjectExpr *POE) {
1042
- const Expr *Syntactic = POE->getSyntacticForm ();
1042
+ const Expr *Syntactic = POE->getSyntacticForm ()-> IgnoreParens () ;
1043
1043
1044
1044
// This handles the funny case of assigning to the result of a getter.
1045
1045
// This can happen if the getter returns a non-const reference.
1046
1046
if (const auto *BO = dyn_cast<BinaryOperator>(Syntactic))
1047
- Syntactic = BO->getLHS ();
1047
+ Syntactic = BO->getLHS ()-> IgnoreParens () ;
1048
1048
1049
1049
return Syntactic;
1050
1050
}
Original file line number Diff line number Diff line change 1
- // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -analyzer-store=region -Wno-objc-root-class %s -verify
2
- // expected-no-diagnostics
1
+ // RUN: %clang_analyze_cc1 -w %s -verify \
2
+ // RUN: -analyzer-checker=core,alpha.core,debug.ExprInspection
3
+
4
+ #ifdef HEADER // A clever trick to avoid splitting up the test.
5
+
6
+ @interface NSObject
7
+ @end
8
+
9
+ @interface HeaderClass : NSObject
10
+ @property NSObject *prop;
11
+ @end
12
+
13
+ #else
14
+ #define HEADER
15
+ #include " ObjCProperties.m"
16
+
17
+ @implementation HeaderClass
18
+ - (void )foo {
19
+ if ((self.prop )) {
20
+ }
21
+
22
+ // This test tests that no dynamic bifurcation is performed on the property.
23
+ // The TRUE/FALSE dilemma correctly arises from eagerly-assume behavior
24
+ // inside the if-statement. The dynamic bifurcation at (self.prop) inside
25
+ // the if-statement was causing an UNKNOWN to show up as well due to
26
+ // extra parentheses being caught inside PseudoObjectExpr.
27
+ // This should not be UNKNOWN.
28
+ clang_analyzer_eval (self.prop ); // expected-warning{{TRUE}}
29
+ // expected-warning@-1{{FALSE}}
30
+ }
31
+ @end
32
+
3
33
4
34
// The point of this test cases is to exercise properties in the static
5
35
// analyzer
@@ -19,3 +49,4 @@ - (id)initWithY:(id)Y {
19
49
return self;
20
50
}
21
51
@end
52
+ #endif
You can’t perform that action at this time.
0 commit comments