clang
20.0.0git
lib
AST
ByteCode
Primitives.h
Go to the documentation of this file.
1
//===------ Primitives.h - Types 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
// Utilities and helper functions for all primitive types:
10
// - Integral
11
// - Floating
12
// - Boolean
13
//
14
//===----------------------------------------------------------------------===//
15
16
#ifndef LLVM_CLANG_AST_INTERP_PRIMITIVES_H
17
#define LLVM_CLANG_AST_INTERP_PRIMITIVES_H
18
19
#include "
clang/AST/ComparisonCategories.h
"
20
21
namespace
clang
{
22
namespace
interp {
23
24
/// Helper to compare two comparable types.
25
template
<
typename
T>
ComparisonCategoryResult
Compare
(
const
T
&
X
,
const
T
&Y) {
26
if
(
X
< Y)
27
return
ComparisonCategoryResult::Less
;
28
if
(
X
> Y)
29
return
ComparisonCategoryResult::Greater
;
30
return
ComparisonCategoryResult::Equal
;
31
}
32
33
}
// namespace interp
34
}
// namespace clang
35
36
#endif
ComparisonCategories.h
X
#define X(type, name)
Definition:
Value.h:143
clang::interp::Compare
ComparisonCategoryResult Compare(const T &X, const T &Y)
Helper to compare two comparable types.
Definition:
Primitives.h:25
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition:
CalledOnceCheck.h:17
clang::ComparisonCategoryResult
ComparisonCategoryResult
An enumeration representing the possible results of a three-way comparison.
Definition:
ComparisonCategories.h:67
clang::ComparisonCategoryResult::Less
@ Less
clang::ComparisonCategoryResult::Greater
@ Greater
clang::ComparisonCategoryResult::Equal
@ Equal
clang::T
const FunctionProtoType * T
Definition:
RecursiveASTVisitor.h:1359
Generated on Fri Nov 22 2024 09:47:46 for clang by
1.9.6