aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Support/IncludeFile.h
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-06-07 20:00:19 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-06-07 20:00:19 +0000
commit6df60a9effe4d20a48cfd9d105c0ab3c5dc3e690 (patch)
treed5e3f627411a59fbe751d3208a73c0ab053baee8 /include/llvm/Support/IncludeFile.h
parent19fd7ef7300616aa245e15e73b435c9bd0c83de3 (diff)
For PR780:
Break the "IncludeFile" mechanism into its own header file and adjust other files accordingly. Use this facility for the IntrinsicInst problem which was the subject of PR800. More to follow on this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28709 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/IncludeFile.h')
-rw-r--r--include/llvm/Support/IncludeFile.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/llvm/Support/IncludeFile.h b/include/llvm/Support/IncludeFile.h
new file mode 100644
index 0000000000..2e4f12dbbf
--- /dev/null
+++ b/include/llvm/Support/IncludeFile.h
@@ -0,0 +1,40 @@
+//===- llvm/Support/IncludeFile.h - Ensure Linking Of Library ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by Reid Spencer and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the IncludeFile class.
+//
+//===----------------------------------------------------------------------===//
+
+/// This class is used as a facility to make sure that the implementation of a
+/// header file is included into a tool that uses the header. This is solely
+/// to overcome problems linking .a files and not getting the implementation
+/// of compilation units we need. This is commonly an issue with the various
+/// Passes but also occurs elsewhere in LLVM. We like to use .a files because
+/// they link faster and provide the smallest executables. However, sometimes
+/// those executables are too small, if the program doesn't reference something
+/// that might be needed, especially by a loaded share object. This little class
+/// helps to resolve that problem. The basic strategy is to use this class in
+/// a header file and pass the address of a variable to the constructor. If the
+/// variable is defined in the header file's corresponding .cpp file then all
+/// tools/libraries that #include the header file will require the .cpp as well.
+/// For example:<br/>
+/// <tt>extern int LinkMyCodeStub;</tt><br/>
+/// <tt>static IncludeFile LinkMyModule(&LinkMyCodeStub);</tt><br/>
+/// @brief Class to ensure linking of corresponding object file.
+
+#ifndef LLVM_SUPPORT_INCLUDEFILE_H
+#define LLVM_SUPPORT_INCLUDEFILE_H
+
+namespace llvm {
+struct IncludeFile {
+ IncludeFile(void *);
+};
+}
+
+#endif