aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/inlining/false-positive-suppression.cpp
blob: 6fbf7392208550383a3796dca53aeffb9e38e097 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-config suppress-null-return-paths=false -verify %s
// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -DSUPPRESSED=1 %s

#ifdef SUPPRESSED
// expected-no-diagnostics
#endif

namespace rdar12676053 {
  // Delta-reduced from a preprocessed file.
  template<class T>
  class RefCount {
    T *ref;
  public:
    T *operator->() const {
      return ref ? ref : 0;
    }
  };

  class string {};

  class ParserInputState {
  public:
    string filename;
  };

  class Parser {
    void setFilename(const string& f)  {
      inputState->filename = f;
#ifndef SUPPRESSED
// expected-warning@-2 {{Called C++ object pointer is null}}
#endif
    }
  protected:
    RefCount<ParserInputState> inputState;
  };
}