[PATCH] Avoid extra back reference key lookup in msmangler

Agustín Bergé kaballo86 at hotmail.com
Sun Jun 15 11:53:50 PDT 2014


================
Comment at: lib/AST/MicrosoftMangle.cpp:615
@@ +614,3 @@
+    size_t Size = NameBackReferences.size();
+    BackRefMap::MapEntryTy &Entry =
+        NameBackReferences.GetOrCreateValue(Name, Size);
----------------
Timur Iskhodzhanov wrote:
> You probably want
> 
>   std::tie(I, Inserted) = NameBackReferences.insert(...)
> 
> See `MicrosoftCXXABI::getAddrOfVTable` as an example.
Indeed, the standard `insert` interface is what I would want. However, `StringMap` does not offer this interface, its `insert` member simply returns `bool`.

================
Comment at: lib/AST/MicrosoftMangle.cpp:694
@@ -673,1 +693,3 @@
+    llvm::SmallString<64> TemplateMangling;
+    llvm::raw_svector_ostream Stream(TemplateMangling);
     MicrosoftCXXNameMangler Extra(Context, Stream);
----------------
Timur Iskhodzhanov wrote:
> Am I right that you need `raw_svector_ostream` just to use `SmallString` instead of `string`?
That is correct.

http://reviews.llvm.org/D4130






More information about the cfe-commits mailing list