[clang] [Clang] Prevent null pointer dereference in Sema::CodeCompleteQualifiedId() (PR #90490)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 29 14:28:27 PDT 2024
================
@@ -6714,14 +6714,16 @@ void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
// If the scope is a concept-constrained type parameter, infer nested
// members based on the constraints.
- if (const auto *TTPT =
- dyn_cast_or_null<TemplateTypeParmType>(NNS->getAsType())) {
- for (const auto &R : ConceptInfo(*TTPT, S).members()) {
- if (R.Operator != ConceptInfo::Member::Colons)
- continue;
- Results.AddResult(CodeCompletionResult(
- R.render(*this, CodeCompleter->getAllocator(),
- CodeCompleter->getCodeCompletionTUInfo())));
+ if (NNS) {
----------------
shafik wrote:
This looks good, We can even seen above `NNS` is checked before access. This looks like an unfortunate oversight.
https://github.com/llvm/llvm-project/pull/90490
More information about the cfe-commits
mailing list