From 46e38f36785508dc6f90e642c68e4a72a493e8f5 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 8 Jun 2016 10:01:20 +0000 Subject: Avoid copies of std::strings and APInt/APFloats where we only read from it As suggested by clang-tidy's performance-unnecessary-copy-initialization. This can easily hit lifetime issues, so I audited every change and ran the tests under asan, which came back clean. llvm-svn: 272126 --- llvm/tools/lli/lli.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/tools/lli/lli.cpp') diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 28232478217..868fc16cd7f 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -254,7 +254,7 @@ public: ~LLIObjectCache() override {} void notifyObjectCompiled(const Module *M, MemoryBufferRef Obj) override { - const std::string ModuleID = M->getModuleIdentifier(); + const std::string &ModuleID = M->getModuleIdentifier(); std::string CacheName; if (!getCacheFilename(ModuleID, CacheName)) return; @@ -269,7 +269,7 @@ public: } std::unique_ptr getObject(const Module* M) override { - const std::string ModuleID = M->getModuleIdentifier(); + const std::string &ModuleID = M->getModuleIdentifier(); std::string CacheName; if (!getCacheFilename(ModuleID, CacheName)) return nullptr; -- cgit v1.2.3