Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Frontend/LangStandard.h
Line
Count
Source
1
//===--- LangStandard.h -----------------------------------------*- C++ -*-===//
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
#ifndef LLVM_CLANG_FRONTEND_LANGSTANDARD_H
10
#define LLVM_CLANG_FRONTEND_LANGSTANDARD_H
11
12
#include "clang/Basic/LLVM.h"
13
#include "clang/Frontend/FrontendOptions.h"
14
#include "llvm/ADT/StringRef.h"
15
16
namespace clang {
17
18
namespace frontend {
19
20
enum LangFeatures {
21
  LineComment = (1 << 0),
22
  C99 = (1 << 1),
23
  C11 = (1 << 2),
24
  C17 = (1 << 3),
25
  C2x = (1 << 4),
26
  CPlusPlus = (1 << 5),
27
  CPlusPlus11 = (1 << 6),
28
  CPlusPlus14 = (1 << 7),
29
  CPlusPlus17 = (1 << 8),
30
  CPlusPlus2a = (1 << 9),
31
  Digraphs = (1 << 10),
32
  GNUMode = (1 << 11),
33
  HexFloat = (1 << 12),
34
  ImplicitInt = (1 << 13),
35
  OpenCL = (1 << 14)
36
};
37
38
}
39
40
/// LangStandard - Information about the properties of a particular language
41
/// standard.
42
struct LangStandard {
43
  enum Kind {
44
#define LANGSTANDARD(id, name, lang, desc, features) \
45
    lang_##id,
46
#include "clang/Frontend/LangStandards.def"
47
    lang_unspecified
48
  };
49
50
  const char *ShortName;
51
  const char *Description;
52
  unsigned Flags;
53
  InputKind::Language Language;
54
55
public:
56
  /// getName - Get the name of this standard.
57
84
  const char *getName() const { return ShortName; }
58
59
  /// getDescription - Get the description of this standard.
60
80
  const char *getDescription() const { return Description; }
61
62
  /// Get the language that this standard describes.
63
17.3k
  InputKind::Language getLanguage() const { return Language; }
64
65
  /// Language supports '//' comments.
66
41.1k
  bool hasLineComments() const { return Flags & frontend::LineComment; }
67
68
  /// isC99 - Language is a superset of C99.
69
41.1k
  bool isC99() const { return Flags & frontend::C99; }
70
71
  /// isC11 - Language is a superset of C11.
72
41.1k
  bool isC11() const { return Flags & frontend::C11; }
73
74
  /// isC17 - Language is a superset of C17.
75
41.1k
  bool isC17() const { return Flags & frontend::C17; }
76
77
  /// isC2x - Language is a superset of C2x.
78
41.1k
  bool isC2x() const { return Flags & frontend::C2x; }
79
80
  /// isCPlusPlus - Language is a C++ variant.
81
41.1k
  bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }
82
83
  /// isCPlusPlus11 - Language is a C++11 variant (or later).
84
41.1k
  bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; }
85
86
  /// isCPlusPlus14 - Language is a C++14 variant (or later).
87
41.1k
  bool isCPlusPlus14() const { return Flags & frontend::CPlusPlus14; }
88
89
  /// isCPlusPlus17 - Language is a C++17 variant (or later).
90
41.1k
  bool isCPlusPlus17() const { return Flags & frontend::CPlusPlus17; }
91
92
  /// isCPlusPlus2a - Language is a post-C++17 variant (or later).
93
41.1k
  bool isCPlusPlus2a() const { return Flags & frontend::CPlusPlus2a; }
94
95
96
  /// hasDigraphs - Language supports digraphs.
97
41.1k
  bool hasDigraphs() const { return Flags & frontend::Digraphs; }
98
99
  /// isGNUMode - Language includes GNU extensions.
100
41.1k
  bool isGNUMode() const { return Flags & frontend::GNUMode; }
101
102
  /// hasHexFloats - Language supports hexadecimal float constants.
103
41.1k
  bool hasHexFloats() const { return Flags & frontend::HexFloat; }
104
105
  /// hasImplicitInt - Language allows variables to be typed as int implicitly.
106
41.1k
  bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; }
107
108
  /// isOpenCL - Language is a OpenCL variant.
109
41.1k
  bool isOpenCL() const { return Flags & frontend::OpenCL; }
110
111
  static const LangStandard &getLangStandardForKind(Kind K);
112
  static const LangStandard *getLangStandardForName(StringRef Name);
113
};
114
115
}  // end namespace clang
116
117
#endif