llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

<details>
<summary>Changes</summary>

Static analysis flagged that when calling ActOnTemplateName, S can be a nullptr
and we call isTemplateName which unconditionally dereferences the S argument at
some point. I added a nullptr check to assure we don't dereference S in
isTemplateName if it is a nullptr.


---
Full diff: https://github.com/llvm/llvm-project/pull/162377.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaTemplate.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 419f3e1ad30ed..3a6ff9910667d 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -318,7 +318,7 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
     }
   }
 
-  if (isPackProducingBuiltinTemplateName(Template) &&
+  if (isPackProducingBuiltinTemplateName(Template) && S &&
       S->getTemplateParamParent() == nullptr)
     Diag(Name.getBeginLoc(), diag::err_builtin_pack_outside_template) << TName;
   // Recover by returning the template, even though we would never be able to

``````````

</details>


https://github.com/llvm/llvm-project/pull/162377
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to