Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions clang/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using namespace ento;
namespace {
class UndefinedAssignmentChecker
: public Checker<check::Bind> {
const BugType BT{this, "Assigned value is garbage or undefined"};
const BugType BT{this, "Assigned value is undefined and not meaningful"};

public:
void checkBind(SVal location, SVal val, const Stmt *S,
Expand Down Expand Up @@ -57,8 +57,8 @@ void UndefinedAssignmentChecker::checkBind(SVal location, SVal val,

while (StoreE) {
if (const UnaryOperator *U = dyn_cast<UnaryOperator>(StoreE)) {
OS << "The expression is an uninitialized value. "
"The computed value will also be garbage";
OS << "The expression is an uninitialized value, so the computed value "
<< "is not meaningful";

ex = U->getSubExpr();
break;
Expand All @@ -68,7 +68,7 @@ void UndefinedAssignmentChecker::checkBind(SVal location, SVal val,
if (B->isCompoundAssignmentOp()) {
if (C.getSVal(B->getLHS()).isUndef()) {
OS << "The left expression of the compound assignment is an "
"uninitialized value. The computed value will also be garbage";
<< "uninitialized value, so the computed value is not meaningful";
ex = B->getLHS();
break;
}
Expand All @@ -89,7 +89,7 @@ void UndefinedAssignmentChecker::checkBind(SVal location, SVal val,
for (auto *I : CD->inits()) {
if (I->getInit()->IgnoreImpCasts() == StoreE) {
OS << "Value assigned to field '" << I->getMember()->getName()
<< "' in implicit constructor is garbage or undefined";
<< "' in implicit constructor is undefined and not meaningful.";
break;
}
}
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2578,17 +2578,17 @@
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage</string>
<string>The left expression of the compound assignment is an uninitialized value, so the computed value is not meaningful</string>
<key>message</key>
<string>The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage</string>
<string>The left expression of the compound assignment is an uninitialized value, so the computed value is not meaningful</string>
</dict>
</array>
<key>description</key><string>The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage</string>
<key>description</key><string>The left expression of the compound assignment is an uninitialized value, so the computed value is not meaningful</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Assigned value is garbage or undefined</string>
<key>type</key><string>Assigned value is undefined and not meaningful</string>
<key>check_name</key><string>core.uninitialized.Assign</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>025372576cd3ba6716044f93a51c978c</string>
<key>issue_hash_content_of_line_in_context</key><string>936a5fabf36091d0c1e1e1553232d6f5</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>test_objc_fast_enumeration_2</string>
<key>issue_hash_function_offset</key><string>5</string>
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5864,17 +5864,17 @@
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage</string>
<string>The left expression of the compound assignment is an uninitialized value, so the computed value is not meaningful</string>
<key>message</key>
<string>The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage</string>
<string>The left expression of the compound assignment is an uninitialized value, so the computed value is not meaningful</string>
</dict>
</array>
<key>description</key><string>The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage</string>
<key>description</key><string>The left expression of the compound assignment is an uninitialized value, so the computed value is not meaningful</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Assigned value is garbage or undefined</string>
<key>type</key><string>Assigned value is undefined and not meaningful</string>
<key>check_name</key><string>core.uninitialized.Assign</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>21c774309bdfd487c3d09a61a671bbcc</string>
<key>issue_hash_content_of_line_in_context</key><string>c1d7b1284317d7e45bda4bfa6b3a281e</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>test_loop_fast_enumeration</string>
<key>issue_hash_function_offset</key><string>5</string>
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/a_flaky_crash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bool bar(S);
void foo() {
int x;
if (true && bar(S()))
++x; // expected-warning{{The expression is an uninitialized value. The computed value will also be garbage}}
++x; // expected-warning{{The expression is an uninitialized value, so the computed value is not meaningful}}
}

// 256 copies of the same run-line to make it crash more often when it breaks.
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/analysis-after-multiple-dtors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ int main() {

int x;
int y = x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
(void)y;
}
6 changes: 3 additions & 3 deletions clang/test/Analysis/array-init-loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void array_uninit() {

auto [a, b, c, d, e] = arr;

int x = e; // expected-warning{{Assigned value is garbage or undefined}}
int x = e; // expected-warning{{Assigned value is undefined and not meaningful}}
}

void lambda_init() {
Expand Down Expand Up @@ -168,7 +168,7 @@ struct S3_duplicate {
void array_uninit_non_pod() {
S3 arr[1];

auto [a] = arr; // expected-warning@159{{ in implicit constructor is garbage or undefined }}
auto [a] = arr; // expected-warning@159{{ in implicit constructor is undefined and not meaningful}}
}

void lambda_init_non_pod() {
Expand All @@ -191,7 +191,7 @@ void lambda_init_non_pod() {
void lambda_uninit_non_pod() {
S3_duplicate arr[4];

int l = [arr] { return arr[3].i; }(); // expected-warning@164{{ in implicit constructor is garbage or undefined }}
int l = [arr] { return arr[3].i; }(); // expected-warning@164{{ in implicit constructor is undefined and not meaningful }}
}

// If this struct is being copy/move constructed by the implicit ctors, ArrayInitLoopExpr
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/array-punned-region.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void array_struct_bitfield_1() {
int array_struct_bitfield_2() {
BITFIELD_CAST ff = {0};
BITFIELD_CAST *pff = &ff;
int a = *((int *)pff + 2); // expected-warning{{Assigned value is garbage or undefined [core.uninitialized.Assign]}}
int a = *((int *)pff + 2); // expected-warning{{Assigned value is undefined and not meaningful [core.uninitialized.Assign]}}
return a;
}

Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/builtin_overflow_notes.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ void test_overflow_note(int a, int b)

if (__builtin_add_overflow(a, b, &res)) { // expected-note {{Assuming overflow}}
// expected-note@-1 {{Taking true branch}}
int var = res; // expected-warning{{Assigned value is garbage or undefined}}
// expected-note@-1 {{Assigned value is garbage or undefined}}
int var = res; // expected-warning{{Assigned value is undefined and not meaningful}}
// expected-note@-1 {{Assigned value is undefined and not meaningful}}
return;
}
}
4 changes: 2 additions & 2 deletions clang/test/Analysis/call-invalidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ int testStdCtorDoesNotInvalidateParentObject() {
int testStdCtorDoesNotInvalidateParentObjectSwapped() {
StdWrappingOpaqueSwapped obj;
int x = obj.o.nested_member; // no-garbage: std::Opaque::ctor might initialized this
int y = obj.uninit; // expected-warning {{Assigned value is garbage or undefined}}
int y = obj.uninit; // expected-warning {{Assigned value is undefined and not meaningful}}
return x + y;
}

Expand Down Expand Up @@ -277,6 +277,6 @@ struct StdWrappingFancyOpaque {
int testNestedStdNamespacesAndRecords() {
StdWrappingFancyOpaque obj;
int x = obj.o.nested_member; // no-garbage: ctor
int y = obj.uninit; // expected-warning {{Assigned value is garbage or undefined}}
int y = obj.uninit; // expected-warning {{Assigned value is undefined and not meaningful}}
return x + y;
}
22 changes: 11 additions & 11 deletions clang/test/Analysis/ctor-array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ struct s {
void a1(void) {
s arr[3];
int x = arr[0].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

void a2(void) {
s arr[3];
int x = arr[1].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

void a3(void) {
s arr[3];
int x = arr[2].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

struct s2 {
Expand All @@ -37,23 +37,23 @@ void b1(void) {

clang_analyzer_eval(arr[0].y == 2); // expected-warning{{TRUE}}
int x = arr[0].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

void b2(void) {
s2 arr[3];

clang_analyzer_eval(arr[1].y == 2); // expected-warning{{TRUE}}
int x = arr[1].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

void b3(void) {
s2 arr[3];

clang_analyzer_eval(arr[2].y == 2); // expected-warning{{TRUE}}
int x = arr[2].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

void c1(void) {
Expand All @@ -70,7 +70,7 @@ void c1(void) {

clang_analyzer_eval(arr[1].y == 2); // expected-warning{{TRUE}}
int x = arr[1].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}
}

Expand Down Expand Up @@ -100,15 +100,15 @@ void e1(void) {
clang_analyzer_eval(arr[1].arr[1].y == 2); // expected-warning{{TRUE}}

int x = arr[1].sarr[1].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

void f1(void) {
s2 arr[2][2];

clang_analyzer_eval(arr[1][1].y == 2); // expected-warning{{TRUE}}
int x = arr[1][1].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

struct s5 {
Expand Down Expand Up @@ -168,14 +168,14 @@ void h2(void) {
s a[2][2], b[2][2];

int x = a[1][1].x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

void h3(void) {
s a[2][2], b[2][2];

int x = b[1][1].y;
// expected-warning@-1{{Assigned value is garbage or undefined}}
// expected-warning@-1{{Assigned value is undefined and not meaningful}}
}

struct Base {
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/diagnostics/no-store-func-path-notes.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ int initFromBlock(void) {
int p; // expected-note{{'p' declared without an initial value}}
initializer1(&p, 0); // expected-note{{Calling 'initializer1'}}
// expected-note@-1{{Returning from 'initializer1'}}
z = p; // expected-warning{{Assigned value is garbage or undefined}}
// expected-note@-1{{Assigned value is garbage or undefined}}
z = p; // expected-warning{{Assigned value is undefined and not meaningful}}
// expected-note@-1{{Assigned value is undefined and not meaningful}}
}();
return z;
}
Expand Down
20 changes: 10 additions & 10 deletions clang/test/Analysis/fread.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ void random_access_read1(int index) {
case 0:
// c[0] is not mutated by fread.
if (success) {
char p = c[0]; // expected-warning {{Assigned value is garbage or undefined}} We kept the first byte intact.
char p = c[0]; // expected-warning {{Assigned value is undefined and not meaningful}} We kept the first byte intact.
} else {
char p = c[0]; // expected-warning {{Assigned value is garbage or undefined}} We kept the first byte intact.
char p = c[0]; // expected-warning {{Assigned value is undefined and not meaningful}} We kept the first byte intact.
}
break;

Expand Down Expand Up @@ -147,9 +147,9 @@ void random_access_read1(int index) {
case 3:
// c[3] is not mutated by fread.
if (success) {
long p = c[3]; // expected-warning {{Assigned value is garbage or undefined}}
long p = c[3]; // expected-warning {{Assigned value is undefined and not meaningful}}
} else {
long p = c[3]; // expected-warning {{Assigned value is garbage or undefined}}
long p = c[3]; // expected-warning {{Assigned value is undefined and not meaningful}}
}
break;
}
Expand All @@ -169,10 +169,10 @@ void random_access_read2(int b) {
clang_analyzer_isTainted(p); // expected-warning {{YES}}
clang_analyzer_dump(p); // expected-warning {{conj_}}
} else {
int p = buffer[0]; // expected-warning {{Assigned value is garbage or undefined}}
int p = buffer[0]; // expected-warning {{Assigned value is undefined and not meaningful}}
}
} else {
int p = buffer[0]; // expected-warning {{Assigned value is garbage or undefined}}
int p = buffer[0]; // expected-warning {{Assigned value is undefined and not meaningful}}
}
fclose(fp);
}
Expand Down Expand Up @@ -283,9 +283,9 @@ void compound_read2(void) {
if (fp) {
struct S s; // s.a is not touched by fread.
if (1 == fread(&s.b, sizeof(s.b), 1, fp)) {
long p = s.a; // expected-warning {{Assigned value is garbage or undefined}}
long p = s.a; // expected-warning {{Assigned value is undefined and not meaningful}}
} else {
long p = s.a; // expected-warning {{Assigned value is garbage or undefined}}
long p = s.a; // expected-warning {{Assigned value is undefined and not meaningful}}
}
fclose(fp);
}
Expand All @@ -296,9 +296,9 @@ void var_read(void) {
if (fp) {
int a, b; // 'a' is not touched by fread.
if (1 == fread(&b, sizeof(b), 1, fp)) {
long p = a; // expected-warning{{Assigned value is garbage or undefined}}
long p = a; // expected-warning{{Assigned value is undefined and not meaningful}}
} else {
long p = a; // expected-warning{{Assigned value is garbage or undefined}}
long p = a; // expected-warning{{Assigned value is undefined and not meaningful}}
}
fclose(fp);
}
Expand Down
12 changes: 6 additions & 6 deletions clang/test/Analysis/implicit-ctor-undef-value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ struct S {

// Warning is in a weird position because the body of the constructor is
// missing. Specify which field is being assigned.
class C { // expected-warning{{Value assigned to field 'y' in implicit constructor is garbage or undefined}}
// expected-note@-1{{Value assigned to field 'y' in implicit constructor is garbage or undefined}}
class C { // expected-warning{{Value assigned to field 'y' in implicit constructor is undefined and not meaningful}}
// expected-note@-1{{Value assigned to field 'y' in implicit constructor is undefined and not meaningful}}
int x, y;
S s;

Expand All @@ -34,8 +34,8 @@ class C {
// It is not necessary to specify which field is being assigned to.
C(const C &c):
x(c.x),
y(c.y) // expected-warning{{Assigned value is garbage or undefined}}
// expected-note@-1{{Assigned value is garbage or undefined}}
y(c.y) // expected-warning{{Assigned value is undefined and not meaningful}}
// expected-note@-1{{Assigned value is undefined and not meaningful}}
{}
};

Expand All @@ -53,8 +53,8 @@ struct S {
S(const S &) {}
};

class C { // expected-warning{{Value assigned to field 'y' in implicit constructor is garbage or undefined}}
// expected-note@-1{{Value assigned to field 'y' in implicit constructor is garbage or undefined}}
class C { // expected-warning{{Value assigned to field 'y' in implicit constructor is undefined and not meaningful}}
// expected-note@-1{{Value assigned to field 'y' in implicit constructor is undefined and not meaningful}}
int x, y;
S s;

Expand Down
Loading