From 91a6c365241a1452fe5b16e0c97e65fda7c5ef6b Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Mon, 22 Aug 2016 16:17:40 +0000 Subject: [PATCH] [LTO] Constify the Module Hook function (NFC) It use to be non-const for the sole purpose of custom handling of commons symbol. This is moved now in the regular LTO handling now and such we can constify the callback. llvm-svn: 279438 --- include/llvm/LTO/Config.h | 6 +++--- lib/LTO/LTOBackend.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/llvm/LTO/Config.h b/include/llvm/LTO/Config.h index e3d1fb2d860..ef65731a564 100644 --- a/include/llvm/LTO/Config.h +++ b/include/llvm/LTO/Config.h @@ -87,8 +87,8 @@ struct Config { /// A module hook may be used by a linker to perform actions during the LTO /// pipeline. For example, a linker may use this function to implement - /// -save-temps, or to add its own resolved symbols to the module. If this - /// function returns false, any further processing for that task is aborted. + /// -save-temps. If this function returns false, any further processing for + /// that task is aborted. /// /// Module hooks must be thread safe with respect to the linker's internal /// data structures. A module hook will never be called concurrently from @@ -96,7 +96,7 @@ struct Config { /// /// Note that in out-of-process backend scenarios, none of the hooks will be /// called for ThinLTO tasks. - typedef std::function ModuleHookFn; + typedef std::function ModuleHookFn; /// This module hook is called after linking (regular LTO) or loading /// (ThinLTO) the module, before modifying it. diff --git a/lib/LTO/LTOBackend.cpp b/lib/LTO/LTOBackend.cpp index a89364e46a0..732f35a56b2 100644 --- a/lib/LTO/LTOBackend.cpp +++ b/lib/LTO/LTOBackend.cpp @@ -47,7 +47,7 @@ Error Config::addSaveTemps(std::string OutputFileName, auto setHook = [&](std::string PathSuffix, ModuleHookFn &Hook) { // Keep track of the hook provided by the linker, which also needs to run. ModuleHookFn LinkerHook = Hook; - Hook = [=](unsigned Task, Module &M) { + Hook = [=](unsigned Task, const Module &M) { // If the linker's hook returned false, we need to pass that result // through. if (LinkerHook && !LinkerHook(Task, M))