clang
24.0.0git
lib
AST
ByteCode
Reflect.h
Go to the documentation of this file.
1
//===--- Reflect.h - Reflection type for the constexpr VM -------*- 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
#ifndef LLVM_CLANG_AST_INTERP_REFLECT_H
10
#define LLVM_CLANG_AST_INTERP_REFLECT_H
11
12
#include "
clang/AST/APValue.h
"
13
#include "
clang/AST/ComparisonCategories.h
"
14
#include "
clang/AST/Reflection.h
"
15
#include "llvm/ADT/APSInt.h"
16
#include "llvm/Support/MathExtras.h"
17
#include "llvm/Support/raw_ostream.h"
18
#include <cstddef>
19
#include <cstdint>
20
21
namespace
clang
{
22
namespace
interp
{
23
24
class
Reflect
final {
25
private
:
26
ReflectionKind
Kind;
27
const
void
*Operand;
28
29
public
:
30
Reflect
() : Kind(
ReflectionKind
::
Null
), Operand(
nullptr
) {}
31
Reflect
(
ReflectionKind
Kind,
const
void
*Operand)
32
: Kind(Kind), Operand(Operand) {}
33
34
ComparisonCategoryResult
compare
(
const
Reflect
&RHS)
const
{
35
llvm::FoldingSetNodeID LID, RID;
36
APValue
(Kind, Operand).Profile(LID);
37
APValue
(RHS.Kind, RHS.Operand).Profile(RID);
38
39
if
(LID == RID)
40
return
ComparisonCategoryResult::Equal
;
41
return
ComparisonCategoryResult::Unordered
;
42
}
43
44
void
print
(llvm::raw_ostream &OS)
const
{
45
OS <<
"Reflect("
<< Kind <<
", "
<< Operand <<
")"
;
46
}
47
APValue
toAPValue
(
const
ASTContext
&Ctx)
const
{
48
return
APValue
(Kind, Operand);
49
}
50
};
51
52
inline
llvm::raw_ostream &
operator<<
(llvm::raw_ostream &OS,
const
Reflect
&R) {
53
R.print(OS);
54
return
OS;
55
}
56
57
}
// namespace interp
58
}
// namespace clang
59
60
#endif
APValue.h
ComparisonCategories.h
Reflection.h
clang::APValue
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition
APValue.h:124
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition
ASTContext.h:239
clang::interp::Reflect
Definition
Reflect.h:24
clang::interp::Reflect::toAPValue
APValue toAPValue(const ASTContext &Ctx) const
Definition
Reflect.h:47
clang::interp::Reflect::compare
ComparisonCategoryResult compare(const Reflect &RHS) const
Definition
Reflect.h:34
clang::interp::Reflect::print
void print(llvm::raw_ostream &OS) const
Definition
Reflect.h:44
clang::interp::Reflect::Reflect
Reflect()
Definition
Reflect.h:30
clang::interp::Reflect::Reflect
Reflect(ReflectionKind Kind, const void *Operand)
Definition
Reflect.h:31
clang::interp
Definition
ASTContext.h:164
clang::interp::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const Boolean &B)
Definition
Boolean.h:147
clang::interp::Null
bool Null(InterpState &S, uint64_t Value, const Type *Ty)
Definition
Interp.h:3196
clang
Top level wrappers for InstallAPI frontend operations.
Definition
CalledOnceCheck.h:17
clang::ConstantResultStorageKind::APValue
@ APValue
Definition
Expr.h:1096
clang::nullptr
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
Definition
StmtOpenACC.h:141
clang::ComparisonCategoryResult
ComparisonCategoryResult
An enumeration representing the possible results of a three-way comparison.
Definition
ComparisonCategories.h:67
clang::ComparisonCategoryResult::Unordered
@ Unordered
Definition
ComparisonCategories.h:72
clang::ComparisonCategoryResult::Equal
@ Equal
Definition
ComparisonCategories.h:68
clang::ReflectionKind
ReflectionKind
Definition
Reflection.h:22
Generated on
for clang by
1.14.0