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

David Majnemer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 25 17:32:37 PDT 2017


majnemer added a comment.

We need tests that show that it does the right thing in blocks defined in classes in classes and other nested concepts.



================
Comment at: lib/AST/MicrosoftMangle.cpp:980-981
+      unsigned Discriminator = BD->getBlockManglingNumber();
+      if (!Discriminator)
+        Discriminator = Context.getBlockId(BD, /*Local=*/false);
+
----------------
Why isn't it local?


================
Comment at: lib/AST/MicrosoftMangle.cpp:991-992
+        Out << '@';
+      // void __cdecl
+      Out << "YAX";
+      // struct __block_literal *
----------------
Can blocks not be given a specific calling convention?


================
Comment at: lib/AST/MicrosoftMangle.cpp:993-994
+      Out << "YAX";
+      // struct __block_literal *
+      Out << "PA";
+      mangleArtificalTagType(TTK_Struct,
----------------
Shouldn't we also mangle an 'E' in here on 64-bit platforms?


================
Comment at: lib/AST/MicrosoftMangle.cpp:999-1001
+      if (const auto *MC = BD->getBlockManglingContextDecl())
+        if (const auto *ND = dyn_cast<NamedDecl>(MC))
+          mangleUnqualifiedName(ND);
----------------
This logic should be explained.


================
Comment at: lib/AST/MicrosoftMangle.cpp:1003-1005
+      if (isa<RecordDecl>(DC))
+        break;
+      continue;
----------------
This logic should be explained.


Repository:
  rL LLVM

https://reviews.llvm.org/D34523





More information about the cfe-commits mailing list