diff options
Diffstat (limited to 'include/llvm/Support')
-rw-r--r-- | include/llvm/Support/Dwarf.h | 4 | ||||
-rw-r--r-- | include/llvm/Support/IncludeFile.h | 65 | ||||
-rw-r--r-- | include/llvm/Support/Mangler.h | 2 | ||||
-rw-r--r-- | include/llvm/Support/MathExtras.h | 4 | ||||
-rw-r--r-- | include/llvm/Support/SlowOperationInformer.h | 3 |
5 files changed, 12 insertions, 66 deletions
diff --git a/include/llvm/Support/Dwarf.h b/include/llvm/Support/Dwarf.h index 17622f4515..05260be2d7 100644 --- a/include/llvm/Support/Dwarf.h +++ b/include/llvm/Support/Dwarf.h @@ -16,6 +16,8 @@ #ifndef LLVM_SUPPORT_DWARF_H #define LLVM_SUPPORT_DWARF_H +#include "llvm/System/IncludeFile.h" + namespace llvm { namespace dwarf { @@ -546,4 +548,6 @@ const char *CallFrameString(unsigned Encoding); } // End of namespace llvm +FORCE_DEFINING_FILE_TO_BE_LINKED(SupportDwarf) + #endif diff --git a/include/llvm/Support/IncludeFile.h b/include/llvm/Support/IncludeFile.h deleted file mode 100644 index 798c6b454f..0000000000 --- a/include/llvm/Support/IncludeFile.h +++ /dev/null @@ -1,65 +0,0 @@ -//===- 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 FORCE_DEFINING_FILE_TO_BE_LINKED and DEFINE_FILE_FOR -// macros. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_INCLUDEFILE_H -#define LLVM_SUPPORT_INCLUDEFILE_H - -/// This macro is the public interface that IncludeFile.h exports. This gives -/// us the option to implement the "link the definition" capability in any -/// manner that we choose. All header files that depend on a specific .cpp -/// file being linked at run time should use this macro instead of the -/// IncludeFile class directly. -/// -/// For example, foo.h would use:<br/> -/// <tt>FORCE_DEFINING_FILE_TO_BE_LINKED(foo)</tt><br/> -/// -/// And, foo.cp would use:<br/> -/// <tt>DEFINING_FILE_FOR(foo)</tt><br/> -#define FORCE_DEFINING_FILE_TO_BE_LINKED(name) \ - namespace llvm { \ - extern char name ## LinkVar; \ - static IncludeFile name ## LinkObj ( &name ## LinkVar ); \ - } - -/// This macro is the counterpart to FORCE_DEFINING_FILE_TO_BE_LINKED. It should -/// be used in a .cpp file to define the name referenced in a header file that -/// will cause linkage of the .cpp file. It should only be used at extern level. -#define DEFINING_FILE_FOR(name) namespace llvm { char name ## LinkVar; } - -namespace llvm { - -/// This class is used in the implementation of FORCE_DEFINING_FILE_TO_BE_LINKED -/// macro 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. -struct IncludeFile { - IncludeFile(void *); -}; - -} - -#endif diff --git a/include/llvm/Support/Mangler.h b/include/llvm/Support/Mangler.h index 50e49ff8a5..ac7deadf8b 100644 --- a/include/llvm/Support/Mangler.h +++ b/include/llvm/Support/Mangler.h @@ -14,7 +14,7 @@ #ifndef LLVM_SUPPORT_MANGLER_H #define LLVM_SUPPORT_MANGLER_H -#include "llvm/Support/IncludeFile.h" +#include "llvm/System/IncludeFile.h" #include <map> #include <set> #include <string> diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index 0f5961ff73..228d35ceff 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -15,6 +15,7 @@ #define LLVM_SUPPORT_MATHEXTRAS_H #include "llvm/Support/DataTypes.h" +#include "llvm/System/IncludeFile.h" namespace llvm { @@ -306,4 +307,7 @@ int IsInf (double d); } // End llvm namespace +FORCE_DEFINING_FILE_TO_BE_LINKED(SupportIsInf) +FORCE_DEFINING_FILE_TO_BE_LINKED(SupportIsNAN) + #endif diff --git a/include/llvm/Support/SlowOperationInformer.h b/include/llvm/Support/SlowOperationInformer.h index d05792672a..0be01960ca 100644 --- a/include/llvm/Support/SlowOperationInformer.h +++ b/include/llvm/Support/SlowOperationInformer.h @@ -32,6 +32,7 @@ #include <string> #include <cassert> #include "llvm/Support/DataTypes.h" +#include "llvm/System/IncludeFile.h" namespace llvm { class SlowOperationInformer { @@ -63,3 +64,5 @@ namespace llvm { } // end namespace llvm #endif /* SLOW_OPERATION_INFORMER_H */ + +FORCE_DEFINING_FILE_TO_BE_LINKED(SupportSlowOperationInformer) |