clang 24.0.0git
FunctionUtils.h
Go to the documentation of this file.
1//===--- FunctionUtils.h - Shared function 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 queries and checks that both classic CodeGen and CIR
10// CodeGen need while emitting a function body.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_CODEGENUTILS_FUNCTIONUTILS_H
15#define LLVM_CLANG_CODEGENUTILS_FUNCTIONUTILS_H
16
20
21namespace clang {
22class ASTContext;
23class CallExpr;
25class FunctionDecl;
26} // namespace clang
27
28namespace clang::CodeGenUtils {
29
30/// Decide whether we need to emit the lifetime markers.
31bool shouldEmitLifetimeMarkers(const CodeGenOptions &CGOpts,
32 const LangOptions &LangOpts);
33
34/// Check that a call to a target-specific builtin has the required target
35/// features enabled in the caller, emitting an error diagnostic if not.
36/// \p Caller is the FunctionDecl of the enclosing function (may be null).
37void checkTargetFeatures(ASTContext &Ctx, DiagnosticsEngine &Diags,
38 const LangOptions &LangOpts, const CallExpr *E,
39 const FunctionDecl *Caller,
40 const FunctionDecl *TargetDecl);
41
42/// Overload taking a raw source location instead of a CallExpr.
43void checkTargetFeatures(ASTContext &Ctx, DiagnosticsEngine &Diags,
44 const LangOptions &LangOpts, SourceLocation Loc,
45 const FunctionDecl *Caller,
46 const FunctionDecl *TargetDecl);
47
48} // namespace clang::CodeGenUtils
49
50#endif // LLVM_CLANG_CODEGENUTILS_FUNCTIONUTILS_H
Defines the clang::LangOptions interface.
Defines the clang::SourceLocation class and associated facilities.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:245
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2991
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:241
Represents a function declaration or definition.
Definition Decl.h:2059
bool shouldEmitLifetimeMarkers(const CodeGenOptions &CGOpts, const LangOptions &LangOpts)
Decide whether we need to emit the lifetime markers.
void checkTargetFeatures(ASTContext &Ctx, DiagnosticsEngine &Diags, const LangOptions &LangOpts, const CallExpr *E, const FunctionDecl *Caller, const FunctionDecl *TargetDecl)
Check that a call to a target-specific builtin has the required target features enabled in the caller...
Top level wrappers for InstallAPI frontend operations.