-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang] Fix nondeterminism in MemberPointerType #137910
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 2 commits
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 | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -3602,6 +3602,10 @@ class MemberPointerType : public Type, public llvm::FoldingSetNode { | |||||||
} | ||||||||
|
||||||||
NestedNameSpecifier *getQualifier() const { return Qualifier; } | ||||||||
CXXRecordDecl *getCXXRecordDecl() const; | ||||||||
/// Note: this can trigger extra deserialization when external AST sources are | ||||||||
/// used. Prefer `getCXXRecordDecl()` unless you really need the most recent | ||||||||
/// decl. | ||||||||
CXXRecordDecl *getMostRecentCXXRecordDecl() const; | ||||||||
|
||||||||
bool isSugared() const; | ||||||||
|
@@ -3610,7 +3614,7 @@ class MemberPointerType : public Type, public llvm::FoldingSetNode { | |||||||
} | ||||||||
|
||||||||
void Profile(llvm::FoldingSetNodeID &ID) { | ||||||||
Profile(ID, getPointeeType(), getQualifier(), getMostRecentCXXRecordDecl()); | ||||||||
Profile(ID, getPointeeType(), getQualifier(), getCXXRecordDecl()); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the problem that we run this profile in the 'middle' of a TU and the most recent decl changes by the end? If so, this makes sense. That said, I'd expect this to be the above suggestion in case this member pointer type has a redeclaration that perhaps changes what the actual referenced decl is.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but this suggestion seems not needed because this llvm-project/clang/lib/AST/Type.cpp Line 5279 in e8ae779
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm... then I'm surprised that this patch is needed at all for the purposes of non-determinism. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue is transient - the reproducibility rate on the reproducer (https://pastebin.com/6aL6rmBe) is only 1%. Also it's not the pointer we have here that's problematic, but rather the fact of extra AST node loading inside the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
My theory is that non-determinism is caused by side-effects in the deserialization logic that runs behind It is not a new issue, just rare and now getting surfaced by the new place where |
||||||||
} | ||||||||
|
||||||||
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee, | ||||||||
|
Uh oh!
There was an error while loading. Please reload this page.