clang  3.9.0
LangStandard.h
Go to the documentation of this file.
1 //===--- LangStandard.h -----------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_FRONTEND_LANGSTANDARD_H
11 #define LLVM_CLANG_FRONTEND_LANGSTANDARD_H
12 
13 #include "clang/Basic/LLVM.h"
14 #include "llvm/ADT/StringRef.h"
15 
16 namespace clang {
17 
18 namespace frontend {
19 
21  LineComment = (1 << 0),
22  C89 = (1 << 1),
23  C99 = (1 << 2),
24  C11 = (1 << 3),
25  CPlusPlus = (1 << 4),
26  CPlusPlus11 = (1 << 5),
27  CPlusPlus14 = (1 << 6),
28  CPlusPlus1z = (1 << 7),
29  Digraphs = (1 << 8),
30  GNUMode = (1 << 9),
31  HexFloat = (1 << 10),
32  ImplicitInt = (1 << 11)
33 };
34 
35 }
36 
37 /// LangStandard - Information about the properties of a particular language
38 /// standard.
39 struct LangStandard {
40  enum Kind {
41 #define LANGSTANDARD(id, name, desc, features) \
42  lang_##id,
43 #include "clang/Frontend/LangStandards.def"
45  };
46 
47  const char *ShortName;
48  const char *Description;
49  unsigned Flags;
50 
51 public:
52  /// getName - Get the name of this standard.
53  const char *getName() const { return ShortName; }
54 
55  /// getDescription - Get the description of this standard.
56  const char *getDescription() const { return Description; }
57 
58  /// Language supports '//' comments.
59  bool hasLineComments() const { return Flags & frontend::LineComment; }
60 
61  /// isC89 - Language is a superset of C89.
62  bool isC89() const { return Flags & frontend::C89; }
63 
64  /// isC99 - Language is a superset of C99.
65  bool isC99() const { return Flags & frontend::C99; }
66 
67  /// isC11 - Language is a superset of C11.
68  bool isC11() const { return Flags & frontend::C11; }
69 
70  /// isCPlusPlus - Language is a C++ variant.
71  bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }
72 
73  /// isCPlusPlus11 - Language is a C++11 variant (or later).
74  bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; }
75 
76  /// isCPlusPlus14 - Language is a C++14 variant (or later).
77  bool isCPlusPlus14() const { return Flags & frontend::CPlusPlus14; }
78 
79  /// isCPlusPlus1z - Language is a C++17 variant (or later).
80  bool isCPlusPlus1z() const { return Flags & frontend::CPlusPlus1z; }
81 
82  /// hasDigraphs - Language supports digraphs.
83  bool hasDigraphs() const { return Flags & frontend::Digraphs; }
84 
85  /// isGNUMode - Language includes GNU extensions.
86  bool isGNUMode() const { return Flags & frontend::GNUMode; }
87 
88  /// hasHexFloats - Language supports hexadecimal float constants.
89  bool hasHexFloats() const { return Flags & frontend::HexFloat; }
90 
91  /// hasImplicitInt - Language allows variables to be typed as int implicitly.
92  bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; }
93 
94  static const LangStandard &getLangStandardForKind(Kind K);
95  static const LangStandard *getLangStandardForName(StringRef Name);
96 };
97 
98 } // end namespace clang
99 
100 #endif
LangStandard - Information about the properties of a particular language standard.
Definition: LangStandard.h:39
bool isGNUMode() const
isGNUMode - Language includes GNU extensions.
Definition: LangStandard.h:86
bool hasLineComments() const
Language supports '//' comments.
Definition: LangStandard.h:59
static const LangStandard & getLangStandardForKind(Kind K)
const char * getDescription() const
getDescription - Get the description of this standard.
Definition: LangStandard.h:56
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:4549
bool isCPlusPlus11() const
isCPlusPlus11 - Language is a C++11 variant (or later).
Definition: LangStandard.h:74
bool isCPlusPlus() const
isCPlusPlus - Language is a C++ variant.
Definition: LangStandard.h:71
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const char * getName() const
getName - Get the name of this standard.
Definition: LangStandard.h:53
bool isCPlusPlus14() const
isCPlusPlus14 - Language is a C++14 variant (or later).
Definition: LangStandard.h:77
bool hasDigraphs() const
hasDigraphs - Language supports digraphs.
Definition: LangStandard.h:83
bool isCPlusPlus1z() const
isCPlusPlus1z - Language is a C++17 variant (or later).
Definition: LangStandard.h:80
bool isC89() const
isC89 - Language is a superset of C89.
Definition: LangStandard.h:62
bool hasImplicitInt() const
hasImplicitInt - Language allows variables to be typed as int implicitly.
Definition: LangStandard.h:92
bool isC99() const
isC99 - Language is a superset of C99.
Definition: LangStandard.h:65
Kind
bool isC11() const
isC11 - Language is a superset of C11.
Definition: LangStandard.h:68
static const LangStandard * getLangStandardForName(StringRef Name)
const char * ShortName
Definition: LangStandard.h:47
const char * Description
Definition: LangStandard.h:48
bool hasHexFloats() const
hasHexFloats - Language supports hexadecimal float constants.
Definition: LangStandard.h:89