================
@@ -96,6 +96,31 @@ class Expression {
                                  ///invalid.
 };
 
+/// Holds parsed information about a function call label that
+/// LLDB attaches as an AsmLabel to function AST nodes it parses
+/// from debug-info.
+///
+/// The format being:
+///
+///   <prefix>:<mangled name>:<module id>:<DIE id>
+///
+/// The label string needs to stay valid for the entire lifetime
+/// of this object.
+struct FunctionCallLabel {
+  llvm::StringRef m_lookup_name;
+  lldb::user_id_t m_module_id;
+
+  /// Mostly for debuggability.
+  lldb::user_id_t m_die_id;
+};
+
+/// LLDB attaches this prefix to mangled names of functions that it get called
+/// from JITted expressions.
+inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func";
+
+bool consumeFunctionCallLabelPrefix(llvm::StringRef &name);
----------------
Michael137 wrote:

> That said, we might be able to use the llvm \01 mangling escape prefix to 
> avoid this difference. Clang seems to do that automatically:

Good point. LLDB disabled the mangling prefix in:
```
commit f6bc251274f39dee5d09f668a56922c88bd027d8
Author: Vedant Kumar <v...@apple.com>
Date:   Wed Sep 25 18:00:31 2019 +0000

    [Mangle] Add flag to asm labels to disable '\01' prefixing
    
    LLDB synthesizes decls using asm labels. These decls cannot have a mangle
    different than the one specified in the label name. I.e., the '\01' prefix
    should not be added.
    
    Fixes an expression evaluation failure in lldb's TestVirtual.py on iOS.
```

But that wouldn't apply with this patch anymore since we're doing the handling 
of the AsmLabel ourselves.

Didn't realize that the `\01` prevents the global mangling prefix to get added 
into the IR names.

I'll go with this approach. Then we don't need these APIs either

https://github.com/llvm/llvm-project/pull/148877
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to