llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

<details>
<summary>Changes</summary>

Static analysis flagged that we use IFaceT in HandleExprPropertyRefExpr without 
checking even though getInterfaceType() can return nullptr. The comments make 
it clear the assumption is that we will always have an interface, so we will 
document this via an assert.

Fixes: https://github.com/llvm/llvm-project/issues/134954

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


1 Files Affected:

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


``````````diff
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 18d9d38eee92f..1514ce4be0658 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -1980,6 +1980,7 @@ ExprResult SemaObjC::HandleExprPropertyRefExpr(
     SourceLocation SuperLoc, QualType SuperType, bool Super) {
   ASTContext &Context = getASTContext();
   const ObjCInterfaceType *IFaceT = OPT->getInterfaceType();
+  assert(IFaceT && "Expected an Interface");
   ObjCInterfaceDecl *IFace = IFaceT->getDecl();
 
   if (!MemberName.isIdentifier()) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/138026
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to