Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/lib/Basic/TokenKinds.cpp
Line
Count
Source (jump to first uncovered line)
1
//===--- TokenKinds.cpp - Token Kinds 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 TokenKind enum and support functions.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "clang/Basic/TokenKinds.h"
14
#include "llvm/Support/ErrorHandling.h"
15
using namespace clang;
16
17
static const char * const TokNames[] = {
18
#define TOK(X) #X,
19
#define KEYWORD(X,Y) #X,
20
#include "clang/Basic/TokenKinds.def"
21
  nullptr
22
};
23
24
296
const char *tok::getTokenName(TokenKind Kind) {
25
296
  if (Kind < tok::NUM_TOKENS)
26
296
    return TokNames[Kind];
27
0
  llvm_unreachable("unknown TokenKind");
28
0
  return nullptr;
29
0
}
30
31
26.1k
const char *tok::getPunctuatorSpelling(TokenKind Kind) {
32
26.1k
  switch (Kind) {
33
26.1k
#define PUNCTUATOR(X,Y) 
case X: return Y25.7k
;
34
26.1k
#include "clang/Basic/TokenKinds.def"
35
26.1k
  
default: break326
;
36
326
  }
37
326
  return nullptr;
38
326
}
39
40
355
const char *tok::getKeywordSpelling(TokenKind Kind) {
41
355
  switch (Kind) {
42
355
#define KEYWORD(X,Y) 
case kw_ ## X: return #57
X;
43
355
#include "clang/Basic/TokenKinds.def"
44
355
    
default: break298
;
45
298
  }
46
298
  return nullptr;
47
298
}