llvm-project/clang/lib/Basic/ExpressionTraits.cpp
Kazu Hirata cd9fe8a34c
[Basic] Remove unused includes (NFC) (#142295)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-05-31 19:00:31 -07:00

36 lines
1.2 KiB
C++

//===--- ExpressionTraits.cpp - Expression Traits Support -----------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements the expression traits support functions.
//
//===----------------------------------------------------------------------===//
#include "clang/Basic/ExpressionTraits.h"
#include <cassert>
using namespace clang;
static constexpr const char *ExpressionTraitNames[] = {
#define EXPRESSION_TRAIT(Spelling, Name, Key) #Name,
#include "clang/Basic/TokenKinds.def"
};
static constexpr const char *ExpressionTraitSpellings[] = {
#define EXPRESSION_TRAIT(Spelling, Name, Key) #Spelling,
#include "clang/Basic/TokenKinds.def"
};
const char *clang::getTraitName(ExpressionTrait T) {
assert(T <= ET_Last && "invalid enum value!");
return ExpressionTraitNames[T];
}
const char *clang::getTraitSpelling(ExpressionTrait T) {
assert(T <= ET_Last && "invalid enum value!");
return ExpressionTraitSpellings[T];
}