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/Support/raw_ostream.h"
16
17
namespace
clang
{
18
namespace
interp
{
19
20
class
Reflect
final {
21
private
:
22
ReflectionKind
Kind;
23
const
void
*Operand;
24
25
public
:
26
Reflect
() : Kind(
ReflectionKind
::
Null
), Operand(
nullptr
) {}
27
Reflect
(
ReflectionKind
Kind,
const
void
*Operand)
28
: Kind(Kind), Operand(Operand) {}
29
30
ReflectionKind
getKind
()
const
{
return
Kind; }
31
32
ComparisonCategoryResult
compare
(
const
Reflect
&RHS)
const
{
33
llvm::FoldingSetNodeID LID, RID;
34
APValue
(Kind, Operand).Profile(LID);
35
APValue
(RHS.Kind, RHS.Operand).Profile(RID);
36
37
if
(LID == RID)
38
return
ComparisonCategoryResult::Equal
;
39
return
ComparisonCategoryResult::Unordered
;
40
}
41
42
void
print
(llvm::raw_ostream &OS)
const
{
43
OS <<
"Reflect("
<< Kind <<
", "
<< Operand <<
")"
;
44
}
45
APValue
toAPValue
(
const
ASTContext
&Ctx)
const
{
46
return
APValue
(Kind, Operand);
47
}
48
};
49
50
inline
llvm::raw_ostream &
operator<<
(llvm::raw_ostream &OS,
const
Reflect
&R) {
51
R.print(OS);
52
return
OS;
53
}
54
55
}
// namespace interp
56
}
// namespace clang
57
58
#endif
APValue.h
ComparisonCategories.h
Reflection.h
clang::APValue
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition
APValue.h:158
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition
ASTContext.h:246
clang::interp::Reflect
Definition
Reflect.h:20
clang::interp::Reflect::toAPValue
APValue toAPValue(const ASTContext &Ctx) const
Definition
Reflect.h:45
clang::interp::Reflect::compare
ComparisonCategoryResult compare(const Reflect &RHS) const
Definition
Reflect.h:32
clang::interp::Reflect::print
void print(llvm::raw_ostream &OS) const
Definition
Reflect.h:42
clang::interp::Reflect::Reflect
Reflect()
Definition
Reflect.h:26
clang::interp::Reflect::getKind
ReflectionKind getKind() const
Definition
Reflect.h:30
clang::interp::Reflect::Reflect
Reflect(ReflectionKind Kind, const void *Operand)
Definition
Reflect.h:27
clang::interp
Definition
ASTContext.h:165
clang::interp::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const Boolean &B)
Definition
Boolean.h:148
clang::interp::Null
bool Null(InterpState &S, uint64_t Value, const Type *Ty)
Definition
Interp.h:3153
clang
Top level wrappers for InstallAPI frontend operations.
Definition
CalledOnceCheck.h:17
clang::ConstantResultStorageKind::APValue
@ APValue
Definition
Expr.h:1121
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