1 //===--- LangStandard.h -----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CLANG_FRONTEND_LANGSTANDARD_H
11 #define LLVM_CLANG_FRONTEND_LANGSTANDARD_H
13 #include "clang/Basic/LLVM.h"
14 #include "llvm/ADT/StringRef.h"
21 LineComment = (1 << 0),
26 CPlusPlus11 = (1 << 5),
27 CPlusPlus14 = (1 << 6),
28 CPlusPlus1z = (1 << 7),
32 ImplicitInt = (1 << 11),
38 /// LangStandard - Information about the properties of a particular language
42 #define LANGSTANDARD(id, name, desc, features) \
44 #include "clang/Frontend/LangStandards.def"
48 const char *ShortName;
49 const char *Description;
53 /// getName - Get the name of this standard.
54 const char *getName() const { return ShortName; }
56 /// getDescription - Get the description of this standard.
57 const char *getDescription() const { return Description; }
59 /// Language supports '//' comments.
60 bool hasLineComments() const { return Flags & frontend::LineComment; }
62 /// isC89 - Language is a superset of C89.
63 bool isC89() const { return Flags & frontend::C89; }
65 /// isC99 - Language is a superset of C99.
66 bool isC99() const { return Flags & frontend::C99; }
68 /// isC11 - Language is a superset of C11.
69 bool isC11() const { return Flags & frontend::C11; }
71 /// isCPlusPlus - Language is a C++ variant.
72 bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }
74 /// isCPlusPlus11 - Language is a C++11 variant (or later).
75 bool isCPlusPlus11() const { return Flags & frontend::CPlusPlus11; }
77 /// isCPlusPlus14 - Language is a C++14 variant (or later).
78 bool isCPlusPlus14() const { return Flags & frontend::CPlusPlus14; }
80 /// isCPlusPlus1z - Language is a C++17 variant (or later).
81 bool isCPlusPlus1z() const { return Flags & frontend::CPlusPlus1z; }
83 /// hasDigraphs - Language supports digraphs.
84 bool hasDigraphs() const { return Flags & frontend::Digraphs; }
86 /// isGNUMode - Language includes GNU extensions.
87 bool isGNUMode() const { return Flags & frontend::GNUMode; }
89 /// hasHexFloats - Language supports hexadecimal float constants.
90 bool hasHexFloats() const { return Flags & frontend::HexFloat; }
92 /// hasImplicitInt - Language allows variables to be typed as int implicitly.
93 bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; }
95 /// isOpenCL - Language is a OpenCL variant.
96 bool isOpenCL() const { return Flags & frontend::OpenCL; }
98 static const LangStandard &getLangStandardForKind(Kind K);
99 static const LangStandard *getLangStandardForName(StringRef Name);
102 } // end namespace clang