-
Couldn't load subscription status.
- Fork 35
Fix: resolve nested attributes of anonymous records in GetDatamembers #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a801568
846796b
a2fd87e
e837ec6
34f0c4c
e8dd9a1
25cf88d
36f9aee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1128,9 +1128,33 @@ namespace Cpp { | |||||||||
|
|
||||||||||
| if (auto *CXXRD = llvm::dyn_cast_or_null<CXXRecordDecl>(D)) { | ||||||||||
| std::vector<TCppScope_t> datamembers; | ||||||||||
| for (auto it = CXXRD->field_begin(), end = CXXRD->field_end(); it != end; | ||||||||||
| it++) { | ||||||||||
| datamembers.push_back((TCppScope_t)*it); | ||||||||||
| llvm::SmallVector<RecordDecl::field_iterator, 2> stack_begin; | ||||||||||
| llvm::SmallVector<RecordDecl::field_iterator, 2> stack_end; | ||||||||||
| stack_begin.push_back(CXXRD->field_begin()); | ||||||||||
| stack_end.push_back(CXXRD->field_end()); | ||||||||||
| while (stack_begin.size()) { | ||||||||||
| if (stack_begin.back() == stack_end.back()) { | ||||||||||
| stack_begin.pop_back(); | ||||||||||
| stack_end.pop_back(); | ||||||||||
| continue; | ||||||||||
| } | ||||||||||
| Decl* D = *(stack_begin.back()); | ||||||||||
| if (D->getKind() == clang::Decl::Field && | ||||||||||
| dyn_cast<FieldDecl>(D)->isAnonymousStructOrUnion()) { | ||||||||||
Vipul-Cariappa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Vipul-Cariappa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||
| if (D->getKind() == clang::Decl::Field && | |
| dyn_cast<FieldDecl>(D)->isAnonymousStructOrUnion()) { | |
| if (isa<FieldDecl>(D) && | |
| cast<FieldDecl>(D)->isAnonymousStructOrUnion()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have a proper dyn_cast and isAnonymousStructOrUnion as a nested if...
Vipul-Cariappa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Vipul-Cariappa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Vipul-Cariappa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| C.getASTRecordLayout(RD).getFieldOffset(FD->getFieldIndex())) | |
| C.getFieldOffset(FD) |
Uh oh!
There was an error while loading. Please reload this page.