blob: dfc117a0b06ccfcbbf10d93033aa492b3065539c [file] [log] [blame]
Daniel Dunbar4ee34612010-02-25 04:37:45 +00001//===--- CodeGenAction.h - LLVM Code Generation Frontend Action -*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "clang/Frontend/FrontendAction.h"
Daniel Dunbarb954e982010-02-25 04:37:50 +000011#include "llvm/ADT/OwningPtr.h"
12
13namespace llvm {
14 class Module;
15}
Daniel Dunbar4ee34612010-02-25 04:37:45 +000016
17namespace clang {
18
19class CodeGenAction : public ASTFrontendAction {
20private:
21 unsigned Act;
Daniel Dunbarb954e982010-02-25 04:37:50 +000022 llvm::OwningPtr<llvm::Module> TheModule;
Daniel Dunbar4ee34612010-02-25 04:37:45 +000023
24protected:
25 CodeGenAction(unsigned _Act);
26
27 virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
28 llvm::StringRef InFile);
Daniel Dunbarb954e982010-02-25 04:37:50 +000029
30 virtual void EndSourceFileAction();
31
32public:
Chandler Carruthf84df9f2010-02-26 08:51:12 +000033 ~CodeGenAction();
34
Daniel Dunbarb954e982010-02-25 04:37:50 +000035 /// takeModule - Take the generated LLVM module, for use after the action has
36 /// been run. The result may be null on failure.
37 llvm::Module *takeModule();
Daniel Dunbar4ee34612010-02-25 04:37:45 +000038};
39
40class EmitAssemblyAction : public CodeGenAction {
41public:
42 EmitAssemblyAction();
43};
44
45class EmitBCAction : public CodeGenAction {
46public:
47 EmitBCAction();
48};
49
50class EmitLLVMAction : public CodeGenAction {
51public:
52 EmitLLVMAction();
53};
54
55class EmitLLVMOnlyAction : public CodeGenAction {
56public:
57 EmitLLVMOnlyAction();
58};
59
Daniel Dunbar32148ce2010-05-25 18:41:01 +000060class EmitCodeGenOnlyAction : public CodeGenAction {
61public:
62 EmitCodeGenOnlyAction();
63};
64
Daniel Dunbar4ee34612010-02-25 04:37:45 +000065class EmitObjAction : public CodeGenAction {
66public:
67 EmitObjAction();
68};
69
70}