llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/200394.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Compiler.cpp (+3) - (modified) clang/test/AST/ByteCode/invalid.cpp (+10) ``````````diff diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index f339d9a41ac2e..082345f1f1e16 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -7109,6 +7109,9 @@ static uint32_t getBitWidth(const Expr *E) { template <class Emitter> bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) { + if (E->containsErrors()) + return false; + const Expr *SubExpr = E->getSubExpr(); if (SubExpr->getType()->isAnyComplexType()) return this->VisitComplexUnaryOperator(E); diff --git a/clang/test/AST/ByteCode/invalid.cpp b/clang/test/AST/ByteCode/invalid.cpp index 9f157db889a22..9513645a74794 100644 --- a/clang/test/AST/ByteCode/invalid.cpp +++ b/clang/test/AST/ByteCode/invalid.cpp @@ -188,3 +188,13 @@ namespace InvalidCallExpr { return true; } } + +namespace InvalidUnaryOperator { + typedef struct {} S; + void foo() { + S *s = (S *)malloc(sizeof(*s)); // both-error {{use of undeclared identifier 'malloc'}} + S *&sref = s; + for (int i = 0; i < 2; sref++) + ; + } +} `````````` </details> https://github.com/llvm/llvm-project/pull/200394 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
