mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-05 15:26:07 +00:00
Thread safety analysis: ValueDecl in Project is non-null
The constructor asserts that, use it in the ThreadSafetyAnalyzer. Also note that the result of a cast<> cannot be null.
This commit is contained in:
parent
9dcc82f34e
commit
b2ce79ef66
@ -1277,8 +1277,7 @@ bool ThreadSafetyAnalyzer::inCurrentScope(const CapabilityExpr &CapE) {
|
|||||||
if (const auto *P = dyn_cast<til::Project>(SExp)) {
|
if (const auto *P = dyn_cast<til::Project>(SExp)) {
|
||||||
if (!CurrentMethod)
|
if (!CurrentMethod)
|
||||||
return false;
|
return false;
|
||||||
const auto *VD = P->clangDecl();
|
const ValueDecl *VD = P->clangDecl();
|
||||||
if (VD)
|
|
||||||
return VD->getDeclContext() == CurrentMethod->getDeclContext();
|
return VD->getDeclContext() == CurrentMethod->getDeclContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ til::SExpr *SExprBuilder::translateDeclRefExpr(const DeclRefExpr *DRE,
|
|||||||
const auto *VD = cast<ValueDecl>(DRE->getDecl()->getCanonicalDecl());
|
const auto *VD = cast<ValueDecl>(DRE->getDecl()->getCanonicalDecl());
|
||||||
|
|
||||||
// Function parameters require substitution and/or renaming.
|
// Function parameters require substitution and/or renaming.
|
||||||
if (const auto *PV = dyn_cast_or_null<ParmVarDecl>(VD)) {
|
if (const auto *PV = dyn_cast<ParmVarDecl>(VD)) {
|
||||||
unsigned I = PV->getFunctionScopeIndex();
|
unsigned I = PV->getFunctionScopeIndex();
|
||||||
const DeclContext *D = PV->getDeclContext();
|
const DeclContext *D = PV->getDeclContext();
|
||||||
if (Ctx && Ctx->FunArgs) {
|
if (Ctx && Ctx->FunArgs) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user