[clang] 235390d - [NFC] Avoid potential dereferencing of nullptr.
Sindhu Chittireddy via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 31 08:34:03 PDT 2023
Author: Sindhu Chittireddy
Date: 2023-07-31T08:33:26-07:00
New Revision: 235390d930be41c32c71f877d90470fc83e2cb89
URL: https://github.com/llvm/llvm-project/commit/235390d930be41c32c71f877d90470fc83e2cb89
DIFF: https://github.com/llvm/llvm-project/commit/235390d930be41c32c71f877d90470fc83e2cb89.diff
LOG: [NFC] Avoid potential dereferencing of nullptr.
Differential Revision: https://reviews.llvm.org/D156274
Added:
Modified:
clang/lib/AST/ItaniumMangle.cpp
clang/lib/Sema/SemaCodeComplete.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index f08286a0d4baef..16f0d90451f7ad 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -1656,6 +1656,7 @@ void CXXNameMangler::mangleUnqualifiedName(
// Otherwise, use the complete destructor name. This is relevant if a
// class with a destructor is declared within a destructor.
mangleCXXDtorType(Dtor_Complete);
+ assert(ND);
writeAbiTags(ND, AdditionalAbiTags);
break;
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index b5d29b2e956c3d..476baad734f70e 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -6601,7 +6601,7 @@ void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
// The "template" keyword can follow "::" in the grammar, but only
// put it into the grammar if the nested-name-specifier is dependent.
// FIXME: results is always empty, this appears to be dead.
- if (!Results.empty() && NNS->isDependent())
+ if (!Results.empty() && NNS && NNS->isDependent())
Results.AddResult("template");
// If the scope is a concept-constrained type parameter, infer nested
More information about the cfe-commits
mailing list