Add a stub frontend action for BoostCon, for next week's workshop.

llvm-svn: 103258
This commit is contained in:
Douglas Gregor 2010-05-07 15:41:56 +00:00
parent 5d5b8b1b8c
commit 542ad31597
7 changed files with 43 additions and 0 deletions

View File

@ -296,6 +296,8 @@ def ast_dump : Flag<"-ast-dump">,
HelpText<"Build ASTs and then debug dump them">;
def ast_view : Flag<"-ast-view">,
HelpText<"Build ASTs and view them with GraphViz">;
def boostcon : Flag<"-boostcon">,
HelpText<"BoostCon workshop mode">;
def print_decl_contexts : Flag<"-print-decl-contexts">,
HelpText<"Print DeclContexts and their Decls">;
def emit_pth : Flag<"-emit-pth">,

View File

@ -133,6 +133,12 @@ public:
virtual bool hasCodeCompletionSupport() const { return true; }
};
class BoostConAction : public SyntaxOnlyAction {
protected:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef InFile);
};
/**
* \brief Frontend action adaptor that merges ASTs together.
*

View File

@ -23,6 +23,7 @@ namespace frontend {
ASTPrint, ///< Parse ASTs and print them.
ASTPrintXML, ///< Parse ASTs and print them in XML.
ASTView, ///< Parse ASTs and view them in Graphviz.
BoostCon, ///< BoostCon mode.
DumpRawTokens, ///< Dump out raw tokens.
DumpTokens, ///< Dump out preprocessed tokens.
EmitAssembly, ///< Emit a .s file.

View File

@ -0,0 +1,29 @@
//===-- BoostConAction.cpp - BoostCon Workshop Action -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "clang/Frontend/FrontendActions.h"
#include "clang/AST/ASTConsumer.h"
using namespace clang;
namespace {
class BoostConASTConsumer : public ASTConsumer {
public:
/// HandleTranslationUnit - This method is called when the ASTs for entire
/// translation unit have been parsed.
virtual void HandleTranslationUnit(ASTContext &Ctx);
};
}
ASTConsumer *BoostConAction::CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef InFile) {
return new BoostConASTConsumer();
}
void BoostConASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
fprintf(stderr, "Welcome to BoostCon!\n");
}

View File

@ -5,6 +5,7 @@ add_clang_library(clangFrontend
ASTMerge.cpp
ASTUnit.cpp
AnalysisConsumer.cpp
BoostConAction.cpp
CacheTokens.cpp
CodeGenAction.cpp
CompilerInstance.cpp

View File

@ -308,6 +308,7 @@ static const char *getActionName(frontend::ActionKind Kind) {
case frontend::ASTPrint: return "-ast-print";
case frontend::ASTPrintXML: return "-ast-print-xml";
case frontend::ASTView: return "-ast-view";
case frontend::BoostCon: return "-boostcon";
case frontend::DumpRawTokens: return "-dump-raw-tokens";
case frontend::DumpTokens: return "-dump-tokens";
case frontend::EmitAssembly: return "-S";
@ -937,6 +938,8 @@ ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Diagnostic &Diags) {
Opts.ProgramAction = frontend::ASTPrintXML; break;
case OPT_ast_view:
Opts.ProgramAction = frontend::ASTView; break;
case OPT_boostcon:
Opts.ProgramAction = frontend::BoostCon; break;
case OPT_dump_raw_tokens:
Opts.ProgramAction = frontend::DumpRawTokens; break;
case OPT_dump_tokens:

View File

@ -63,6 +63,7 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) {
case ASTPrint: return new ASTPrintAction();
case ASTPrintXML: return new ASTPrintXMLAction();
case ASTView: return new ASTViewAction();
case BoostCon: return new BoostConAction();
case DumpRawTokens: return new DumpRawTokensAction();
case DumpTokens: return new DumpTokensAction();
case EmitAssembly: return new EmitAssemblyAction();