[PATCH] D148975: -fdebug-prefix-map=: make the last win when multiple prefixes match

Scott Linder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 14:27:33 PDT 2023


scott.linder added inline comments.


================
Comment at: clang/include/clang/Basic/CodeGenOptions.h:209
 
-  std::map<std::string, std::string> DebugPrefixMap;
+  llvm::SmallVector<std::pair<std::string, std::string>, 0> DebugPrefixMap;
   std::map<std::string, std::string> CoveragePrefixMap;
----------------
What benefit does forcing allocation have? Why not use the default, or switch to `std::vector`?


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:72-79
 CGDebugInfo::CGDebugInfo(CodeGenModule &CGM)
     : CGM(CGM), DebugKind(CGM.getCodeGenOpts().getDebugInfo()),
       DebugTypeExtRefs(CGM.getCodeGenOpts().DebugTypeExtRefs),
       DBuilder(CGM.getModule()) {
-  for (const auto &KV : CGM.getCodeGenOpts().DebugPrefixMap)
-    DebugPrefixMap[KV.first] = KV.second;
+  for (const auto &[From, To] : CGM.getCodeGenOpts().DebugPrefixMap)
+    DebugPrefixMap.emplace_back(From, To);
   CreateCompileUnit();
----------------
Can you use the member-initializer-list here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148975/new/

https://reviews.llvm.org/D148975



More information about the cfe-commits mailing list