[llvm] r279892 - [ORC] Fix typo in LogicalDylib, add unit test.
Yung, Douglas via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 26 18:25:32 PDT 2016
Hi Lang,
Your checkin seems to have problems building with Visual Studio 2013. In my build I'm seeing the following errors for lines 24, 25 and 26:
LogicalDylibTest.cpp
C:\src\llvm\unittests\ExecutionEngine\Orc\LogicalDylibTest.cpp(24): error C2593: 'operator =' is ambiguous [C:\src\build\unittests\ExecutionEngine\Orc\OrcJITTests.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\set(180): could be 'std::set<std::string,std::less<_Kty>,std::allocator<_Ty>> &std::set<_Kty,std::less<_Ty>,std::allocator<_Ty>>::operator =(std::initializer_list<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>)'
with
[
_Kty=std::string
, _Ty=std::string
]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\set(139): or 'std::set<std::string,std::less<_Kty>,std::allocator<_Ty>> &std::set<_Kty,std::less<_Ty>,std::allocator<_Ty>>::operator =(std::set<_Kty,std::less<_Ty>,std::allocator<_Ty>> &&)'
with
[
_Kty=std::string
, _Ty=std::string
]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\set(123): or 'std::set<std::string,std::less<_Kty>,std::allocator<_Ty>> &std::set<_Kty,std::less<_Ty>,std::allocator<_Ty>>::operator =(const std::set<_Kty,std::less<_Ty>,std::allocator<_Ty>> &)'
with
[
_Kty=std::string
, _Ty=std::string
]
while trying to match the argument list '(std::set<std::string,std::less<_Kty>,std::allocator<_Ty>>, initializer-list)'
with
[
_Kty=std::string
, _Ty=std::string
]
Can you look into this?
Douglas Yung
> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On
> Behalf Of Lang Hames via llvm-commits
> Sent: Friday, August 26, 2016 17:19
> To: llvm-commits at lists.llvm.org
> Subject: [llvm] r279892 - [ORC] Fix typo in LogicalDylib, add unit
> test.
>
> Author: lhames
> Date: Fri Aug 26 19:19:05 2016
> New Revision: 279892
>
> URL: http://llvm.org/viewvc/llvm-project?rev=279892&view=rev
> Log:
> [ORC] Fix typo in LogicalDylib, add unit test.
>
> Added:
> llvm/trunk/unittests/ExecutionEngine/Orc/LogicalDylibTest.cpp
> Modified:
> llvm/trunk/include/llvm/ExecutionEngine/Orc/LogicalDylib.h
> llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt
>
> Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LogicalDylib.h
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LogicalDylib.h?rev=
> 279892&r1=279891&r2=279892&view=diff
> =======================================================================
> =======
> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/LogicalDylib.h
> (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LogicalDylib.h Fri Aug
> +++ 26 19:19:05 2016
> @@ -130,7 +130,7 @@ public:
> for (typename LogicalModuleList::size_type I = 0, E =
> LogicalModules.size();
> I != E; ++I)
> if (auto Sym = LogicalModules[I].Resources.findSymbol(Name,
> ExportedSymbolsOnly))
> - return &LogicalModules[I]->Resources;
> + return &LogicalModules[I].Resources;
> return nullptr;
> }
>
>
> Modified: llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt?rev=279
> 892&r1=279891&r2=279892&view=diff
> =======================================================================
> =======
> --- llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt (original)
> +++ llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt Fri Aug 26
> +++ 19:19:05 2016
> @@ -14,6 +14,7 @@ add_llvm_unittest(OrcJITTests
> IndirectionUtilsTest.cpp
> GlobalMappingLayerTest.cpp
> LazyEmittingLayerTest.cpp
> + LogicalDylibTest.cpp
> ObjectLinkingLayerTest.cpp
> ObjectTransformLayerTest.cpp
> OrcCAPITest.cpp
>
> Added: llvm/trunk/unittests/ExecutionEngine/Orc/LogicalDylibTest.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/unittests/ExecutionEngine/Orc/LogicalDylibTest.cpp?r
> ev=279892&view=auto
> =======================================================================
> =======
> --- llvm/trunk/unittests/ExecutionEngine/Orc/LogicalDylibTest.cpp
> (added)
> +++ llvm/trunk/unittests/ExecutionEngine/Orc/LogicalDylibTest.cpp Fri
> +++ Aug 26 19:19:05 2016
> @@ -0,0 +1,76 @@
> +//===----- CompileOnDemandLayerTest.cpp - Unit tests for the COD layer
> +----===// //
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open
> +Source // License. See LICENSE.TXT for details.
> +//
> +//===-----------------------------------------------------------------
> -
> +----===//
> +
> +#include "OrcTestCommon.h"
> +#include "llvm/ExecutionEngine/Orc/LogicalDylib.h"
> +#include "gtest/gtest.h"
> +
> +using namespace llvm;
> +using namespace llvm::orc;
> +
> +namespace {
> +
> +
> +TEST(LogicalDylibTest, getLogicalModuleResourcesForSymbol) {
> +
> + std::map<int, std::set<std::string>> ModuleSymbols;
> +
> + ModuleSymbols[0] = { "foo", "dummy" }; ModuleSymbols[1] = { "bar"
> };
> + ModuleSymbols[2] = { "baz", "dummy" };
> +
> + auto MockBaseLayer = createMockBaseLayer<int>(
> + DoNothingAndReturn<int>(0),
> + DoNothingAndReturn<void>(),
> + [&](const std::string &Name, bool) {
> + for (auto &S : ModuleSymbols)
> + if (S.second.count(Name))
> + return JITSymbol(1, JITSymbolFlags::Exported);
> + return JITSymbol(nullptr);
> + },
> + [&](int H, const std::string &Name, bool) {
> + if (ModuleSymbols[H].count(Name))
> + return JITSymbol(1, JITSymbolFlags::Exported);
> + return JITSymbol(nullptr);
> + });
> +
> + struct LDResources { };
> + struct LMResources {
> + public:
> + int ID;
> + std::set<std::string> *Symbols;
> +
> + LMResources() : ID(0), Symbols(nullptr) {}
> + LMResources(int ID, std::set<std::string> &Symbols)
> + : ID(ID), Symbols(&Symbols) {}
> +
> + JITSymbol findSymbol(const std::string &Name, bool) {
> + assert(Symbols);
> + if (Symbols->count(Name))
> + return JITSymbol(ID, JITSymbolFlags::Exported);
> + return JITSymbol(nullptr);
> + }
> + };
> +
> + LogicalDylib<decltype(MockBaseLayer), LMResources, LDResources>
> + LD(MockBaseLayer);
> +
> + // Add logical module resources for each of our dummy modules.
> + for (int I = 0; I < 3; ++I) {
> + auto H = LD.createLogicalModule();
> + LD.addToLogicalModule(H, I);
> + LD.getLogicalModuleResources(H) = LMResources(I,
> ModuleSymbols[I]);
> + }
> +
> + {
> + auto LMR = LD.getLogicalModuleResourcesForSymbol("bar", true);
> + EXPECT_TRUE(LMR->ID == 1) << "getLogicalModuleResourcesForSymbol
> +failed";
> + }
> +}
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list