return 0;
if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak)
return 0;
+
+ const ObjCImplementationDecl *ImplDecl =
+ IVar->getContainingInterface()->getImplementation();
+ if (ImplDecl) {
+ typedef ObjCImplementationDecl::propimpl_iterator propimpl_iterator;
+ for (propimpl_iterator I = ImplDecl->propimpl_begin(),
+ E = ImplDecl->propimpl_end();
+ I != E; ++I) {
+ if (I->getPropertyDecl() != Prop)
+ continue;
+
+ if (I->getGetterCXXConstructor()) {
+ ASTMaker M(Ctx);
+ return M.makeReturn(I->getGetterCXXConstructor());
+ }
+ }
+ }
+
if (IVar->getType().getCanonicalType() !=
Prop->getType().getNonReferenceType().getCanonicalType())
return 0;
- // C++ records require copy constructors, so we can't just synthesize an AST.
- // FIXME: Use ObjCPropertyImplDecl's already-synthesized AST. Currently it's
- // not in a form the analyzer can use.
- if (Prop->getType()->getAsCXXRecordDecl())
- return 0;
-
ASTMaker M(Ctx);
const VarDecl *selfVar = Prop->getGetterMethodDecl()->getSelfDecl();
@end
void testConsistencyStruct(StructWrapper *w) {
- clang_analyzer_eval(w.inner.value == w.inner.value); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(w.inner.value == w.inner.value); // expected-warning{{TRUE}}
int origValue = w.inner.value;
if (origValue != 42)
return;
- clang_analyzer_eval(w.inner.value == 42); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(w.inner.value == 42); // expected-warning{{TRUE}}
}
class CustomCopy {
public:
CustomCopy() : value(0) {}
- CustomCopy(const CustomCopy &other) {
- clang_analyzer_checkInlined(false);
+ CustomCopy(const CustomCopy &other) : value(other.value) {
+ clang_analyzer_checkInlined(true); // expected-warning{{TRUE}}
}
int value;
};
@end
void testConsistencyCustomCopy(CustomCopyWrapper *w) {
- clang_analyzer_eval(w.inner.value == w.inner.value); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(w.inner.value == w.inner.value); // expected-warning{{TRUE}}
int origValue = w.inner.value;
if (origValue != 42)
return;
- clang_analyzer_eval(w.inner.value == 42); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(w.inner.value == 42); // expected-warning{{TRUE}}
}