[clang] 16832eb - Guard against nullptr (#94084)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 31 17:54:27 PDT 2024


Author: Sterling-Augustine
Date: 2024-06-01T00:54:24Z
New Revision: 16832eb58563f77d917198ad9f86db1c2ee162c9

URL: https://github.com/llvm/llvm-project/commit/16832eb58563f77d917198ad9f86db1c2ee162c9
DIFF: https://github.com/llvm/llvm-project/commit/16832eb58563f77d917198ad9f86db1c2ee162c9.diff

LOG: Guard against nullptr (#94084)

Protect against nullptr after #93926

Added: 
    

Modified: 
    clang/lib/AST/QualTypeNames.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/QualTypeNames.cpp b/clang/lib/AST/QualTypeNames.cpp
index 066377423df76..18ac4b1eb57e7 100644
--- a/clang/lib/AST/QualTypeNames.cpp
+++ b/clang/lib/AST/QualTypeNames.cpp
@@ -65,8 +65,9 @@ static bool getFullyQualifiedTemplateName(const ASTContext &Ctx,
   assert(ArgTDecl != nullptr);
   QualifiedTemplateName *QTName = TName.getAsQualifiedTemplateName();
 
-  if (QTName && !QTName->hasTemplateKeyword()) {
-    NNS = QTName->getQualifier();
+  if (QTName &&
+      !QTName->hasTemplateKeyword() &&
+      (NNS = QTName->getQualifier())) {
     NestedNameSpecifier *QNNS = getFullyQualifiedNestedNameSpecifier(
         Ctx, NNS, WithGlobalNsPrefix);
     if (QNNS != NNS) {


        


More information about the cfe-commits mailing list