[lldb-dev] ClangASTContext::AddMethodToObjCObjectType constructs ParmVarDecl without identifier

Nat! via lldb-dev lldb-dev at lists.llvm.org
Mon Jul 23 05:14:21 PDT 2018


Hi

So my real main problem is that I want to run an expression to output 
the value of an Objective-C parameter. e.g. `- (void) foo:(id) a`. I 
want to print `a` when I am stopped in `foo`.

This isn't working for me - technically, I believe - because, in 
`ClangASTContext::AddMethodToObjCObjectType` the name of the parameter 
is omitted in the ParmVarDecl, specifically commented as "anonymous"

```
params.push_back(clang::ParmVarDecl::Create(
           *ast, objc_method_decl, clang::SourceLocation(),
           clang::SourceLocation(),
           nullptr, // anonymous
           method_function_prototype->getParamType(param_index), nullptr,
           clang::SC_Auto, nullptr));
```

I don't really see, how and when this information is added at a later 
stage, but I assune it is somehow. (Not by my ObjC Runtime plugin though)

What I find curious is that the names of the ParmVarDecls have already 
been determined in `DWARFFastParserClang::ParseChildParameters` and are 
saved into `function_param_decls`. That is just ahead of the only call 
to `AddMethodToObjCObjectType` in lldb. But that information isn't 
passed. Is there a reason why not ?

Ciao
    Nat!


More information about the lldb-dev mailing list