Path: blob/main/contrib/llvm-project/clang/lib/Basic/ExpressionTraits.cpp
35233 views
//===--- ExpressionTraits.cpp - Expression Traits Support -----------------===//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// This file implements the expression traits support functions.9//10//===----------------------------------------------------------------------===//1112#include "clang/Basic/ExpressionTraits.h"13#include "llvm/Support/ErrorHandling.h"14#include <cassert>15using namespace clang;1617static constexpr const char *ExpressionTraitNames[] = {18#define EXPRESSION_TRAIT(Spelling, Name, Key) #Name,19#include "clang/Basic/TokenKinds.def"20};2122static constexpr const char *ExpressionTraitSpellings[] = {23#define EXPRESSION_TRAIT(Spelling, Name, Key) #Spelling,24#include "clang/Basic/TokenKinds.def"25};2627const char *clang::getTraitName(ExpressionTrait T) {28assert(T <= ET_Last && "invalid enum value!");29return ExpressionTraitNames[T];30}3132const char *clang::getTraitSpelling(ExpressionTrait T) {33assert(T <= ET_Last && "invalid enum value!");34return ExpressionTraitSpellings[T];35}363738