Committing now that D1416 landed.

================
Comment at: lib/CodeGen/CGDeclCXX.cpp:269
@@ +268,3 @@
+    llvm::raw_svector_ostream Out(FnName);
+    getCXXABI().getMangleContext().mangleDynamicInitializer(D, Out);
+  }
----------------
Timur Iskhodzhanov wrote:
> Interesting:
> I've seen a few instances of code like this:
> 
>   SmallString<256> FnName;
>   llvm::raw_svector_ostream Out(FnName);
>   getCXXABI().getMangleContext().mangleDynamicInitializer(D, Out);
>   Out.flush();
> 
> without the scope.
> Personally, I like your code more, but not sure what's the reason for the 
> "old" (?) way to get the mangled symbol.
> Is it just legacy?
I like this way is better because the stream is destroyed earlier and any 
temporary resources are freed.  I guess the old style persists because 
artificial scopes are weird.

================
Comment at: lib/AST/MicrosoftMangle.cpp:1975
@@ -1970,3 +1974,3 @@
   MicrosoftCXXNameMangler Mangler(*this, Out);
-  Mangler.getStream() << "\01??__F";
+  Mangler.getStream() << "\01??__" << CharCode;
   Mangler.mangleName(D);
----------------
Timur Iskhodzhanov wrote:
> Hm, I've seen a few snippets like this:
> 
>   MicrosoftCXXNameMangler Mangler(*this, Out);
>   ...
>   Out << ...;
>   ...
> 
> instead of
> 
>   MicrosoftCXXNameMangler Mangler(*this, Out);
>   ...
>   Mangler.getStream() << ...;
>   ...
> 
> Any ideas which one is better?
I don't know which is better.  FWIW Itanium standardizes on getStream().  
MS::mangleThunk() is the only outlier.


http://llvm-reviews.chandlerc.com/D1477
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to