brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 4a1d88f Raw
33 lines · plain
1// RUN: %clang_analyze_cc1 %s -verify \2// RUN:   -analyzer-checker=core \3// RUN:   -analyzer-config core.CallAndMessage:FunctionPointer=false \4// RUN:   -analyzer-config core.CallAndMessage:ParameterCount=false \5// RUN:   -analyzer-config core.CallAndMessage:CXXThisMethodCall=false \6// RUN:   -analyzer-config core.CallAndMessage:CXXDeallocationArg=false \7// RUN:   -analyzer-config core.CallAndMessage:ArgInitializedness=false \8// RUN:   -analyzer-config core.CallAndMessage:ArgPointeeInitializedness=false \9// RUN:   -analyzer-config core.CallAndMessage:NilReceiver=true \10// RUN:   -analyzer-config core.CallAndMessage:UndefReceiver=false \11// RUN:   -analyzer-output=plist -o %t.plist12// RUN: cat %t.plist | FileCheck %s13 14@interface Foo15- (int &)ref;16@end17 18Foo *getFoo() { return 0; }19 20void testNullPointerSuppression() {21  getFoo().ref = 1;22}23 24void testPositiveNullReference() {25  Foo *x = 0;26  x.ref = 1; // expected-warning {{The receiver of message 'ref' is nil, which results in forming a null reference [core.CallAndMessage]}}27}28 29// TODO: If this hash ever changes, turn core.CallAndMessage:NilReceiver from a30// checker option into a checker, as described in the CallAndMessage comments!31// CHECK: <key>issue_hash_content_of_line_in_context</key>32// CHECK-SAME: <string>abe2e0574dd901094c511bae2f93f926</string>33