================
@@ -53,24 +53,27 @@ Error SpecialCaseList::Matcher::insert(StringRef Pattern,
unsigned LineNumber,
return Error::success();
}
- auto [It, DidEmplace] = Globs.try_emplace(Pattern);
- if (DidEmplace) {
- // We must be sure to use the string in the map rather than the provided
- // reference which could be destroyed before match() is called
- Pattern = It->getKey();
- auto &Pair = It->getValue();
- if (auto Err = GlobPattern::create(Pattern, /*MaxSubPatterns=*/1024)
- .moveInto(Pair.first))
- return Err;
- Pair.second = LineNumber;
- }
+ Globs.emplace_back();
+ auto &Glob = Globs.back();
+ Glob.first = Pattern.str();
+ auto &Pair = Glob.second;
+ // We must be sure to use the string in the map rather than the provided
+ // reference which could be destroyed before match() is called
+ llvm::errs() << __func__ << " GlobPattern::create: " << Glob.first << "\n";
+ if (auto Err = GlobPattern::create(Glob.first, /*MaxSubPatterns=*/1024)
----------------
vitalybuka wrote:
Here you create with StringRef into std::string .first
std::string movable, but contains short string optimization.
When emplace_back need to resize, string will move itself into different loc.
https://github.com/llvm/llvm-project/pull/140964
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits