1 //===- llvm/Support/IncludeFile.h - Ensure Linking Of Library ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the IncludeFile class.
12 //===----------------------------------------------------------------------===//
14 /// This class is used as a facility to make sure that the implementation of a
15 /// header file is included into a tool that uses the header. This is solely
16 /// to overcome problems linking .a files and not getting the implementation
17 /// of compilation units we need. This is commonly an issue with the various
18 /// Passes but also occurs elsewhere in LLVM. We like to use .a files because
19 /// they link faster and provide the smallest executables. However, sometimes
20 /// those executables are too small, if the program doesn't reference something
21 /// that might be needed, especially by a loaded share object. This little class
22 /// helps to resolve that problem. The basic strategy is to use this class in
23 /// a header file and pass the address of a variable to the constructor. If the
24 /// variable is defined in the header file's corresponding .cpp file then all
25 /// tools/libraries that #include the header file will require the .cpp as well.
27 /// <tt>extern int LinkMyCodeStub;</tt><br/>
28 /// <tt>static IncludeFile LinkMyModule(&LinkMyCodeStub);</tt><br/>
29 /// @brief Class to ensure linking of corresponding object file.
31 #ifndef LLVM_SUPPORT_INCLUDEFILE_H
32 #define LLVM_SUPPORT_INCLUDEFILE_H