[llvm] 156b1e6 - Explicitly convert StringRef to std::string for compatibility with libstdc++ 5.4.0

Dmitri Gribenko via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 03:50:58 PST 2021


Author: Dmitri Gribenko
Date: 2021-12-15T12:48:53+01:00
New Revision: 156b1e6ba84887ba92688b3ad31e400c56f707b2

URL: https://github.com/llvm/llvm-project/commit/156b1e6ba84887ba92688b3ad31e400c56f707b2
DIFF: https://github.com/llvm/llvm-project/commit/156b1e6ba84887ba92688b3ad31e400c56f707b2.diff

LOG: Explicitly convert StringRef to std::string for compatibility with libstdc++ 5.4.0

For some reason, the user-defined implicit conversion from StringRef to
std::string is not invoked by std::map::emplace in libstdc++ 5.4.0, even
though it works fine on modern systems.

Added: 
    

Modified: 
    llvm/lib/ProfileData/SampleProf.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp
index 7f8ccca07cea1..9b01a386a360a 100644
--- a/llvm/lib/ProfileData/SampleProf.cpp
+++ b/llvm/lib/ProfileData/SampleProf.cpp
@@ -521,7 +521,7 @@ void CSProfileConverter::convertProfiles(CSProfileConverter::FrameNode &Node) {
     if (NodeProfile) {
       // Add child profile to the callsite profile map.
       auto &SamplesMap = NodeProfile->functionSamplesAt(ChildNode.CallSiteLoc);
-      SamplesMap.emplace(OrigChildContext.getName(), *ChildProfile);
+      SamplesMap.emplace(OrigChildContext.getName().str(), *ChildProfile);
       NodeProfile->addTotalSamples(ChildProfile->getTotalSamples());
     }
 


        


More information about the llvm-commits mailing list