mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-03 14:22:23 +00:00
[HIP][OpenMP] Fix assertion in deferred diag
Fix assertion in UsedDeclVisitor where clang is trying to look up a destructor for a forward declared class. Fixes: https://bugs.llvm.org/show_bug.cgi?id=52250 Reviewed by: Artem Belevich, John McCall Differential Revision: https://reviews.llvm.org/D112235
This commit is contained in:
parent
5c46986cc8
commit
a5435844f0
@ -72,7 +72,8 @@ public:
|
||||
QualType Destroyed = S.Context.getBaseElementType(DestroyedOrNull);
|
||||
if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
|
||||
CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
|
||||
asImpl().visitUsedDecl(E->getBeginLoc(), S.LookupDestructor(Record));
|
||||
if (Record->getDefinition())
|
||||
asImpl().visitUsedDecl(E->getBeginLoc(), S.LookupDestructor(Record));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
// RUN: -verify-ignore-unexpected=note \
|
||||
// RUN: -fopenmp -o - %s
|
||||
|
||||
// expected-no-diagnostics
|
||||
|
||||
// Test no infinite recursion in DeferredDiagnosticEmitter.
|
||||
constexpr int foo(int *x) {
|
||||
return 0;
|
||||
@ -37,3 +35,14 @@ public:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Test that deleting an incomplete class type doesn't cause an assertion.
|
||||
namespace TestDeleteIncompleteClassDefinition {
|
||||
struct a;
|
||||
struct b {
|
||||
b() {
|
||||
delete c; // expected-warning {{deleting pointer to incomplete type 'TestDeleteIncompleteClassDefinition::a' may cause undefined behavior}}
|
||||
}
|
||||
a *c;
|
||||
};
|
||||
} // namespace TestDeleteIncompleteClassDefinition
|
||||
|
Loading…
Reference in New Issue
Block a user