summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/unified-sources/source2.cpp
blob: cd85e3522343f6da9a81ac9f1aad49633b1ee901 (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
// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s

// This test tests that the warning is here when it is included from
// the unified sources file. The run-line in this file is there
// only to suppress LIT warning for the complete lack of run-line.
int testNullDereference() {
  int *x = 0;
  return *x; // expected-warning{{}}
}

// Let's see if the container inlining heuristic still works.
class ContainerInCodeFile {
  class Iterator {
  };

public:
  Iterator begin() const;
  Iterator end() const;

  int method() { return 0; }
};

int testContainerMethodInCodeFile(ContainerInCodeFile Cont) {
  return 1 / Cont.method(); // expected-warning{{}}
}
OpenPOWER on IntegriCloud