[clang] 9ac6a55 - [clang][AST] Assert that DependentNameType's Name and NNS are not null (#122418)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 14 20:06:54 PST 2025
Author: Nathan Ridge
Date: 2025-01-14T23:06:51-05:00
New Revision: 9ac6a55ec54fe4cd4a99c69ef1a4ddaea49e6688
URL: https://github.com/llvm/llvm-project/commit/9ac6a55ec54fe4cd4a99c69ef1a4ddaea49e6688
DIFF: https://github.com/llvm/llvm-project/commit/9ac6a55ec54fe4cd4a99c69ef1a4ddaea49e6688.diff
LOG: [clang][AST] Assert that DependentNameType's Name and NNS are not null (#122418)
Also clarify the comment above DependentNameType::getIdentifier()
Added:
Modified:
clang/include/clang/AST/Type.h
Removed:
################################################################################
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 78677df578c4bc..f0fbacccc97bb3 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -7040,17 +7040,17 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
: TypeWithKeyword(Keyword, DependentName, CanonType,
TypeDependence::DependentInstantiation |
toTypeDependence(NNS->getDependence())),
- NNS(NNS), Name(Name) {}
+ NNS(NNS), Name(Name) {
+ assert(NNS);
+ assert(Name);
+ }
public:
/// Retrieve the qualification on this type.
NestedNameSpecifier *getQualifier() const { return NNS; }
- /// Retrieve the type named by the typename specifier as an identifier.
- ///
- /// This routine will return a non-NULL identifier pointer when the
- /// form of the original typename was terminated by an identifier,
- /// e.g., "typename T::type".
+ /// Retrieve the identifier that terminates this type name.
+ /// For example, "type" in "typename T::type".
const IdentifierInfo *getIdentifier() const {
return Name;
}
More information about the cfe-commits
mailing list