/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/AST/Interp/Primitives.h
Line | Count | Source |
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 | 2.17k | template <typename T> ComparisonCategoryResult Compare(const T &X, const T &Y) { |
26 | 2.17k | if (X < Y) |
27 | 772 | return ComparisonCategoryResult::Less; |
28 | 1.40k | if (X > Y) |
29 | 145 | return ComparisonCategoryResult::Greater; |
30 | 1.25k | return ComparisonCategoryResult::Equal; |
31 | 1.40k | } Unexecuted instantiation: clang::ComparisonCategoryResult clang::interp::Compare<bool>(bool const&, bool const&) clang::ComparisonCategoryResult clang::interp::Compare<llvm::APFloat>(llvm::APFloat const&, llvm::APFloat const&) Line | Count | Source | 25 | 35 | template <typename T> ComparisonCategoryResult Compare(const T &X, const T &Y) { | 26 | 35 | if (X < Y) | 27 | 0 | return ComparisonCategoryResult::Less; | 28 | 35 | if (X > Y) | 29 | 4 | return ComparisonCategoryResult::Greater; | 30 | 31 | return ComparisonCategoryResult::Equal; | 31 | 35 | } |
clang::ComparisonCategoryResult clang::interp::Compare<unsigned int>(unsigned int const&, unsigned int const&) Line | Count | Source | 25 | 261 | template <typename T> ComparisonCategoryResult Compare(const T &X, const T &Y) { | 26 | 261 | if (X < Y) | 27 | 136 | return ComparisonCategoryResult::Less; | 28 | 125 | if (X > Y) | 29 | 61 | return ComparisonCategoryResult::Greater; | 30 | 64 | return ComparisonCategoryResult::Equal; | 31 | 125 | } |
Unexecuted instantiation: clang::ComparisonCategoryResult clang::interp::Compare<signed char>(signed char const&, signed char const&) Unexecuted instantiation: clang::ComparisonCategoryResult clang::interp::Compare<unsigned char>(unsigned char const&, unsigned char const&) clang::ComparisonCategoryResult clang::interp::Compare<short>(short const&, short const&) Line | Count | Source | 25 | 1 | template <typename T> ComparisonCategoryResult Compare(const T &X, const T &Y) { | 26 | 1 | if (X < Y) | 27 | 0 | return ComparisonCategoryResult::Less; | 28 | 1 | if (X > Y) | 29 | 0 | return ComparisonCategoryResult::Greater; | 30 | 1 | return ComparisonCategoryResult::Equal; | 31 | 1 | } |
Unexecuted instantiation: clang::ComparisonCategoryResult clang::interp::Compare<unsigned short>(unsigned short const&, unsigned short const&) clang::ComparisonCategoryResult clang::interp::Compare<int>(int const&, int const&) Line | Count | Source | 25 | 1.36k | template <typename T> ComparisonCategoryResult Compare(const T &X, const T &Y) { | 26 | 1.36k | if (X < Y) | 27 | 634 | return ComparisonCategoryResult::Less; | 28 | 734 | if (X > Y) | 29 | 67 | return ComparisonCategoryResult::Greater; | 30 | 667 | return ComparisonCategoryResult::Equal; | 31 | 734 | } |
clang::ComparisonCategoryResult clang::interp::Compare<long long>(long long const&, long long const&) Line | Count | Source | 25 | 7 | template <typename T> ComparisonCategoryResult Compare(const T &X, const T &Y) { | 26 | 7 | if (X < Y) | 27 | 0 | return ComparisonCategoryResult::Less; | 28 | 7 | if (X > Y) | 29 | 0 | return ComparisonCategoryResult::Greater; | 30 | 7 | return ComparisonCategoryResult::Equal; | 31 | 7 | } |
clang::ComparisonCategoryResult clang::interp::Compare<unsigned long long>(unsigned long long const&, unsigned long long const&) Line | Count | Source | 25 | 500 | template <typename T> ComparisonCategoryResult Compare(const T &X, const T &Y) { | 26 | 500 | if (X < Y) | 27 | 2 | return ComparisonCategoryResult::Less; | 28 | 498 | if (X > Y) | 29 | 13 | return ComparisonCategoryResult::Greater; | 30 | 485 | return ComparisonCategoryResult::Equal; | 31 | 498 | } |
|
32 | | |
33 | | } // namespace interp |
34 | | } // namespace clang |
35 | | |
36 | | #endif |