[Lldb-commits] [PATCH] D69738: Fix handling for the clang name mangling extension for block invocations

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 5 10:01:17 PST 2019


shafik added inline comments.


================
Comment at: lldb/source/Core/Mangled.cpp:99
+
+  if (s.size() >= 2 && (s[0] == '_' && s[1] == 'Z'))
+    return Mangled::eManglingSchemeItanium;
----------------
aprantl wrote:
> jingham wrote:
> > StringRef has a startswith.  That might be easier to read.
> Agreed. There should be no performance penalty for using startswith over this in an optimized build.
Great catch!


================
Comment at: lldb/source/Core/Mangled.cpp:102
+
+  // ___Z is a clang extension of block invocations
+  if (s.size() >= 4 && s[0] == '_' && s[1] == '_' && s[2] == '_' && s[3] == 'Z')
----------------
aprantl wrote:
> Is `___Z` really only used for blocks or is it used for other clang extensions, too?
This is solely for block invocations.


================
Comment at: lldb/source/Core/Mangled.cpp:104
+  if (s.size() >= 4 && s[0] == '_' && s[1] == '_' && s[2] == '_' && s[3] == 'Z')
+    return Mangled::eManglingSchemeItanium;
+
----------------
aprantl wrote:
> Just FYI, this will create a merge conflict with swift-lldb. You might want to think about how to resolve it ahead of committing.
It does not look too bad.


================
Comment at: lldb/source/Core/Mangled.cpp:106
+
+  return Mangled::eManglingSchemeNone;
+}
----------------
aprantl wrote:
> You don't need to fix this all at once, but I think it would be even better if this function did something like
> ```
> for each language plugin { 
>   if (mangling_scheme = plugin.isMangledName(...)
>     ...
> }
> ```
> 
> I.e., the plugins should be the ones that know about the mangling details.
There is an old comment akin to that in `IsCPPMangledName`. I did not want to stray too far off into refactoring in this PR.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69738/new/

https://reviews.llvm.org/D69738





More information about the lldb-commits mailing list