From 8a67f12a3d2ad1f49320c7eb509d8d83b892de53 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Thu, 6 Mar 2014 03:42:23 +0000 Subject: [Layering] Sink Linker.h into a Linker subdirectory to make it consistent with every other sub-library header in LLVM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203065 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/LTO/LTOCodeGenerator.h | 2 +- include/llvm/Linker.h | 61 ------------------------------------ include/llvm/Linker/Linker.h | 61 ++++++++++++++++++++++++++++++++++++ lib/LTO/LTOCodeGenerator.cpp | 2 +- lib/Linker/LinkModules.cpp | 2 +- tools/bugpoint/BugDriver.cpp | 2 +- tools/bugpoint/Miscompilation.cpp | 2 +- tools/llvm-link/llvm-link.cpp | 2 +- unittests/Linker/LinkModulesTest.cpp | 2 +- 9 files changed, 68 insertions(+), 68 deletions(-) delete mode 100644 include/llvm/Linker.h create mode 100644 include/llvm/Linker/Linker.h diff --git a/include/llvm/LTO/LTOCodeGenerator.h b/include/llvm/LTO/LTOCodeGenerator.h index 4836a51a7e..ee2b208891 100644 --- a/include/llvm/LTO/LTOCodeGenerator.h +++ b/include/llvm/LTO/LTOCodeGenerator.h @@ -39,7 +39,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringMap.h" -#include "llvm/Linker.h" +#include "llvm/Linker/Linker.h" #include "llvm/Target/TargetOptions.h" #include #include diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h deleted file mode 100644 index 67f6fc12c5..0000000000 --- a/include/llvm/Linker.h +++ /dev/null @@ -1,61 +0,0 @@ -//===- llvm/Linker.h - Module Linker Interface ------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_LINKER_H -#define LLVM_LINKER_H - -#include "llvm/ADT/SmallPtrSet.h" -#include - -namespace llvm { - -class Module; -class StringRef; -class StructType; - -/// This class provides the core functionality of linking in LLVM. It keeps a -/// pointer to the merged module so far. It doesn't take ownership of the -/// module since it is assumed that the user of this class will want to do -/// something with it after the linking. -class Linker { - public: - enum LinkerMode { - DestroySource = 0, // Allow source module to be destroyed. - PreserveSource = 1 // Preserve the source module. - }; - - Linker(Module *M, bool SuppressWarnings=false); - ~Linker(); - - Module *getModule() const { return Composite; } - void deleteModule(); - - /// \brief Link \p Src into the composite. The source is destroyed if - /// \p Mode is DestroySource and preserved if it is PreserveSource. - /// If \p ErrorMsg is not null, information about any error is written - /// to it. - /// Returns true on error. - bool linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg); - bool linkInModule(Module *Src, std::string *ErrorMsg) { - return linkInModule(Src, Linker::DestroySource, ErrorMsg); - } - - static bool LinkModules(Module *Dest, Module *Src, unsigned Mode, - std::string *ErrorMsg); - - private: - Module *Composite; - SmallPtrSet IdentifiedStructTypes; - - bool SuppressWarnings; -}; - -} // End llvm namespace - -#endif diff --git a/include/llvm/Linker/Linker.h b/include/llvm/Linker/Linker.h new file mode 100644 index 0000000000..42b2cb37b3 --- /dev/null +++ b/include/llvm/Linker/Linker.h @@ -0,0 +1,61 @@ +//===- Linker.h - Module Linker Interface -----------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LINKER_LINKER_H +#define LLVM_LINKER_LINKER_H + +#include "llvm/ADT/SmallPtrSet.h" +#include + +namespace llvm { + +class Module; +class StringRef; +class StructType; + +/// This class provides the core functionality of linking in LLVM. It keeps a +/// pointer to the merged module so far. It doesn't take ownership of the +/// module since it is assumed that the user of this class will want to do +/// something with it after the linking. +class Linker { + public: + enum LinkerMode { + DestroySource = 0, // Allow source module to be destroyed. + PreserveSource = 1 // Preserve the source module. + }; + + Linker(Module *M, bool SuppressWarnings=false); + ~Linker(); + + Module *getModule() const { return Composite; } + void deleteModule(); + + /// \brief Link \p Src into the composite. The source is destroyed if + /// \p Mode is DestroySource and preserved if it is PreserveSource. + /// If \p ErrorMsg is not null, information about any error is written + /// to it. + /// Returns true on error. + bool linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg); + bool linkInModule(Module *Src, std::string *ErrorMsg) { + return linkInModule(Src, Linker::DestroySource, ErrorMsg); + } + + static bool LinkModules(Module *Dest, Module *Src, unsigned Mode, + std::string *ErrorMsg); + + private: + Module *Composite; + SmallPtrSet IdentifiedStructTypes; + + bool SuppressWarnings; +}; + +} // End llvm namespace + +#endif diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp index d6ca41b8df..4e28c328ad 100644 --- a/lib/LTO/LTOCodeGenerator.cpp +++ b/lib/LTO/LTOCodeGenerator.cpp @@ -29,7 +29,7 @@ #include "llvm/IR/Verifier.h" #include "llvm/InitializePasses.h" #include "llvm/LTO/LTOModule.h" -#include "llvm/Linker.h" +#include "llvm/Linker/Linker.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/SubtargetFeature.h" diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index a0ce497dd4..c6476ce7b8 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Linker.h" +#include "llvm/Linker/Linker.h" #include "llvm-c/Linker.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SetVector.h" diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index a5436ba485..c23a7912c7 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -17,7 +17,7 @@ #include "ToolRunner.h" #include "llvm/IR/Module.h" #include "llvm/IRReader/IRReader.h" -#include "llvm/Linker.h" +#include "llvm/Linker/Linker.h" #include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index 069a32af0f..8aebe5ea83 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -21,7 +21,7 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/Module.h" #include "llvm/IR/Verifier.h" -#include "llvm/Linker.h" +#include "llvm/Linker/Linker.h" #include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index f1b32de04b..1449148287 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Linker.h" +#include "llvm/Linker/Linker.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" diff --git a/unittests/Linker/LinkModulesTest.cpp b/unittests/Linker/LinkModulesTest.cpp index 06c00a0504..ef3772d3a7 100644 --- a/unittests/Linker/LinkModulesTest.cpp +++ b/unittests/Linker/LinkModulesTest.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Linker.h" +#include "llvm/Linker/Linker.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Function.h" -- cgit v1.2.3