[PATCH] D34523: AST: mangle BlockDecls under MS ABI

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 12:35:05 PDT 2017

efriedma added inline comments.

Comment at: lib/AST/MicrosoftMangle.cpp:988
+      if (const auto *RD = dyn_cast<RecordDecl>(DC))
+        mangleName(RD);
+      else
The call to mangleName() looks a little weird... I would have expected a call to mangleUnqualifiedName or something like that.  (If there's some reason for the asymmetry, a brief comment explaining it would be fine.)

Comment at: lib/AST/MicrosoftMangle.cpp:1008
+        if (const auto *ND = dyn_cast<NamedDecl>(MC))
+          mangleUnqualifiedName(ND);
This isn't quite the same thing the Itanium mangling does... 

Itanium has special cases for in-class initializers and default arguments.  Using the name is fine for in-class initalizers, but it doesn't really work for default arguments: arguments aren't required to have names.  Consider, for example:

extern int e(void);
class C {
  void m(int = ^{ static int i = e(); return ++i; }(),
         int = ^{ static int i = e(); return ++i; }());

Comment at: test/CodeGenCXX/msabi-blocks.cpp:90
The Itanium ABI document lists five cases where the mangling is externally visible.  I think this is missing a testcase for the "initializers of nonspecialized static members of template classes" case.  (Something like "template<typename T> class X { static T foo; }; template<typename T> T X<T>::foo = ^{static int i = e(); return ++i;}();".)



More information about the cfe-commits mailing list