Coverage Report

Created: 2020-02-18 08:44

/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
72.2k
const LangStandard &LangStandard::getLangStandardForKind(Kind K) {
19
72.2k
  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
72.2k
    case lang_##id: return Lang_##id;
24
0
#include "clang/Basic/LangStandards.def"
25
72.2k
  }
26
72.2k
  
llvm_unreachable0
("Invalid language kind!");
27
72.2k
}
28
29
20.7k
LangStandard::Kind LangStandard::getLangKind(StringRef Name) {
30
20.7k
  return llvm::StringSwitch<Kind>(Name)
31
580k
#define LANGSTANDARD(id, name, lang, desc, features) .Case(name, lang_##id)
32
601k
#define LANGSTANDARD_ALIAS(id, alias) .Case(alias, lang_##id)
33
20.7k
#include "clang/Basic/LangStandards.def"
34
20.7k
      .Default(lang_unspecified);
35
20.7k
}
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
10
42
10
  return &getLangStandardForKind(K);
43
10
}
44
45