LLVM API Documentation

Action.h

Go to the documentation of this file.
00001 //===--- Action.h - The LLVM Compiler Driver --------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open
00006 // Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  Action - encapsulates a single shell command.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_TOOLS_LLVMC2_ACTION_H
00015 #define LLVM_TOOLS_LLVMC2_ACTION_H
00016 
00017 #include <string>
00018 #include <vector>
00019 
00020 namespace llvmc {
00021 
00022   typedef std::vector<std::string> StrVector;
00023 
00024   /// Action - A class that encapsulates a single shell command.
00025   class Action {
00026     /// Command_ - The actual command (for example, 'ls').
00027     std::string Command_;
00028     /// Args_ - Command arguments. Stdout redirection ("> file") is allowed.
00029     std::vector<std::string> Args_;
00030     /// StopCompilation_ - Should we stop compilation after executing
00031     /// this action?
00032     bool StopCompilation_;
00033     /// OutFile_ - The output file name.
00034     std::string OutFile_;
00035 
00036   public:
00037     Action (const std::string& C, const StrVector& A,
00038             bool S, const std::string& O)
00039       : Command_(C), Args_(A), StopCompilation_(S), OutFile_(O)
00040     {}
00041 
00042     /// Execute - Executes the represented action.
00043     int Execute () const;
00044     bool StopCompilation () const { return StopCompilation_; }
00045     const std::string& OutFile() { return OutFile_; }
00046   };
00047 
00048 }
00049 
00050 #endif // LLVM_TOOLS_LLVMC2_ACTION_H