clang  14.0.0git
ExpressionTraits.cpp
Go to the documentation of this file.
1 //===--- ExpressionTraits.cpp - Expression Traits Support -----------------===//
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 // This file implements the expression traits support functions.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "llvm/Support/ErrorHandling.h"
15 #include <cassert>
16 using namespace clang;
17 
18 static constexpr const char *ExpressionTraitNames[] = {
19 #define EXPRESSION_TRAIT(Spelling, Name, Key) #Name,
20 #include "clang/Basic/TokenKinds.def"
21 };
22 
23 static constexpr const char *ExpressionTraitSpellings[] = {
24 #define EXPRESSION_TRAIT(Spelling, Name, Key) #Spelling,
25 #include "clang/Basic/TokenKinds.def"
26 };
27 
29  assert(T <= ET_Last && "invalid enum value!");
30  return ExpressionTraitNames[T];
31 }
32 
34  assert(T <= ET_Last && "invalid enum value!");
35  return ExpressionTraitSpellings[T];
36 }
clang::ET_Last
@ ET_Last
Definition: ExpressionTraits.h:24
ExpressionTraitNames
static constexpr const char * ExpressionTraitNames[]
Definition: ExpressionTraits.cpp:18
clang::getTraitName
const char * getTraitName(ExpressionTrait T) LLVM_READONLY
Return the internal name of type trait T. Never null.
Definition: ExpressionTraits.cpp:28
ExpressionTraits.h
clang::getTraitSpelling
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
Definition: ExpressionTraits.cpp:33
clang
Definition: CalledOnceCheck.h:17
ExpressionTraitSpellings
static constexpr const char * ExpressionTraitSpellings[]
Definition: ExpressionTraits.cpp:23
clang::ExpressionTrait
ExpressionTrait
Definition: ExpressionTraits.h:21