[clang][AST] createNestedNameSpecifierForScopeOf - don't use dyn_cast_or_null on never null DC argument
Fixes static analysis warning about later dereferencing the DC variable which might have been null (assumed due to dyn_cast_or_null) - getRedeclContext shouldn't ever return a null value so safe to use dyn_cast instead.
This commit is contained in:
parent
6a69cfb607
commit
35bfbb3b21
@ -270,8 +270,8 @@ static NestedNameSpecifier *createNestedNameSpecifierForScopeOf(
|
||||
assert(Decl);
|
||||
|
||||
const DeclContext *DC = Decl->getDeclContext()->getRedeclContext();
|
||||
const auto *Outer = dyn_cast_or_null<NamedDecl>(DC);
|
||||
const auto *OuterNS = dyn_cast_or_null<NamespaceDecl>(DC);
|
||||
const auto *Outer = dyn_cast<NamedDecl>(DC);
|
||||
const auto *OuterNS = dyn_cast<NamespaceDecl>(DC);
|
||||
if (Outer && !(OuterNS && OuterNS->isAnonymousNamespace())) {
|
||||
if (const auto *CxxDecl = dyn_cast<CXXRecordDecl>(DC)) {
|
||||
if (ClassTemplateDecl *ClassTempl =
|
||||
|
Loading…
x
Reference in New Issue
Block a user