[PATCH] D74813: [RFC] Add hash of block contents to function block names
Alex Borcan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 22 00:30:01 PDT 2020
alexbdv updated this revision to Diff 259181.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74813/new/
https://reviews.llvm.org/D74813
Files:
clang/lib/AST/Mangle.cpp
llvm/include/llvm/Demangle/ItaniumDemangle.h
Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -5524,14 +5524,35 @@
Node *Encoding = getDerived().parseEncoding();
if (Encoding == nullptr || !consumeIf("_block_invoke"))
return nullptr;
- bool RequireNumber = consumeIf('_');
- if (parseNumber().empty() && RequireNumber)
- return nullptr;
+
+ OutputStream ParamOS;
+ if (!initializeOutputStream(nullptr, nullptr, ParamOS, 1024)) {
+ std::terminate();
+ }
+
+ while (consumeIf("_ZTS")) {
+ Node *paramType = getDerived().parseType();
+ ParamOS += ParamOS.empty() ? "(" : ", ";
+
+ paramType->print(ParamOS);
+ }
+ if (!ParamOS.empty()) {
+ ParamOS += ")";
+ }
+
if (look() == '.')
First = Last;
if (numLeft() != 0)
return nullptr;
- return make<SpecialName>("invocation function for block in ", Encoding);
+
+ OutputStream DescOS;
+ if (!initializeOutputStream(nullptr, nullptr, DescOS, 1024)) {
+ std::terminate();
+ }
+ DescOS += "invocation function for block with params '";
+ DescOS += ParamOS.getBuffer();
+ DescOS += "' in ";
+ return make<SpecialName>(DescOS.getBuffer(), Encoding);
}
Node *Ty = getDerived().parseType();
Index: clang/lib/AST/Mangle.cpp
===================================================================
--- clang/lib/AST/Mangle.cpp
+++ clang/lib/AST/Mangle.cpp
@@ -36,11 +36,14 @@
StringRef Outer,
const BlockDecl *BD,
raw_ostream &Out) {
- unsigned discriminator = Context.getBlockId(BD, true);
- if (discriminator == 0)
- Out << "__" << Outer << "_block_invoke";
- else
- Out << "__" << Outer << "_block_invoke_" << discriminator+1;
+ Out << "__" << Outer << "_block_invoke";
+
+ ArrayRef<ParmVarDecl *> params = BD->parameters();
+ for(unsigned i = 0; i < params.size(); i++) {
+ ParmVarDecl *param = params[i];
+ Context.mangleTypeName(param->getType(), Out);
+ }
+ llvm::raw_svector_ostream *Out2 = (llvm::raw_svector_ostream*)&Out;
}
void MangleContext::anchor() { }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74813.259181.patch
Type: text/x-patch
Size: 2282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200422/3cc350ac/attachment-0001.bin>
More information about the cfe-commits
mailing list