bool coin();
void foo() {
- flag = coin(); // tracking-note{{Value assigned to 'flag'}}
+ flag = coin(); // tracking-note-re{{{{^}}Value assigned to 'flag', which participates in a condition later{{$}}}}
}
void test() {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
flag = 1;
foo(); // TODO: Add nodes here about flag's value being invalidated.
- if (flag) // expected-note {{Assuming 'flag' is 0}}
- // expected-note@-1{{Taking false branch}}
+ if (flag) // expected-note-re {{{{^}}Assuming 'flag' is 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking false branch{{$}}}}
x = new int;
- foo(); // tracking-note{{Calling 'foo'}}
- // tracking-note@-1{{Returning from 'foo'}}
+ foo(); // tracking-note-re{{{{^}}Calling 'foo'{{$}}}}
+ // tracking-note-re@-1{{{{^}}Returning from 'foo'{{$}}}}
- if (flag) // expected-note {{Assuming 'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (flag) // expected-note-re {{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
bool coin();
void foo() {
- flag = coin(); // tracking-note{{Value assigned to 'flag'}}
+ flag = coin(); // tracking-note-re{{{{^}}Value assigned to 'flag', which participates in a condition later{{$}}}}
}
void test() {
flag = 1;
foo();
- if (flag) // expected-note {{Assuming 'flag' is 0}}
- // expected-note@-1{{Taking false branch}}
+ if (flag) // expected-note-re {{{{^}}Assuming 'flag' is 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking false branch{{$}}}}
x = new int;
- x = 0; // expected-note{{Null pointer value stored to 'x'}}
+ x = 0; // expected-note-re{{{{^}}Null pointer value stored to 'x'{{$}}}}
- foo(); // tracking-note{{Calling 'foo'}}
- // tracking-note@-1{{Returning from 'foo'}}
+ foo(); // tracking-note-re{{{{^}}Calling 'foo'{{$}}}}
+ // tracking-note-re@-1{{{{^}}Returning from 'foo'{{$}}}}
- if (flag) // expected-note {{Assuming 'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (flag) // expected-note-re {{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
void foo() {
// coin() could write bar, do it's invalidated.
- flag = coin(); // tracking-note{{Value assigned to 'flag'}}
- // tracking-note@-1{{Value assigned to 'bar'}}
+ flag = coin(); // tracking-note-re{{{{^}}Value assigned to 'flag', which participates in a condition later{{$}}}}
+ // tracking-note-re@-1{{{{^}}Value assigned to 'bar', which participates in a condition later{{$}}}}
}
int bar;
void test() {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
flag = 1;
- foo(); // tracking-note{{Calling 'foo'}}
- // tracking-note@-1{{Returning from 'foo'}}
+ foo(); // tracking-note-re{{{{^}}Calling 'foo'{{$}}}}
+ // tracking-note-re@-1{{{{^}}Returning from 'foo'{{$}}}}
- if (bar) // expected-note {{Assuming 'bar' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'bar'}}
- if (flag) // expected-note {{Assuming 'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (bar) // expected-note-re {{{{^}}Assuming 'bar' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'bar'{{$}}}}
+ if (flag) // expected-note-re {{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
int bar;
void test() {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
- if (int flag = foo()) // debug-note{{Tracking condition 'flag'}}
- // expected-note@-1{{Assuming 'flag' is not equal to 0}}
- // expected-note@-2{{Taking true branch}}
+ if (int flag = foo()) // debug-note-re{{{{^}}Tracking condition 'flag'{{$}}}}
+ // expected-note-re@-1{{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-2{{{{^}}Taking true branch{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
};
void test() {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
if (ConvertsToBool())
- // debug-note@-1{{Tracking condition 'ConvertsToBool()'}}
- // expected-note@-2{{Assuming the condition is true}}
- // expected-note@-3{{Taking true branch}}
+ // debug-note-re@-1{{{{^}}Tracking condition 'ConvertsToBool()'{{$}}}}
+ // expected-note-re@-2{{{{^}}Assuming the condition is true{{$}}}}
+ // expected-note-re@-3{{{{^}}Taking true branch{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
namespace note_from_different_but_not_nested_stackframe {
void nullptrDeref(int *ptr, bool True) {
- if (True) // expected-note{{'True' is true}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'True}}
+ if (True) // expected-note-re{{{{^}}'True' is true{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'True'{{$}}}}
*ptr = 5;
// expected-note@-1{{Dereference of null pointer (loaded from variable 'ptr')}}
// expected-warning@-2{{Dereference of null pointer (loaded from variable 'ptr')}}
void f() {
int *ptr = nullptr;
- // expected-note@-1{{'ptr' initialized to a null pointer value}}
+ // expected-note-re@-1{{{{^}}'ptr' initialized to a null pointer value{{$}}}}
bool True = true;
nullptrDeref(ptr, True);
- // expected-note@-1{{Passing null pointer value via 1st parameter 'ptr'}}
- // expected-note@-2{{Calling 'nullptrDeref'}}
+ // expected-note-re@-1{{{{^}}Passing null pointer value via 1st parameter 'ptr'{{$}}}}
+ // expected-note-re@-2{{{{^}}Calling 'nullptrDeref'{{$}}}}
}
} // end of namespace note_from_different_but_not_nested_stackframe
int *getIntPtr();
void storeValue(int **i) {
- *i = getIntPtr(); // tracking-note{{Value assigned to 'i'}}
+ *i = getIntPtr(); // tracking-note-re{{{{^}}Value assigned to 'i', which participates in a condition later{{$}}}}
}
int *conjurePointer() {
int *i;
- storeValue(&i); // tracking-note{{Calling 'storeValue'}}
- // tracking-note@-1{{Returning from 'storeValue'}}
- return i; // tracking-note{{Returning pointer (loaded from 'i')}}
+ storeValue(&i); // tracking-note-re{{{{^}}Calling 'storeValue'{{$}}}}
+ // tracking-note-re@-1{{{{^}}Returning from 'storeValue'{{$}}}}
+ return i; // tracking-note-re{{{{^}}Returning pointer (loaded from 'i'), which participates in a condition later{{$}}}}
}
void f(int *ptr) {
- if (ptr) // expected-note{{Assuming 'ptr' is null}}
- // expected-note@-1{{Taking false branch}}
+ if (ptr) // expected-note-re{{{{^}}Assuming 'ptr' is null{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking false branch{{$}}}}
;
if (!conjurePointer())
- // tracking-note@-1{{Calling 'conjurePointer'}}
- // tracking-note@-2{{Returning from 'conjurePointer'}}
- // debug-note@-3{{Tracking condition '!conjurePointer()'}}
- // expected-note@-4{{Assuming the condition is true}}
- // expected-note@-5{{Taking true branch}}
+ // tracking-note-re@-1{{{{^}}Calling 'conjurePointer'{{$}}}}
+ // tracking-note-re@-2{{{{^}}Returning from 'conjurePointer'{{$}}}}
+ // debug-note-re@-3{{{{^}}Tracking condition '!conjurePointer()'{{$}}}}
+ // expected-note-re@-4{{{{^}}Assuming the condition is true{{$}}}}
+ // expected-note-re@-5{{{{^}}Taking true branch{{$}}}}
*ptr = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
}
void f(int *ptr) {
- if (ptr) // expected-note{{Assuming 'ptr' is null}}
- // expected-note@-1{{Taking false branch}}
+ if (ptr) // expected-note-re{{{{^}}Assuming 'ptr' is null{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking false branch{{$}}}}
;
if (!conjurePointer())
- // debug-note@-1{{Tracking condition '!conjurePointer()'}}
- // expected-note@-2{{Assuming the condition is true}}
- // expected-note@-3{{Taking true branch}}
+ // debug-note-re@-1{{{{^}}Tracking condition '!conjurePointer()'{{$}}}}
+ // expected-note-re@-2{{{{^}}Assuming the condition is true{{$}}}}
+ // expected-note-re@-3{{{{^}}Taking true branch{{$}}}}
*ptr = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
}
void f() {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
if (cast(conjure()))
- // debug-note@-1{{Tracking condition 'cast(conjure())'}}
- // expected-note@-2{{Assuming the condition is false}}
- // expected-note@-3{{Taking false branch}}
+ // debug-note-re@-1{{{{^}}Tracking condition 'cast(conjure())'{{$}}}}
+ // expected-note-re@-2{{{{^}}Assuming the condition is false{{$}}}}
+ // expected-note-re@-3{{{{^}}Taking false branch{{$}}}}
return;
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
bool flipCoin() { return coin(); }
void i(int *ptr) {
- if (ptr) // expected-note{{Assuming 'ptr' is null}}
- // expected-note@-1{{Taking false branch}}
+ if (ptr) // expected-note-re{{{{^}}Assuming 'ptr' is null{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking false branch{{$}}}}
;
if (!flipCoin())
- // debug-note@-1{{Tracking condition '!flipCoin()'}}
- // expected-note@-2{{Assuming the condition is true}}
- // expected-note@-3{{Taking true branch}}
+ // debug-note-re@-1{{{{^}}Tracking condition '!flipCoin()'{{$}}}}
+ // expected-note-re@-2{{{{^}}Assuming the condition is true{{$}}}}
+ // expected-note-re@-3{{{{^}}Taking true branch{{$}}}}
*ptr = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
bool coin();
bool flipCoin() {
- if (coin()) // tracking-note{{Assuming the condition is false}}
- // tracking-note@-1{{Taking false branch}}
- // debug-note@-2{{Tracking condition 'coin()'}}
+ if (coin()) // tracking-note-re{{{{^}}Assuming the condition is false{{$}}}}
+ // tracking-note-re@-1{{{{^}}Taking false branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'coin()'{{$}}}}
return true;
- return coin(); // tracking-note{{Returning value}}
+ return coin(); // tracking-note-re{{{{^}}Returning value, which participates in a condition later{{$}}}}
}
void i(int *ptr) {
- if (ptr) // expected-note{{Assuming 'ptr' is null}}
- // expected-note@-1{{Taking false branch}}
+ if (ptr) // expected-note-re{{{{^}}Assuming 'ptr' is null{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking false branch{{$}}}}
;
if (!flipCoin())
- // tracking-note@-1{{Calling 'flipCoin'}}
- // tracking-note@-2{{Returning from 'flipCoin'}}
- // debug-note@-3{{Tracking condition '!flipCoin()'}}
- // expected-note@-4{{Assuming the condition is true}}
- // expected-note@-5{{Taking true branch}}
+ // tracking-note-re@-1{{{{^}}Calling 'flipCoin'{{$}}}}
+ // tracking-note-re@-2{{{{^}}Returning from 'flipCoin'{{$}}}}
+ // debug-note-re@-3{{{{^}}Tracking condition '!flipCoin()'{{$}}}}
+ // expected-note-re@-4{{{{^}}Assuming the condition is true{{$}}}}
+ // expected-note-re@-5{{{{^}}Taking true branch{{$}}}}
*ptr = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
bool flipCoin() {
if (super_complicated_template_hackery::value)
- // tracking-note@-1{{'value' is false}}
- // tracking-note@-2{{Taking false branch}}
+ // tracking-note-re@-1{{{{^}}'value' is false{{$}}}}
+ // tracking-note-re@-2{{{{^}}Taking false branch{{$}}}}
return true;
- return coin(); // tracking-note{{Returning value}}
+ return coin(); // tracking-note-re{{{{^}}Returning value, which participates in a condition later{{$}}}}
}
void i(int *ptr) {
- if (ptr) // expected-note{{Assuming 'ptr' is null}}
- // expected-note@-1{{Taking false branch}}
+ if (ptr) // expected-note-re{{{{^}}Assuming 'ptr' is null{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking false branch{{$}}}}
;
if (!flipCoin())
- // tracking-note@-1{{Calling 'flipCoin'}}
- // tracking-note@-2{{Returning from 'flipCoin'}}
- // debug-note@-3{{Tracking condition '!flipCoin()'}}
- // expected-note@-4{{Assuming the condition is true}}
- // expected-note@-5{{Taking true branch}}
+ // tracking-note-re@-1{{{{^}}Calling 'flipCoin'{{$}}}}
+ // tracking-note-re@-2{{{{^}}Returning from 'flipCoin'{{$}}}}
+ // debug-note-re@-3{{{{^}}Tracking condition '!flipCoin()'{{$}}}}
+ // expected-note-re@-4{{{{^}}Assuming the condition is true{{$}}}}
+ // expected-note-re@-5{{{{^}}Taking true branch{{$}}}}
*ptr = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
void f() {
int flag = getInt();
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
- if (flag) // expected-note{{Assuming 'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
+ if (flag) // expected-note-re{{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
y = 1;
flag = y;
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
- if (flag) // expected-note{{'flag' is 1}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
+ if (flag) // expected-note-re{{{{^}}'flag' is 1{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
void foo() {
int y;
y = 1;
- flag = y; // tracking-note{{The value 1 is assigned to 'flag'}}
+ flag = y; // tracking-note-re{{{{^}}The value 1 is assigned to 'flag', which participates in a condition later{{$}}}}
}
void f(int y) {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
- foo(); // tracking-note{{Calling 'foo'}}
- // tracking-note@-1{{Returning from 'foo'}}
+ foo(); // tracking-note-re{{{{^}}Calling 'foo'{{$}}}}
+ // tracking-note-re@-1{{{{^}}Returning from 'foo'{{$}}}}
- if (flag) // expected-note{{'flag' is 1}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (flag) // expected-note-re{{{{^}}'flag' is 1{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
int getInt();
void foo() {
- flag = getInt(); // tracking-note{{Value assigned to 'flag'}}
+ flag = getInt(); // tracking-note-re{{{{^}}Value assigned to 'flag', which participates in a condition later{{$}}}}
}
void f() {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
int y = 0;
- foo(); // tracking-note{{Calling 'foo'}}
- // tracking-note@-1{{Returning from 'foo'}}
+ foo(); // tracking-note-re{{{{^}}Calling 'foo'{{$}}}}
+ // tracking-note-re@-1{{{{^}}Returning from 'foo'{{$}}}}
y = flag;
- if (y) // expected-note{{Assuming 'y' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'y'}}
+ if (y) // expected-note-re{{{{^}}Assuming 'y' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'y'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
[[noreturn]] void halt();
void assert(int b) {
- if (!b) // tracking-note{{Assuming 'b' is not equal to 0}}
- // tracking-note@-1{{Taking false branch}}
+ if (!b) // tracking-note-re{{{{^}}Assuming 'b' is not equal to 0{{$}}}}
+ // tracking-note-re@-1{{{{^}}Taking false branch{{$}}}}
halt();
}
void f(int flag) {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
- assert(flag); // tracking-note{{Calling 'assert'}}
- // tracking-note@-1{{Returning from 'assert'}}
+ assert(flag); // tracking-note-re{{{{^}}Calling 'assert'{{$}}}}
+ // tracking-note-re@-1{{{{^}}Returning from 'assert'{{$}}}}
- if (flag) // expected-note{{'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (flag) // expected-note-re{{{{^}}'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
[[noreturn]] void halt();
void assert(int b) {
- if (!b) // tracking-note{{Assuming 'b' is not equal to 0}}
- // tracking-note@-1{{Taking false branch}}
+ if (!b) // tracking-note-re{{{{^}}Assuming 'b' is not equal to 0{{$}}}}
+ // tracking-note-re@-1{{{{^}}Taking false branch{{$}}}}
halt();
}
int getInt();
void f(int flag) {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
flag = getInt();
- assert(flag); // tracking-note{{Calling 'assert'}}
- // tracking-note@-1{{Returning from 'assert'}}
+ assert(flag); // tracking-note-re{{{{^}}Calling 'assert'{{$}}}}
+ // tracking-note-re@-1{{{{^}}Returning from 'assert'{{$}}}}
- if (flag) // expected-note{{'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (flag) // expected-note-re{{{{^}}'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
}
void f(int flag) {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
flag = getInt();
bar();
- assert(cond1); // expected-note{{Assuming 'cond1' is not equal to 0}}
- // expected-note@-1{{'?' condition is true}}
+ assert(cond1); // expected-note-re{{{{^}}Assuming 'cond1' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}'?' condition is true{{$}}}}
- if (flag) // expected-note{{'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (flag) // expected-note-re{{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
}
void f(int flag) {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
flag = getInt();
bar();
assert(cond1 && cond2);
- // expected-note@-1{{Assuming 'cond1' is not equal to 0}}
- // expected-note@-2{{Assuming 'cond2' is not equal to 0}}
- // expected-note@-3{{'?' condition is true}}
- // expected-note@-4{{Left side of '&&' is true}}
-
- if (flag) // expected-note{{'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ // expected-note-re@-1{{{{^}}Assuming 'cond1' is not equal to 0{{$}}}}
+ // expected-note-re@-2{{{{^}}Assuming 'cond2' is not equal to 0{{$}}}}
+ // expected-note-re@-3{{{{^}}'?' condition is true{{$}}}}
+ // expected-note-re@-4{{{{^}}Left side of '&&' is true{{$}}}}
+
+ if (flag) // expected-note-re{{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
}
void f(int flag) {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
flag = getInt();
bar();
assert(cond1 || cond2);
- // expected-note@-1{{Assuming 'cond1' is not equal to 0}}
- // expected-note@-2{{Left side of '||' is true}}
+ // expected-note-re@-1{{{{^}}Assuming 'cond1' is not equal to 0{{$}}}}
+ // expected-note-re@-2{{{{^}}Left side of '||' is true{{$}}}}
- if (flag) // expected-note{{'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (flag) // expected-note-re{{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
}
void f(int flag) {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
flag = getInt();
bar();
- assert(cond1); // expected-note{{Assuming 'cond1' is not equal to 0}}
- // expected-note@-1{{Taking false branch}}
- // expected-note@-2{{Loop condition is false. Exiting loop}}
+ assert(cond1); // expected-note-re{{{{^}}Assuming 'cond1' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking false branch{{$}}}}
+ // expected-note-re@-2{{{{^}}Loop condition is false. Exiting loop{{$}}}}
- if (flag) // expected-note{{'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (flag) // expected-note-re{{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
}
void f(int flag) {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
flag = getInt();
bar();
assert(cond1 && cond2);
- // expected-note@-1{{Assuming 'cond1' is not equal to 0}}
- // expected-note@-2{{Left side of '&&' is true}}
- // expected-note@-3{{Assuming the condition is false}}
- // expected-note@-4{{Taking false branch}}
- // expected-note@-5{{Loop condition is false. Exiting loop}}
-
- if (flag) // expected-note{{'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ // expected-note-re@-1{{{{^}}Assuming 'cond1' is not equal to 0{{$}}}}
+ // expected-note-re@-2{{{{^}}Left side of '&&' is true{{$}}}}
+ // expected-note-re@-3{{{{^}}Assuming the condition is false{{$}}}}
+ // expected-note-re@-4{{{{^}}Taking false branch{{$}}}}
+ // expected-note-re@-5{{{{^}}Loop condition is false. Exiting loop{{$}}}}
+
+ if (flag) // expected-note-re{{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
}
void f(int flag) {
- int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+ int *x = 0; // expected-note-re{{{{^}}'x' initialized to a null pointer value{{$}}}}
flag = getInt();
bar();
assert(cond1 || cond2);
- // expected-note@-1{{Assuming 'cond1' is not equal to 0}}
- // expected-note@-2{{Left side of '||' is true}}
- // expected-note@-3{{Taking false branch}}
- // expected-note@-4{{Loop condition is false. Exiting loop}}
-
- if (flag) // expected-note{{'flag' is not equal to 0}}
- // expected-note@-1{{Taking true branch}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ // expected-note-re@-1{{{{^}}Assuming 'cond1' is not equal to 0{{$}}}}
+ // expected-note-re@-2{{{{^}}Left side of '||' is true{{$}}}}
+ // expected-note-re@-3{{{{^}}Taking false branch{{$}}}}
+ // expected-note-re@-4{{{{^}}Loop condition is false. Exiting loop{{$}}}}
+
+ if (flag) // expected-note-re{{{{^}}Assuming 'flag' is not equal to 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Taking true branch{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
*x = 5; // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{Dereference of null pointer}}
}
bool coin();
void bar(int &flag) {
- flag = coin(); // tracking-note{{Value assigned to 'flag'}}
+ flag = coin(); // tracking-note-re{{{{^}}Value assigned to 'flag', which participates in a condition later{{$}}}}
}
void bar2(int &flag2) {
}
void f(int *x) {
- if (x) // expected-note{{Assuming 'x' is null}}
- // debug-note@-1{{Tracking condition 'x'}}
- // expected-note@-2{{Taking false branch}}
+ if (x) // expected-note-re{{{{^}}Assuming 'x' is null{{$}}}}
+ // debug-note-re@-1{{{{^}}Tracking condition 'x'{{$}}}}
+ // expected-note-re@-2{{{{^}}Taking false branch{{$}}}}
return;
int flag, flag2;
- bar(flag); // tracking-note{{Calling 'bar'}}
- // tracking-note@-1{{Returning from 'bar'}}
+ bar(flag); // tracking-note-re{{{{^}}Calling 'bar'{{$}}}}
+ // tracking-note-re@-1{{{{^}}Returning from 'bar'{{$}}}}
bar2(flag2);
- if (flag && flag2) // expected-note {{Assuming 'flag' is 0}}
- // expected-note@-1{{Left side of '&&' is false}}
- // debug-note@-2{{Tracking condition 'flag'}}
+ if (flag && flag2) // expected-note-re {{{{^}}Assuming 'flag' is 0{{$}}}}
+ // expected-note-re@-1{{{{^}}Left side of '&&' is false{{$}}}}
+ // debug-note-re@-2{{{{^}}Tracking condition 'flag'{{$}}}}
return;
*x = 5; // expected-warning{{Dereference of null pointer}}