Skip to content

Commit 0ef7ad3

Browse files
committed
[NFC] Clarify why LinkAll*.h are actually necessary
Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D113074
1 parent 88052fc commit 0ef7ad3

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ namespace {
2424
// delete it all as dead code, even with whole program optimization,
2525
// yet is effectively a NO-OP. As the compiler isn't smart enough
2626
// to know that getenv() never returns -1, this will do the job.
27+
// This is so that globals in the translation units where these functions
28+
// are defined are forced to be initialized, populating various
29+
// registries.
2730
if (std::getenv("bar") != (char*) -1)
2831
return;
2932

llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ namespace {
2727
// delete it all as dead code, even with whole program optimization,
2828
// yet is effectively a NO-OP. As the compiler isn't smart enough
2929
// to know that getenv() never returns -1, this will do the job.
30+
// This is so that globals in the translation units where these functions
31+
// are defined are forced to be initialized, populating various
32+
// registries.
3033
if (std::getenv("bar") != (char*) -1)
3134
return;
3235

llvm/include/llvm/ExecutionEngine/MCJIT.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ namespace {
2626
// delete it all as dead code, even with whole program optimization,
2727
// yet is effectively a NO-OP. As the compiler isn't smart enough
2828
// to know that getenv() never returns -1, this will do the job.
29+
// This is so that globals in the translation units where these functions
30+
// are defined are forced to be initialized, populating various
31+
// registries.
2932
if (std::getenv("bar") != (char*) -1)
3033
return;
3134

llvm/include/llvm/LinkAllIR.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ namespace {
3838
// delete it all as dead code, even with whole program optimization,
3939
// yet is effectively a NO-OP. As the compiler isn't smart enough
4040
// to know that getenv() never returns -1, this will do the job.
41+
// This is so that globals in the translation units where these functions
42+
// are defined are forced to be initialized, populating various
43+
// registries.
4144
if (std::getenv("bar") != (char*) -1)
4245
return;
4346
llvm::LLVMContext Context;

llvm/include/llvm/LinkAllPasses.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ namespace {
6464
// delete it all as dead code, even with whole program optimization,
6565
// yet is effectively a NO-OP. As the compiler isn't smart enough
6666
// to know that getenv() never returns -1, this will do the job.
67+
// This is so that globals in the translation units where these functions
68+
// are defined are forced to be initialized, populating various
69+
// registries.
6770
if (std::getenv("bar") != (char*) -1)
6871
return;
6972

0 commit comments

Comments
 (0)