clang
22.0.0git
lib
AST
ByteCode
FunctionPointer.cpp
Go to the documentation of this file.
1
//===----------------------- FunctionPointer.cpp ----------------*- 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
#include "
FunctionPointer.h
"
10
11
namespace
clang
{
12
namespace
interp {
13
14
APValue
FunctionPointer::toAPValue
(
const
ASTContext
&)
const
{
15
if
(!Func)
16
return
APValue
(
static_cast<
Expr
*
>
(
nullptr
),
CharUnits::Zero
(), {},
17
/*OnePastTheEnd=*/
false
,
/*IsNull=*/
true
);
18
19
if
(Func->
getDecl
())
20
return
APValue
(Func->
getDecl
(),
CharUnits::fromQuantity
(0), {},
21
/*OnePastTheEnd=*/
false
,
/*IsNull=*/
false
);
22
return
APValue
(Func->
getExpr
(),
CharUnits::fromQuantity
(0), {},
23
/*OnePastTheEnd=*/
false
,
/*IsNull=*/
false
);
24
}
25
26
void
FunctionPointer::print
(llvm::raw_ostream &OS)
const
{
27
OS <<
"FnPtr("
;
28
if
(Func)
29
OS << Func->
getName
();
30
else
31
OS <<
"nullptr"
;
32
OS <<
")"
;
33
}
34
35
}
// namespace interp
36
}
// namespace clang
FunctionPointer.h
clang::APValue
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition:
APValue.h:122
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition:
ASTContext.h:188
clang::CharUnits::fromQuantity
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition:
CharUnits.h:63
clang::CharUnits::Zero
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Definition:
CharUnits.h:53
clang::Expr
This represents one expression.
Definition:
Expr.h:112
clang::interp::FunctionPointer::print
void print(llvm::raw_ostream &OS) const
Definition:
FunctionPointer.cpp:26
clang::interp::FunctionPointer::toAPValue
APValue toAPValue(const ASTContext &) const
Definition:
FunctionPointer.cpp:14
clang::interp::Function::getName
std::string getName() const
Returns the name of the function decl this code was generated for.
Definition:
Function.h:118
clang::interp::Function::getExpr
const BlockExpr * getExpr() const
Definition:
Function.h:112
clang::interp::Function::getDecl
const FunctionDecl * getDecl() const
Returns the original FunctionDecl.
Definition:
Function.h:109
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition:
CalledOnceCheck.h:17
Generated on Tue Sep 2 2025 18:37:27 for clang by
1.9.6