clang 24.0.0git
ExprUtils.h
Go to the documentation of this file.
1//===--- ExprUtils.h - Shared expression emission queries -------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file holds the AST queries about expressions that both classic CodeGen
10// and CIR CodeGen need while emitting scalar, aggregate and lvalue
11// expressions.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_CODEGENUTILS_EXPRUTILS_H
16#define LLVM_CLANG_CODEGENUTILS_EXPRUTILS_H
17
19
20namespace clang::CodeGenUtils {
21
22/// Strip off the variably-modified array types wrapping \p VLA and return the
23/// first element type that has a fixed size.
24QualType getFixedSizeElementType(const ASTContext &Ctx,
25 const VariableArrayType *VLA);
26
27/// Check whether the value of \p E is possibly a reference to or into a
28/// __block variable.
29bool isBlockVarRef(const Expr *E);
30
31/// Check whether \p E is cheap enough and side-effect-free enough to evaluate
32/// unconditionally instead of conditionally. This is used to convert control
33/// flow into selects in some cases.
35 const ASTContext &Ctx);
36
37/// Check whether \p E is a trivial array filler, that is, one that is
38/// equivalent to zero-initialization.
39bool isTrivialFiller(const Expr *E);
40
41/// Detect the unusual situation where an inline version of a builtin is
42/// shadowed by a non-inline version. In that case we should pick the external
43/// one everywhere. That's GCC behavior too.
44bool onlyHasInlineBuiltinDeclaration(const FunctionDecl *FD);
45
46} // namespace clang::CodeGenUtils
47
48#endif // LLVM_CLANG_CODEGENUTILS_EXPRUTILS_H
Defines the clang::ASTContext interface.
QualType getFixedSizeElementType(const ASTContext &Ctx, const VariableArrayType *VLA)
Strip off the variably-modified array types wrapping VLA and return the first element type that has a...
Definition ExprUtils.cpp:15
bool isTrivialFiller(const Expr *E)
Check whether E is a trivial array filler, that is, one that is equivalent to zero-initialization.
bool isCheapEnoughToEvaluateUnconditionally(const Expr *E, const ASTContext &Ctx)
Check whether E is cheap enough and side-effect-free enough to evaluate unconditionally instead of co...
Definition ExprUtils.cpp:87
bool isBlockVarRef(const Expr *E)
Check whether the value of E is possibly a reference to or into a __block variable.
Definition ExprUtils.cpp:24
bool onlyHasInlineBuiltinDeclaration(const FunctionDecl *FD)
Detect the unusual situation where an inline version of a builtin is shadowed by a non-inline version...