mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-02 20:16:05 +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,9 +1277,8 @@ bool ThreadSafetyAnalyzer::inCurrentScope(const CapabilityExpr &CapE) {
|
||||
if (const auto *P = dyn_cast<til::Project>(SExp)) {
|
||||
if (!CurrentMethod)
|
||||
return false;
|
||||
const auto *VD = P->clangDecl();
|
||||
if (VD)
|
||||
return VD->getDeclContext() == CurrentMethod->getDeclContext();
|
||||
const ValueDecl *VD = P->clangDecl();
|
||||
return VD->getDeclContext() == CurrentMethod->getDeclContext();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -274,7 +274,7 @@ til::SExpr *SExprBuilder::translateDeclRefExpr(const DeclRefExpr *DRE,
|
||||
const auto *VD = cast<ValueDecl>(DRE->getDecl()->getCanonicalDecl());
|
||||
|
||||
// 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();
|
||||
const DeclContext *D = PV->getDeclContext();
|
||||
if (Ctx && Ctx->FunArgs) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user