This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Remove access check of decl in TypeSystemClang.cpp
AbandonedPublic

Authored by zequanwu on Nov 9 2021, 6:01 PM.

Details

Summary

As the deleted comment says, we don't care about the access specifier.
I also encountered a crash at here (called from https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp#L2141) when fixing a bug on SymbolFileNativePDB.cpp.

Diff Detail

Event Timeline

zequanwu requested review of this revision.Nov 9 2021, 6:01 PM
zequanwu created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2021, 6:01 PM
shafik added inline comments.Nov 9 2021, 9:32 PM
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
95

No, we don't care about the return value but we care about the assert which means the AST node is not well formed. In this case IIRC we are verifying that a member has an access specifier that is not set to AS_none.

teemperor requested changes to this revision.Nov 10 2021, 1:00 AM
teemperor added a subscriber: teemperor.

I'm pretty sure you're trying to solve the same problem as here: D85993

In short: You're calling CreateFunctionDeclaration to create a function in a record, but you actually want to call AddMethodToCXXRecordType which allows passing and setting an access specifier (which is what the assert here checks). You can fix this in the PDB plugin by looking at the DeclContext and if decl_ctx->isRecord() -> AddMethodToCXXRecordType and otherwise CreateFunctionDeclaration.

This revision now requires changes to proceed.Nov 10 2021, 1:00 AM
zequanwu abandoned this revision.Nov 15 2021, 12:26 PM

D113930 is the correct fix for that.