[NFC] Clarify why LinkAll*.h are actually necessary
authorArthur Eubanks <aeubanks@google.com>
Wed, 3 Nov 2021 22:00:28 +0000 (15:00 -0700)
committerArthur Eubanks <aeubanks@google.com>
Wed, 3 Nov 2021 22:00:37 +0000 (15:00 -0700)
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D113074

llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
llvm/include/llvm/ExecutionEngine/MCJIT.h
llvm/include/llvm/LinkAllIR.h
llvm/include/llvm/LinkAllPasses.h

index 81b0025..c22f9d4 100644 (file)
@@ -24,6 +24,9 @@ namespace {
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;
 
index 1b13ff5..d615a5d 100644 (file)
@@ -27,6 +27,9 @@ namespace {
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;
 
index 8253bf9..adce98f 100644 (file)
@@ -26,6 +26,9 @@ namespace {
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;
 
index 4b0aabe..ceed784 100644 (file)
@@ -38,6 +38,9 @@ namespace {
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;
       llvm::LLVMContext Context;
index 4597882..c8b9aae 100644 (file)
@@ -64,6 +64,9 @@ namespace {
       // delete it all as dead code, even with whole program optimization,
       // yet is effectively a NO-OP. As the compiler isn't smart enough
       // to know that getenv() never returns -1, this will do the job.
+      // This is so that globals in the translation units where these functions
+      // are defined are forced to be initialized, populating various
+      // registries.
       if (std::getenv("bar") != (char*) -1)
         return;