forked from OSchip/llvm-project
Rename Parse/ParserActions.h -> Parse/Action.h
llvm-svn: 38913
This commit is contained in:
parent
4bb61de36c
commit
685ed1e9ee
|
@ -616,7 +616,7 @@ static void ReadPrologFiles(Preprocessor &PP, std::vector<char> &Buf) {
|
||||||
// Parser driver
|
// Parser driver
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
static void ParseFile(Preprocessor &PP, ParserActions *PA, unsigned MainFileID){
|
static void ParseFile(Preprocessor &PP, Action *PA, unsigned MainFileID) {
|
||||||
Parser P(PP, *PA);
|
Parser P(PP, *PA);
|
||||||
|
|
||||||
PP.EnterSourceFile(MainFileID, 0, true);
|
PP.EnterSourceFile(MainFileID, 0, true);
|
||||||
|
@ -752,7 +752,7 @@ int main(int argc, char **argv) {
|
||||||
//ParseFile(PP, new ParserPrintActions(PP), MainFileID);
|
//ParseFile(PP, new ParserPrintActions(PP), MainFileID);
|
||||||
break;
|
break;
|
||||||
case ParseSyntaxOnly: // -fsyntax-only
|
case ParseSyntaxOnly: // -fsyntax-only
|
||||||
ParseFile(PP, new ParserActions(), MainFileID);
|
ParseFile(PP, new Action(), MainFileID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
Parser::Parser(Preprocessor &pp, ParserActions &actions)
|
Parser::Parser(Preprocessor &pp, Action &actions)
|
||||||
: PP(pp), Actions(actions), Diags(PP.getDiagnostics()) {
|
: PP(pp), Actions(actions), Diags(PP.getDiagnostics()) {
|
||||||
Tok.SetKind(tok::eof);
|
Tok.SetKind(tok::eof);
|
||||||
CurScope = 0;
|
CurScope = 0;
|
||||||
|
@ -30,8 +30,8 @@ Parser::~Parser() {
|
||||||
delete CurScope;
|
delete CurScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Out-of-line virtual destructor to provide home for ParserActions class.
|
/// Out-of-line virtual destructor to provide home for Action class.
|
||||||
ParserActions::~ParserActions() {}
|
Action::~Action() {}
|
||||||
|
|
||||||
|
|
||||||
void Parser::Diag(SourceLocation Loc, unsigned DiagID,
|
void Parser::Diag(SourceLocation Loc, unsigned DiagID,
|
||||||
|
@ -166,7 +166,6 @@ bool Parser::SkipUntil(tok::TokenKind T, bool StopAtSemi, bool DontConsume) {
|
||||||
|
|
||||||
/// EnterScope - Start a new scope.
|
/// EnterScope - Start a new scope.
|
||||||
void Parser::EnterScope() {
|
void Parser::EnterScope() {
|
||||||
// TODO: Inform actions?
|
|
||||||
CurScope = new Scope(CurScope);
|
CurScope = new Scope(CurScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
DE06D4310A8BB52D0050E87E /* Parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE06D42F0A8BB52D0050E87E /* Parser.cpp */; };
|
DE06D4310A8BB52D0050E87E /* Parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE06D42F0A8BB52D0050E87E /* Parser.cpp */; };
|
||||||
DE06D4410A8BB55C0050E87E /* Declaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE06D4400A8BB55C0050E87E /* Declaration.cpp */; };
|
DE06D4410A8BB55C0050E87E /* Declaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE06D4400A8BB55C0050E87E /* Declaration.cpp */; };
|
||||||
DE06E4D70A8FBF7A0050E87E /* Initializer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE06E4D60A8FBF7A0050E87E /* Initializer.cpp */; };
|
DE06E4D70A8FBF7A0050E87E /* Initializer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE06E4D60A8FBF7A0050E87E /* Initializer.cpp */; };
|
||||||
|
DE06E8140A8FF9330050E87E /* Action.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE06E8130A8FF9330050E87E /* Action.h */; };
|
||||||
DE1F22030A7D852A00FBF588 /* Parser.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE1F22020A7D852A00FBF588 /* Parser.h */; };
|
DE1F22030A7D852A00FBF588 /* Parser.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE1F22020A7D852A00FBF588 /* Parser.h */; };
|
||||||
DE1F22200A7D879000FBF588 /* ParserActions.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE1F221F0A7D879000FBF588 /* ParserActions.h */; };
|
|
||||||
DE1F24820A7DCD3800FBF588 /* Declarations.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE1F24810A7DCD3800FBF588 /* Declarations.h */; };
|
DE1F24820A7DCD3800FBF588 /* Declarations.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE1F24810A7DCD3800FBF588 /* Declarations.h */; };
|
||||||
DEAEE98B0A5A2B970045101B /* MultipleIncludeOpt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */; };
|
DEAEE98B0A5A2B970045101B /* MultipleIncludeOpt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */; };
|
||||||
DEAEECAD0A5AF0E30045101B /* clang.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEECAC0A5AF0E30045101B /* clang.h */; };
|
DEAEECAD0A5AF0E30045101B /* clang.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEECAC0A5AF0E30045101B /* clang.h */; };
|
||||||
|
@ -100,11 +100,11 @@
|
||||||
DEAEECAD0A5AF0E30045101B /* clang.h in CopyFiles */,
|
DEAEECAD0A5AF0E30045101B /* clang.h in CopyFiles */,
|
||||||
DEAEED4B0A5AF89A0045101B /* NOTES.txt in CopyFiles */,
|
DEAEED4B0A5AF89A0045101B /* NOTES.txt in CopyFiles */,
|
||||||
DE1F22030A7D852A00FBF588 /* Parser.h in CopyFiles */,
|
DE1F22030A7D852A00FBF588 /* Parser.h in CopyFiles */,
|
||||||
DE1F22200A7D879000FBF588 /* ParserActions.h in CopyFiles */,
|
|
||||||
DE1F24820A7DCD3800FBF588 /* Declarations.h in CopyFiles */,
|
DE1F24820A7DCD3800FBF588 /* Declarations.h in CopyFiles */,
|
||||||
DE06B73E0A8307640050E87E /* LangOptions.h in CopyFiles */,
|
DE06B73E0A8307640050E87E /* LangOptions.h in CopyFiles */,
|
||||||
DE06BECB0A854E4B0050E87E /* Scope.h in CopyFiles */,
|
DE06BECB0A854E4B0050E87E /* Scope.h in CopyFiles */,
|
||||||
DE06BEF40A8558200050E87E /* Decl.h in CopyFiles */,
|
DE06BEF40A8558200050E87E /* Decl.h in CopyFiles */,
|
||||||
|
DE06E8140A8FF9330050E87E /* Action.h in CopyFiles */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 1;
|
runOnlyForDeploymentPostprocessing = 1;
|
||||||
};
|
};
|
||||||
|
@ -122,8 +122,8 @@
|
||||||
DE06D42F0A8BB52D0050E87E /* Parser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Parser.cpp; path = Parse/Parser.cpp; sourceTree = "<group>"; };
|
DE06D42F0A8BB52D0050E87E /* Parser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Parser.cpp; path = Parse/Parser.cpp; sourceTree = "<group>"; };
|
||||||
DE06D4400A8BB55C0050E87E /* Declaration.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Declaration.cpp; path = Parse/Declaration.cpp; sourceTree = "<group>"; };
|
DE06D4400A8BB55C0050E87E /* Declaration.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Declaration.cpp; path = Parse/Declaration.cpp; sourceTree = "<group>"; };
|
||||||
DE06E4D60A8FBF7A0050E87E /* Initializer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Initializer.cpp; path = Parse/Initializer.cpp; sourceTree = "<group>"; };
|
DE06E4D60A8FBF7A0050E87E /* Initializer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Initializer.cpp; path = Parse/Initializer.cpp; sourceTree = "<group>"; };
|
||||||
|
DE06E8130A8FF9330050E87E /* Action.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Action.h; path = clang/Parse/Action.h; sourceTree = "<group>"; };
|
||||||
DE1F22020A7D852A00FBF588 /* Parser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Parser.h; path = clang/Parse/Parser.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>"; };
|
|
||||||
DE1F24810A7DCD3800FBF588 /* Declarations.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Declarations.h; path = clang/Parse/Declarations.h; sourceTree = "<group>"; };
|
DE1F24810A7DCD3800FBF588 /* Declarations.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Declarations.h; path = clang/Parse/Declarations.h; sourceTree = "<group>"; };
|
||||||
DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MultipleIncludeOpt.h; sourceTree = "<group>"; };
|
DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MultipleIncludeOpt.h; sourceTree = "<group>"; };
|
||||||
DEAEECAC0A5AF0E30045101B /* clang.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = clang.h; sourceTree = "<group>"; };
|
DEAEECAC0A5AF0E30045101B /* clang.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = clang.h; sourceTree = "<group>"; };
|
||||||
|
@ -215,10 +215,10 @@
|
||||||
DE1F21F20A7D84E800FBF588 /* Parse */ = {
|
DE1F21F20A7D84E800FBF588 /* Parse */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
DE06E8130A8FF9330050E87E /* Action.h */,
|
||||||
DE1F24810A7DCD3800FBF588 /* Declarations.h */,
|
DE1F24810A7DCD3800FBF588 /* Declarations.h */,
|
||||||
DE06BEF30A8558200050E87E /* Decl.h */,
|
DE06BEF30A8558200050E87E /* Decl.h */,
|
||||||
DE1F22020A7D852A00FBF588 /* Parser.h */,
|
DE1F22020A7D852A00FBF588 /* Parser.h */,
|
||||||
DE1F221F0A7D879000FBF588 /* ParserActions.h */,
|
|
||||||
DE06BECA0A854E4B0050E87E /* Scope.h */,
|
DE06BECA0A854E4B0050E87E /* Scope.h */,
|
||||||
);
|
);
|
||||||
name = Parse;
|
name = Parse;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//===--- ParserActions.h - Parser Actions Interface -------------*- C++ -*-===//
|
//===--- Action.h - Parser Action Interface ---------------------*- C++ -*-===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
|
@ -7,12 +7,12 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// This file defines the ParserActions interface.
|
// This file defines the Action interface.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#ifndef LLVM_CLANG_PARSE_PARSERACTIONS_H
|
#ifndef LLVM_CLANG_PARSE_ACTION_H
|
||||||
#define LLVM_CLANG_PARSE_PARSERACTIONS_H
|
#define LLVM_CLANG_PARSE_ACTION_H
|
||||||
|
|
||||||
#include "clang/Basic/SourceLocation.h"
|
#include "clang/Basic/SourceLocation.h"
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ namespace clang {
|
||||||
// Semantic.
|
// Semantic.
|
||||||
class Declarator;
|
class Declarator;
|
||||||
|
|
||||||
/// ParserActions - As the parser reads the input file and recognizes the
|
/// Action - As the parser reads the input file and recognizes the productions
|
||||||
/// productions of the grammar, it invokes methods on this class to turn the
|
/// of the grammar, it invokes methods on this class to turn the parsed input
|
||||||
/// parsed input into something useful: e.g. a parse tree.
|
/// into something useful: e.g. a parse tree.
|
||||||
///
|
///
|
||||||
/// The callback methods that this class provides are phrased as actions that
|
/// The callback methods that this class provides are phrased as actions that
|
||||||
/// the parser has just done or is about to do when the method is called. They
|
/// the parser has just done or is about to do when the method is called. They
|
||||||
|
@ -33,12 +33,11 @@ namespace clang {
|
||||||
///
|
///
|
||||||
/// All of the methods here are optional, but you must specify information about
|
/// All of the methods here are optional, but you must specify information about
|
||||||
/// whether something is a typedef or not in order for the parse to complete
|
/// whether something is a typedef or not in order for the parse to complete
|
||||||
/// accurately. The EmptyParserActions class does this bare-minimum of
|
/// accurately. The EmptyAction class does this bare-minimum of tracking.
|
||||||
/// tracking.
|
class Action {
|
||||||
class ParserActions {
|
|
||||||
public:
|
public:
|
||||||
/// Out-of-line virtual destructor to provide home for this class.
|
/// Out-of-line virtual destructor to provide home for this class.
|
||||||
virtual ~ParserActions();
|
virtual ~Action();
|
||||||
|
|
||||||
// Types - Though these don't actually enforce strong typing, they document
|
// Types - Though these don't actually enforce strong typing, they document
|
||||||
// what types are required to be identical for the actions.
|
// what types are required to be identical for the actions.
|
||||||
|
|
|
@ -15,11 +15,10 @@
|
||||||
#define LLVM_CLANG_PARSE_PARSER_H
|
#define LLVM_CLANG_PARSE_PARSER_H
|
||||||
|
|
||||||
#include "clang/Lex/Preprocessor.h"
|
#include "clang/Lex/Preprocessor.h"
|
||||||
#include "clang/Parse/ParserActions.h"
|
#include "clang/Parse/Action.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace clang {
|
namespace clang {
|
||||||
class ParserActions;
|
|
||||||
class DeclSpec;
|
class DeclSpec;
|
||||||
class Declarator;
|
class Declarator;
|
||||||
class Scope;
|
class Scope;
|
||||||
|
@ -30,7 +29,7 @@ namespace clang {
|
||||||
///
|
///
|
||||||
class Parser {
|
class Parser {
|
||||||
Preprocessor &PP;
|
Preprocessor &PP;
|
||||||
ParserActions &Actions;
|
Action &Actions;
|
||||||
Diagnostic &Diags;
|
Diagnostic &Diags;
|
||||||
Scope *CurScope;
|
Scope *CurScope;
|
||||||
unsigned short ParenCount, BracketCount, BraceCount;
|
unsigned short ParenCount, BracketCount, BraceCount;
|
||||||
|
@ -39,14 +38,14 @@ class Parser {
|
||||||
/// that this is valid.
|
/// that this is valid.
|
||||||
LexerToken Tok;
|
LexerToken Tok;
|
||||||
public:
|
public:
|
||||||
Parser(Preprocessor &PP, ParserActions &Actions);
|
Parser(Preprocessor &PP, Action &Actions);
|
||||||
~Parser();
|
~Parser();
|
||||||
|
|
||||||
const LangOptions &getLang() const { return PP.getLangOptions(); }
|
const LangOptions &getLang() const { return PP.getLangOptions(); }
|
||||||
|
|
||||||
// Type forwarding. All of these are statically 'void*', but they may all be
|
// Type forwarding. All of these are statically 'void*', but they may all be
|
||||||
// different actual classes based on the actions in place.
|
// different actual classes based on the actions in place.
|
||||||
typedef ParserActions::ExprTy ExprTy;
|
typedef Action::ExprTy ExprTy;
|
||||||
|
|
||||||
// Parsing methods.
|
// Parsing methods.
|
||||||
void ParseTranslationUnit();
|
void ParseTranslationUnit();
|
||||||
|
|
Loading…
Reference in New Issue