[llvm] r279438 - [LTO] Constify the Module Hook function (NFC)
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 22 09:17:41 PDT 2016
Author: mehdi_amini
Date: Mon Aug 22 11:17:40 2016
New Revision: 279438
URL: http://llvm.org/viewvc/llvm-project?rev=279438&view=rev
Log:
[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.
Modified:
llvm/trunk/include/llvm/LTO/Config.h
llvm/trunk/lib/LTO/LTOBackend.cpp
Modified: llvm/trunk/include/llvm/LTO/Config.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/Config.h?rev=279438&r1=279437&r2=279438&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LTO/Config.h (original)
+++ llvm/trunk/include/llvm/LTO/Config.h Mon Aug 22 11:17:40 2016
@@ -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<bool(unsigned Task, Module &)> ModuleHookFn;
+ typedef std::function<bool(unsigned Task, const Module &)> ModuleHookFn;
/// This module hook is called after linking (regular LTO) or loading
/// (ThinLTO) the module, before modifying it.
Modified: llvm/trunk/lib/LTO/LTOBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOBackend.cpp?rev=279438&r1=279437&r2=279438&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOBackend.cpp (original)
+++ llvm/trunk/lib/LTO/LTOBackend.cpp Mon Aug 22 11:17:40 2016
@@ -47,7 +47,7 @@ Error Config::addSaveTemps(std::string O
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))
More information about the llvm-commits
mailing list