Path: blob/main/contrib/llvm-project/clang/lib/AST/Interp/Primitives.h
35292 views
//===------ Primitives.h - Types for the constexpr VM -----------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Utilities and helper functions for all primitive types:9// - Integral10// - Floating11// - Boolean12//13//===----------------------------------------------------------------------===//1415#ifndef LLVM_CLANG_AST_INTERP_PRIMITIVES_H16#define LLVM_CLANG_AST_INTERP_PRIMITIVES_H1718#include "clang/AST/ComparisonCategories.h"1920namespace clang {21namespace interp {2223/// Helper to compare two comparable types.24template <typename T> ComparisonCategoryResult Compare(const T &X, const T &Y) {25if (X < Y)26return ComparisonCategoryResult::Less;27if (X > Y)28return ComparisonCategoryResult::Greater;29return ComparisonCategoryResult::Equal;30}3132} // namespace interp33} // namespace clang3435#endif363738