[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / Analysis / method-call-intra-p.cpp
blob11c8d83eb4aff01f4914543b028dfe9755e9d4ca
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
2 // expected-no-diagnostics
4 // Intra-procedural C++ tests.
6 // Test relaxing function call arguments invalidation to be aware of const
7 // arguments.
8 struct InvalidateArgs {
9 void ttt(const int &nptr);
10 virtual void vttt(const int *nptr);
12 struct ChildOfInvalidateArgs: public InvalidateArgs {
13 virtual void vttt(const int *nptr);
15 void declarationFun(int x) {
16 InvalidateArgs t;
17 x = 3;
18 int y = x + 1;
19 int *p = 0;
20 t.ttt(y);
21 if (x == y)
22 y = *p; // no-warning
24 void virtualFun(int x) {
25 ChildOfInvalidateArgs t;
26 InvalidateArgs *pt = &t;
27 x = 3;
28 int y = x + 1;
29 int *p = 0;
30 pt->vttt(&y);
31 if (x == y)
32 y = *p; // no-warning