-
Notifications
You must be signed in to change notification settings - Fork 15k
Use range-based for to iterate over fields in record layout, NFC #122029
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
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 |
|---|---|---|
|
|
@@ -3115,7 +3115,19 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> { | |
|
|
||
| /// Returns the index of this field within its record, | ||
| /// as appropriate for passing to ASTRecordLayout::getFieldOffset. | ||
| unsigned getFieldIndex() const; | ||
| unsigned getFieldIndex() const { | ||
| const FieldDecl *C = getCanonicalDecl(); | ||
| if (C->CachedFieldIndex == 0) | ||
|
||
| C->setCachedFieldIndex(); | ||
| assert(C->CachedFieldIndex); | ||
rnk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
rnk marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return C->CachedFieldIndex - 1; | ||
| } | ||
|
|
||
| private: | ||
| /// Set CachedFieldIndex to the index of this field plus one. | ||
| void setCachedFieldIndex() const; | ||
|
|
||
| public: | ||
|
|
||
| /// Determines whether this field is mutable (C++ only). | ||
| bool isMutable() const { return Mutable; } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.