]> granicus.if.org Git - clang/commitdiff
Add a stub frontend action for BoostCon, for next week's workshop.
authorDouglas Gregor <dgregor@apple.com>
Fri, 7 May 2010 15:41:56 +0000 (15:41 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 7 May 2010 15:41:56 +0000 (15:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103258 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/CC1Options.td
include/clang/Frontend/FrontendActions.h
include/clang/Frontend/FrontendOptions.h
lib/Frontend/BoostConAction.cpp [new file with mode: 0644]
lib/Frontend/CMakeLists.txt
lib/Frontend/CompilerInvocation.cpp
tools/driver/cc1_main.cpp

index 9ac6ad39ebf0145be8de7e0962f5a158ae76f9fb..b30663a1b633b73cf8579da39f48c3f9fe8e87d2 100644 (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">,
index 3ddd77dc39e00a0673071b708e5e42993e4cb855..b088cd97a25ea66f92b6f5e291ca4c287d63b4e7 100644 (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.
  *
index 60512edd6c1f899e5d44dea828430c753ebd5230..ee69d304fec60d2ef2924efeaef9b001413ae275 100644 (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.
diff --git a/lib/Frontend/BoostConAction.cpp b/lib/Frontend/BoostConAction.cpp
new file mode 100644 (file)
index 0000000..9e4f97d
--- /dev/null
@@ -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");
+}
index b6f1b0db97af550e4c64ec2ecb80d78962a4180d..01592d1f81e43524741d889197ceeaa1b3a9bd3e 100644 (file)
@@ -5,6 +5,7 @@ add_clang_library(clangFrontend
   ASTMerge.cpp
   ASTUnit.cpp
   AnalysisConsumer.cpp
+  BoostConAction.cpp
   CacheTokens.cpp
   CodeGenAction.cpp
   CompilerInstance.cpp
index 92f33d01be0f0d06864d400841dbfd32dfc30a6b..dca607e3cb5e38cec8fd121dc6d901a1e21406d2 100644 (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:
index 144a734b151d12faa3f1296e25f77c304bff8dc4..67dc7c60c71809b32b085b8650da72c1c50f97db 100644 (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();