[PATCH] [ms-cxxabi] Mangle dynamic initializer stubs the same way MSVC does

Timur Iskhodzhanov timurrrr at google.com
Fri Aug 23 07:41:34 PDT 2013


  LGTM

  Two "reverse review" kind of questions below :P


================
Comment at: lib/CodeGen/CGDeclCXX.cpp:269
@@ +268,3 @@
+    llvm::raw_svector_ostream Out(FnName);
+    getCXXABI().getMangleContext().mangleDynamicInitializer(D, Out);
+  }
----------------
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?

================
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);
----------------
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?


http://llvm-reviews.chandlerc.com/D1477



More information about the cfe-commits mailing list