[llvm-commits] [poolalloc] r98060 - /poolalloc/trunk/include/LinkDSA.h

alenhar2 at llvm.org alenhar2 at llvm.org
Tue Mar 9 08:42:42 PST 2010


Author: alenhar2
Date: Tue Mar  9 10:42:42 2010
New Revision: 98060

URL: http://llvm.org/viewvc/llvm-project?rev=98060&view=rev
Log:
A file to pull to link dsa into a tool

Added:
    poolalloc/trunk/include/LinkDSA.h

Added: poolalloc/trunk/include/LinkDSA.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/LinkDSA.h?rev=98060&view=auto
==============================================================================
--- poolalloc/trunk/include/LinkDSA.h (added)
+++ poolalloc/trunk/include/LinkDSA.h Tue Mar  9 10:42:42 2010
@@ -0,0 +1,23 @@
+namespace {
+  struct ForceDSALinking {
+    ForceDSALinking() {
+      // We must reference the passes in such a way that compilers will not
+      // 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.
+      if (std::getenv("bar") != (char*) -1)
+        return;
+
+      (void)new llvm::BasicDataStructures();
+      (void)new llvm::LocalDataStructures();
+      (void)new llvm::StdLibDataStructures();
+      (void)new llvm::BUDataStructures();
+      (void)new llvm::CompleteBUDataStructures();
+      (void)new llvm::EquivBUDataStructures();
+      (void)new llvm::TDDataStructures();
+      (void)new llvm::EQTDDataStructures();
+      (void)new llvm::SteensgaardDataStructures();
+      (void)new llvm::RTAssociate();
+    }
+  } ForceDSALinking; // Force link by creating a global definition.
+}





More information about the llvm-commits mailing list