Coverage Report

Created: 2020-09-22 08:39

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/LangStandards.cpp
Line
Count
Source (jump to first uncovered line)
1
//===--- LangStandards.cpp - Language Standard Definitions ----------------===//
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
#include "clang/Basic/LangStandard.h"
10
#include "llvm/ADT/StringSwitch.h"
11
#include "llvm/Support/ErrorHandling.h"
12
using namespace clang;
13
14
#define LANGSTANDARD(id, name, lang, desc, features)                           \
15
  static const LangStandard Lang_##id = {name, desc, features, Language::lang};
16
#include "clang/Basic/LangStandards.def"
17
18
109k
const LangStandard &LangStandard::getLangStandardForKind(Kind K) {
19
109k
  switch (K) {
20
0
  case lang_unspecified:
21
0
    llvm::report_fatal_error("getLangStandardForKind() on unspecified kind");
22
0
#define LANGSTANDARD(id, name, lang, desc, features) \
23
109k
    case lang_##id: return Lang_##id;
24
0
#include "clang/Basic/LangStandards.def"
25
109k
  }
26
109k
  
llvm_unreachable0
("Invalid language kind!");
27
109k
}
28
29
36.6k
LangStandard::Kind LangStandard::getLangKind(StringRef Name) {
30
36.6k
  return llvm::StringSwitch<Kind>(Name)
31
1.02M
#define LANGSTANDARD(id, name, lang, desc, features) .Case(name, lang_##id)
32
1.13M
#define LANGSTANDARD_ALIAS(id, alias) .Case(alias, lang_##id)
33
36.6k
#include "clang/Basic/LangStandards.def"
34
36.6k
      .Default(lang_unspecified);
35
36.6k
}
36
37
10
const LangStandard *LangStandard::getLangStandardForName(StringRef Name) {
38
10
  Kind K = getLangKind(Name);
39
10
  if (K == lang_unspecified)
40
0
    return nullptr;
41
42
10
  return &getLangStandardForKind(K);
43
10
}
44
45