Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -6214,7 +6214,7 @@ def warn_possible_object_duplication_mutable : Warning<
"it is mutable, has hidden visibility, and external linkage">,
InGroup<UniqueObjectDuplication>, DefaultIgnore;
def warn_possible_object_duplication_init : Warning<
"initializeation of %0 may run twice when built into a shared library: "
"initialization of %0 may run twice when built into a shared library: "
"it has hidden visibility and external linkage">,
InGroup<UniqueObjectDuplication>, DefaultIgnore;

Expand Down
6 changes: 3 additions & 3 deletions clang/test/SemaCXX/unique_object_duplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ inline void has_static_locals_external() {
// Mutable
static int disallowedStatic1 = 0; // hidden-warning {{'disallowedStatic1' may be duplicated when built into a shared library: it is mutable, has hidden visibility, and external linkage}}
// Initialization might run more than once
static const double disallowedStatic2 = disallowedStatic1++; // hidden-warning {{initializeation of 'disallowedStatic2' may run twice when built into a shared library: it has hidden visibility and external linkage}}
static const double disallowedStatic2 = disallowedStatic1++; // hidden-warning {{initialization of 'disallowedStatic2' may run twice when built into a shared library: it has hidden visibility and external linkage}}

// OK, because immutable and compile-time-initialized
static constexpr int allowedStatic1 = 0;
Expand Down Expand Up @@ -112,7 +112,7 @@ namespace GlobalTest {
inline float disallowedGlobal1 = 3.14; // hidden-warning {{'disallowedGlobal1' may be duplicated when built into a shared library: it is mutable, has hidden visibility, and external linkage}}

// Initialization might run more than once
inline const double disallowedGlobal5 = disallowedGlobal1++; // hidden-warning {{initializeation of 'disallowedGlobal5' may run twice when built into a shared library: it has hidden visibility and external linkage}}
inline const double disallowedGlobal5 = disallowedGlobal1++; // hidden-warning {{initialization of 'disallowedGlobal5' may run twice when built into a shared library: it has hidden visibility and external linkage}}

// OK because internal linkage, so duplication is intended
static float allowedGlobal1 = 3.14;
Expand Down Expand Up @@ -178,4 +178,4 @@ inline int allowedTemplate2 = 0;

template int allowedTemplate2<int>;

} // namespace TemplateTest
} // namespace TemplateTest