diff options
| author | Reid Kleckner <reid@kleckner.net> | 2013-05-08 13:44:39 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2013-05-08 13:44:39 +0000 |
| commit | 3190ca922d3743137e15fe0c525c04b177b9983b (patch) | |
| tree | 1b0564549889d86f89f05ac4107c0d08fbc843b8 /lib/CodeGen/CodeGenModule.h | |
| parent | b2f063aeb93670c2415825be457b9e518a9fefdf (diff) | |
| download | clang-3190ca922d3743137e15fe0c525c04b177b9983b.tar.gz clang-3190ca922d3743137e15fe0c525c04b177b9983b.tar.bz2 clang-3190ca922d3743137e15fe0c525c04b177b9983b.tar.xz | |
Forward #pragma comment(lib/linker) through as flags metadata
Summary:
Most of this change is wiring the pragma all the way through from the
lexer, parser, and sema to codegen. I considered adding a Decl AST node
for this, but it seemed too heavyweight.
Mach-O already uses a metadata flag called "Linker Options" to do this
kind of auto-linking. This change follows that pattern.
LLVM knows how to forward the "Linker Options" metadata into the COFF
.drectve section where these flags belong. ELF support is not
implemented, but possible.
This is related to auto-linking, which is http://llvm.org/PR13016.
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D723
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
| -rw-r--r-- | lib/CodeGen/CodeGenModule.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 91138c607c..1d6c7e98e5 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -355,6 +355,9 @@ class CodeGenModule : public CodeGenTypeCache { /// \brief The complete set of modules that has been imported. llvm::SetVector<clang::Module *> ImportedModules; + /// \brief A vector of metadata strings. + SmallVector<llvm::Value *, 16> LinkerOptionsMetadata; + /// @name Cache for Objective-C runtime types /// @{ @@ -906,6 +909,12 @@ public: void EmitVTable(CXXRecordDecl *Class, bool DefinitionRequired); + /// \brief Appends Opts to the "Linker Options" metadata value. + void AppendLinkerOptions(StringRef Opts); + + /// \brief Appends a dependent lib to the "Linker Options" metadata value. + void AddDependentLib(StringRef Lib); + llvm::GlobalVariable::LinkageTypes getFunctionLinkage(const FunctionDecl *FD); |
