blob: 2f4186ba78d46a6599f8f13358ad867a79f26977 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===--- LangOptions.h - C Language Family Language Options -----*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner0bc735f2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Reid Spencer5f016e22007-07-11 17:01:13 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the LangOptions interface.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_LANGOPTIONS_H
15#define LLVM_CLANG_LANGOPTIONS_H
16
Ted Kremenek49142092007-12-05 19:06:15 +000017#include "llvm/Bitcode/SerializationFwd.h"
18
Reid Spencer5f016e22007-07-11 17:01:13 +000019namespace clang {
20
21/// LangOptions - This class keeps track of the various options that can be
22/// enabled, which controls the dialect of C that is accepted.
23struct LangOptions {
24 unsigned Trigraphs : 1; // Trigraphs in source files.
25 unsigned BCPLComment : 1; // BCPL-style // comments.
26 unsigned DollarIdents : 1; // '$' allowed in identifiers.
27 unsigned Digraphs : 1; // When added to C? C99?
28 unsigned HexFloats : 1; // C99 Hexadecimal float constants.
29 unsigned C99 : 1; // C99 Support
30 unsigned Microsoft : 1; // Microsoft extensions.
31 unsigned CPlusPlus : 1; // C++ Support
Chris Lattnerd4b80f12007-07-16 04:18:29 +000032 unsigned CPlusPlus0x : 1; // C++0x Support
Reid Spencer5f016e22007-07-11 17:01:13 +000033 unsigned NoExtensions : 1; // All extensions are disabled, strict mode.
34 unsigned CXXOperatorNames : 1; // Treat C++ operator names as keywords.
35
36 unsigned ObjC1 : 1; // Objective C 1 support enabled.
37 unsigned ObjC2 : 1; // Objective C 2 support enabled.
38
Anders Carlssonee98ac52007-10-15 02:50:23 +000039 unsigned PascalStrings : 1; // Allow Pascal strings
Nate Begeman8aebcb72007-11-15 07:30:50 +000040 unsigned Boolean : 1; // Allow bool/true/false
Chris Lattner45e8cbd2007-11-28 05:34:05 +000041 unsigned WritableStrings : 1; // Allow writable strings
Anders Carlsson695dbb62007-11-30 04:21:22 +000042 unsigned LaxVectorConversions : 1;
43
Reid Spencer5f016e22007-07-11 17:01:13 +000044 LangOptions() {
Chris Lattner825502a2007-11-15 19:22:40 +000045 Trigraphs = BCPLComment = DollarIdents = Digraphs = HexFloats = 0;
46 ObjC1 = ObjC2 = 0;
Chris Lattnerd4b80f12007-07-16 04:18:29 +000047 C99 = Microsoft = CPlusPlus = CPlusPlus0x = NoExtensions = 0;
Chris Lattner45e8cbd2007-11-28 05:34:05 +000048 CXXOperatorNames = PascalStrings = Boolean = WritableStrings = 0;
Anders Carlssonb0ff33a2007-11-30 18:29:41 +000049 LaxVectorConversions = 0;
Reid Spencer5f016e22007-07-11 17:01:13 +000050 }
Ted Kremenek49142092007-12-05 19:06:15 +000051
52 /// Emit - Emit this LangOptions object to bitcode.
53 void Emit(llvm::Serializer& S) const;
54
55 /// Read - Read new values for this LangOption object from bitcode.
56 void Read(llvm::Deserializer& S);
Reid Spencer5f016e22007-07-11 17:01:13 +000057};
58
59} // end namespace clang
60
61#endif