Split LangOptions out into its own header

llvm-svn: 38806
This commit is contained in:
Chris Lattner 2006-08-04 04:44:06 +00:00
parent b9093cd1d0
commit 22dc378630
3 changed files with 55 additions and 27 deletions

View File

@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
DE06B73E0A8307640050E87E /* LangOptions.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE06B73D0A8307640050E87E /* LangOptions.h */; };
DE1F22030A7D852A00FBF588 /* Parser.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE1F22020A7D852A00FBF588 /* Parser.h */; };
DE1F22200A7D879000FBF588 /* ParserActions.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE1F221F0A7D879000FBF588 /* ParserActions.h */; };
DE1F24700A7DC99000FBF588 /* Actions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE1F246D0A7DC99000FBF588 /* Actions.cpp */; };
@ -96,6 +97,7 @@
DE1F22030A7D852A00FBF588 /* Parser.h in CopyFiles */,
DE1F22200A7D879000FBF588 /* ParserActions.h in CopyFiles */,
DE1F24820A7DCD3800FBF588 /* Declarations.h in CopyFiles */,
DE06B73E0A8307640050E87E /* LangOptions.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 1;
};
@ -103,6 +105,7 @@
/* Begin PBXFileReference section */
8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
DE06B73D0A8307640050E87E /* LangOptions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LangOptions.h; sourceTree = "<group>"; };
DE1F22020A7D852A00FBF588 /* Parser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Parser.h; path = clang/Parse/Parser.h; sourceTree = "<group>"; };
DE1F221F0A7D879000FBF588 /* ParserActions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ParserActions.h; path = clang/Parse/ParserActions.h; sourceTree = "<group>"; };
DE1F246D0A7DC99000FBF588 /* Actions.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Actions.cpp; path = Parse/Actions.cpp; sourceTree = "<group>"; };
@ -244,6 +247,7 @@
DED7D7310A524295003AD0FB /* Diagnostic.h */,
DED7D7320A524295003AD0FB /* DiagnosticKinds.def */,
DED7D7330A524295003AD0FB /* FileManager.h */,
DE06B73D0A8307640050E87E /* LangOptions.h */,
DED7D7340A524295003AD0FB /* SourceBuffer.h */,
DED7D7350A524295003AD0FB /* SourceLocation.h */,
DED7D7360A524295003AD0FB /* SourceManager.h */,

View File

@ -0,0 +1,50 @@
//===--- LangOptions.h - C Language Family Language Options -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by Chris Lattner and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the LangOptions interface.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LANGOPTIONS_H
#define LLVM_CLANG_LANGOPTIONS_H
namespace llvm {
namespace clang {
/// LangOptions - This class keeps track of the various options that can be
/// enabled, which controls the dialect of C that is accepted.
struct LangOptions {
unsigned Trigraphs : 1; // Trigraphs in source files.
unsigned BCPLComment : 1; // BCPL-style // comments.
unsigned DollarIdents : 1; // '$' allowed in identifiers.
unsigned Digraphs : 1; // When added to C? C99?
unsigned HexFloats : 1; // C99 Hexadecimal float constants.
unsigned C99 : 1; // C99 Support
unsigned Microsoft : 1; // Microsoft extensions.
unsigned CPlusPlus : 1; // C++ Support
unsigned CPPMinMax : 1; // C++ <?=, >?= tokens.
unsigned NoExtensions : 1; // All extensions are disabled, strict mode.
unsigned ObjC1 : 1; // Objective C 1 support enabled.
unsigned ObjC2 : 1; // Objective C 2 support enabled.
unsigned KeepComments : 1; // Keep comments ("-C") mode.
unsigned KeepMacroComments : 1; // Keep macro-exp comments ("-CC") mode.
LangOptions() {
Trigraphs = BCPLComment = DollarIdents = Digraphs = ObjC1 = ObjC2 = 0;
C99 = Microsoft = CPlusPlus = CPPMinMax = NoExtensions = 0;
KeepComments = KeepMacroComments = 0;
}
};
} // end namespace clang
} // end namespace llvm
#endif

View File

@ -16,6 +16,7 @@
#include "clang/Lex/LexerToken.h"
#include "clang/Lex/MultipleIncludeOpt.h"
#include "clang/Basic/LangOptions.h"
#include <string>
#include <vector>
@ -25,33 +26,6 @@ class Diagnostic;
class Preprocessor;
class SourceBuffer;
struct LangOptions {
unsigned Trigraphs : 1; // Trigraphs in source files.
unsigned BCPLComment : 1; // BCPL-style // comments.
unsigned DollarIdents : 1; // '$' allowed in identifiers.
unsigned Digraphs : 1; // When added to C? C99?
unsigned HexFloats : 1; // C99 Hexadecimal float constants.
unsigned C99 : 1; // C99 Support
unsigned Microsoft : 1; // Microsoft extensions.
unsigned CPlusPlus : 1; // C++ Support
unsigned CPPMinMax : 1; // C++ <?=, >?= tokens.
unsigned NoExtensions : 1; // All extensions are disabled, strict mode.
unsigned ObjC1 : 1; // Objective C 1 support enabled.
unsigned ObjC2 : 1; // Objective C 2 support enabled.
unsigned KeepComments : 1; // Keep comments ("-C") mode.
unsigned KeepMacroComments : 1; // Keep macro-exp comments ("-CC") mode.
LangOptions() {
Trigraphs = BCPLComment = DollarIdents = Digraphs = ObjC1 = ObjC2 = 0;
C99 = Microsoft = CPlusPlus = CPPMinMax = NoExtensions = 0;
KeepComments = KeepMacroComments = 0;
}
};
/// Lexer - This provides a simple interface that turns a text buffer into a
/// stream of tokens. This provides no support for file reading or buffering,
/// or buffering/seeking of tokens, only forward lexing is supported. It relies