[llvm] r251347 - Fix build failure on GCC 4.7 (old libstdc++ doesn't have std::map::emplace).

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 14:28:15 PDT 2015


On Mon, Oct 26, 2015 at 2:20 PM, Alexey Samsonov via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: samsonov
> Date: Mon Oct 26 16:20:37 2015
> New Revision: 251347
>
> URL: http://llvm.org/viewvc/llvm-project?rev=251347&view=rev
> Log:
> Fix build failure on GCC 4.7 (old libstdc++ doesn't have
> std::map::emplace).
>
> Modified:
>     llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp
>
> Modified: llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp?rev=251347&r1=251346&r2=251347&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp Mon Oct 26 16:20:37
> 2015
> @@ -530,7 +530,8 @@ LLVMSymbolizer::getOrCreateModuleInfo(co
>
>    if (!Objects.first) {
>      // Failed to find valid object file.
> -    Modules.insert(make_pair(ModuleName, nullptr));
> +    Modules.insert(
> +        std::make_pair(ModuleName, std::unique_ptr<ModuleInfo>(nullptr)));
>

Any idea if/why this change was necessary ^? (why the need for the std::
qualifier (I guess nullptr is of type std::nullptr_t, so ADL should find
make_pair) and the explicit std::unique_ptr construction (std::pair<T,
nullptr> should be implicitly convertible to std::pair<T,
std::unique_ptr<U>> I think... ))


>      return nullptr;
>    }
>    std::unique_ptr<DIContext> Context;
> @@ -549,7 +550,7 @@ LLVMSymbolizer::getOrCreateModuleInfo(co
>    assert(Context);
>    auto Info = llvm::make_unique<ModuleInfo>(Objects.first,
> std::move(Context));
>    ModuleInfo *Res = Info.get();
> -  Modules.emplace(ModuleName, std::move(Info));
> +  Modules.insert(std::make_pair(ModuleName, std::move(Info)));
>    return Res;
>  }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151026/2026930e/attachment.html>


More information about the llvm-commits mailing list