[clang] [Clang] Reland: Diagnose invalid function types in dependent contexts (PR #139246)
via cfe-commits
cfe-commits at lists.llvm.org
Fri May 9 09:09:24 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang/lib/Sema/SemaExpr.cpp clang/test/SemaTemplate/fun-template-def.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 18930dee8..eed791c7c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6551,25 +6551,20 @@ ExprResult Sema::ActOnCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
}
// Any type that could be used to form a callable expression
-static bool MayBeFunctionType(const ASTContext &Context, const Expr* E) {
- QualType T = E->getType();
- if(T->isDependentType())
- return true;
+static bool MayBeFunctionType(const ASTContext &Context, const Expr *E) {
+ QualType T = E->getType();
+ if (T->isDependentType())
+ return true;
- if( T == Context.BoundMemberTy || T == Context.UnknownAnyTy ||
- T == Context.BuiltinFnTy || T == Context.OverloadTy ||
- T->isFunctionType() || T->isFunctionReferenceType() ||
- T->isMemberFunctionPointerType() || T->isFunctionPointerType() ||
- T->isBlockPointerType() || T->isRecordType())
- return true;
+ if (T == Context.BoundMemberTy || T == Context.UnknownAnyTy ||
+ T == Context.BuiltinFnTy || T == Context.OverloadTy ||
+ T->isFunctionType() || T->isFunctionReferenceType() ||
+ T->isMemberFunctionPointerType() || T->isFunctionPointerType() ||
+ T->isBlockPointerType() || T->isRecordType())
+ return true;
- return isa<CallExpr,
- DeclRefExpr,
- MemberExpr,
- CXXPseudoDestructorExpr,
- OverloadExpr,
- UnresolvedMemberExpr,
- UnaryOperator>(E);
+ return isa<CallExpr, DeclRefExpr, MemberExpr, CXXPseudoDestructorExpr,
+ OverloadExpr, UnresolvedMemberExpr, UnaryOperator>(E);
}
ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
``````````
</details>
https://github.com/llvm/llvm-project/pull/139246
More information about the cfe-commits
mailing list