[PATCH] D140598: [Clang] Add sanity check in Sema::getDestructorName to prevent nullptr dereference
Tom Honermann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 3 07:56:14 PST 2023
tahonermann added inline comments.
================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:393
// reasonably apply this fallback for dependent nested-name-specifiers.
- if (SS.getScopeRep()->getPrefix()) {
+ if (SS.isSet() && SS.getScopeRep()->getPrefix()) {
if (ParsedType T = LookupInScope()) {
----------------
`CXXScopeSpec::isSet()` is apparently (intended to be) deprecated.
```
clang/include/clang/Sema/DeclSpec.h:
209 /// Deprecated. Some call sites intend isNotEmpty() while others intend
210 /// isValid().
211 bool isSet() const { return getScopeRep() != nullptr; }
```
It sounds like this should instead call `.isValid()` or `.isNotEmpty()`, but I'm not sure which.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140598/new/
https://reviews.llvm.org/D140598
More information about the cfe-commits
mailing list