]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/tools/clang/include/clang/Frontend/LangStandard.h
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
[FreeBSD/stable/9.git] / contrib / llvm / tools / clang / include / clang / Frontend / LangStandard.h
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 "llvm/ADT/StringRef.h"
14
15 namespace clang {
16
17 namespace frontend {
18
19 enum LangFeatures {
20   BCPLComment = (1 << 0),
21   C89 = (1 << 1),
22   C99 = (1 << 2),
23   C1X = (1 << 3),
24   CPlusPlus = (1 << 4),
25   CPlusPlus0x = (1 << 5),
26   Digraphs = (1 << 6),
27   GNUMode = (1 << 7),
28   HexFloat = (1 << 8),
29   ImplicitInt = (1 << 9)
30 };
31
32 }
33
34 /// LangStandard - Information about the properties of a particular language
35 /// standard.
36 struct LangStandard {
37   enum Kind {
38 #define LANGSTANDARD(id, name, desc, features) \
39     lang_##id,
40 #include "clang/Frontend/LangStandards.def"
41     lang_unspecified
42   };
43
44   const char *ShortName;
45   const char *Description;
46   unsigned Flags;
47
48 public:
49   /// getName - Get the name of this standard.
50   const char *getName() const { return ShortName; }
51
52   /// getDescription - Get the description of this standard.
53   const char *getDescription() const { return Description; }
54
55   /// hasBCPLComments - Language supports '//' comments.
56   bool hasBCPLComments() const { return Flags & frontend::BCPLComment; }
57
58   /// isC89 - Language is a superset of C89.
59   bool isC89() const { return Flags & frontend::C89; }
60
61   /// isC99 - Language is a superset of C99.
62   bool isC99() const { return Flags & frontend::C99; }
63
64   /// isC1X - Language is a superset of C1X.
65   bool isC1X() const { return Flags & frontend::C1X; }
66
67   /// isCPlusPlus - Language is a C++ variant.
68   bool isCPlusPlus() const { return Flags & frontend::CPlusPlus; }
69
70   /// isCPlusPlus0x - Language is a C++0x variant.
71   bool isCPlusPlus0x() const { return Flags & frontend::CPlusPlus0x; }
72
73   /// hasDigraphs - Language supports digraphs.
74   bool hasDigraphs() const { return Flags & frontend::Digraphs; }
75
76   /// isGNUMode - Language includes GNU extensions.
77   bool isGNUMode() const { return Flags & frontend::GNUMode; }
78
79   /// hasHexFloats - Language supports hexadecimal float constants.
80   bool hasHexFloats() const { return Flags & frontend::HexFloat; }
81
82   /// hasImplicitInt - Language allows variables to be typed as int implicitly.
83   bool hasImplicitInt() const { return Flags & frontend::ImplicitInt; }
84
85   static const LangStandard &getLangStandardForKind(Kind K);
86   static const LangStandard *getLangStandardForName(llvm::StringRef Name);
87 };
88
89 }  // end namespace clang
90
91 #endif