zcov: / include/clang/Driver/Compilation.h


Files: 1 Branches Taken: 0.0% 0 / 0
Generated: 2010-02-10 01:31 Branches Executed: 0.0% 0 / 0
Line Coverage: 100.0% 15 / 15


Programs: 8 Runs 12072


       1                 : //===--- Compilation.h - Compilation Task Data Structure --------*- 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                 : #ifndef CLANG_DRIVER_COMPILATION_H_
      11                 : #define CLANG_DRIVER_COMPILATION_H_
      12                 : 
      13                 : #include "clang/Driver/Job.h"
      14                 : #include "clang/Driver/Util.h"
      15                 : 
      16                 : #include "llvm/ADT/DenseMap.h"
      17                 : #include "llvm/ADT/SmallVector.h"
      18                 : 
      19                 : namespace llvm {
      20                 :   class raw_ostream;
      21                 : }
      22                 : 
      23                 : namespace clang {
      24                 : namespace driver {
      25                 :   class DerivedArgList;
      26                 :   class Driver;
      27                 :   class InputArgList;
      28                 :   class JobList;
      29                 :   class ToolChain;
      30                 : 
      31                 : /// Compilation - A set of tasks to perform for a single driver
      32                 : /// invocation.
      33                 : class Compilation {
      34                 :   /// The driver we were created by.
      35                 :   const Driver &TheDriver;
      36                 : 
      37                 :   /// The default tool chain.
      38                 :   const ToolChain &DefaultToolChain;
      39                 : 
      40                 :   /// The original (untranslated) input argument list.
      41                 :   InputArgList *Args;
      42                 : 
      43                 :   /// The list of actions.
      44                 :   ActionList Actions;
      45                 : 
      46                 :   /// The root list of jobs.
      47                 :   JobList Jobs;
      48                 : 
      49                 :   /// Cache of translated arguments for a particular tool chain.
      50                 :   llvm::DenseMap<std::pair<const ToolChain*, const char*>,
      51                 :                  DerivedArgList*> TCArgs;
      52                 : 
      53                 :   /// Temporary files which should be removed on exit.
      54                 :   ArgStringList TempFiles;
      55                 : 
      56                 :   /// Result files which should be removed on failure.
      57                 :   ArgStringList ResultFiles;
      58                 : 
      59                 : public:
      60                 :   Compilation(const Driver &D, const ToolChain &DefaultToolChain,
      61                 :               InputArgList *Args);
      62                 :   ~Compilation();
      63                 : 
      64              144:   const Driver &getDriver() const { return TheDriver; }
      65                 : 
      66              571:   const ToolChain &getDefaultToolChain() const { return DefaultToolChain; }
      67                 : 
      68             7222:   const InputArgList &getArgs() const { return *Args; }
      69                 : 
      70              828:   ActionList &getActions() { return Actions; }
      71               34:   const ActionList &getActions() const { return Actions; }
      72                 : 
      73              274:   JobList &getJobs() { return Jobs; }
      74              235:   const JobList &getJobs() const { return Jobs; }
      75                 : 
      76              183:   const ArgStringList &getTempFiles() const { return TempFiles; }
      77                 : 
      78                5:   const ArgStringList &getResultFiles() const { return ResultFiles; }
      79                 : 
      80                 :   /// getArgsForToolChain - Return the derived argument list for the
      81                 :   /// tool chain \arg TC (or the default tool chain, if TC is not
      82                 :   /// specified).
      83                 :   ///
      84                 :   /// \param BoundArch - The bound architecture name, or 0.
      85                 :   const DerivedArgList &getArgsForToolChain(const ToolChain *TC,
      86                 :                                             const char *BoundArch);
      87                 : 
      88                 :   /// addTempFile - Add a file to remove on exit, and returns its
      89                 :   /// argument.
      90               38:   const char *addTempFile(const char *Name) {
      91               38:     TempFiles.push_back(Name);
      92               38:     return Name;
      93                 :   }
      94                 : 
      95                 :   /// addResultFile - Add a file to remove on failure, and returns its
      96                 :   /// argument.
      97              125:   const char *addResultFile(const char *Name) {
      98              125:     ResultFiles.push_back(Name);
      99              125:     return Name;
     100                 :   }
     101                 : 
     102                 :   /// CleanupFileList - Remove the files in the given list.
     103                 :   ///
     104                 :   /// \param IssueErrors - Report failures as errors.
     105                 :   /// \return Whether all files were removed successfully.
     106                 :   bool CleanupFileList(const ArgStringList &Files,
     107                 :                        bool IssueErrors=false) const;
     108                 : 
     109                 :   /// PrintJob - Print one job in -### format.
     110                 :   ///
     111                 :   /// \param OS - The stream to print on.
     112                 :   /// \param J - The job to print.
     113                 :   /// \param Terminator - A string to print at the end of the line.
     114                 :   /// \param Quote - Should separate arguments be quoted.
     115                 :   void PrintJob(llvm::raw_ostream &OS, const Job &J,
     116                 :                 const char *Terminator, bool Quote) const;
     117                 : 
     118                 :   /// ExecuteCommand - Execute an actual command.
     119                 :   ///
     120                 :   /// \param FailingCommand - For non-zero results, this will be set to the
     121                 :   /// Command which failed, if any.
     122                 :   /// \return The result code of the subprocess.
     123                 :   int ExecuteCommand(const Command &C, const Command *&FailingCommand) const;
     124                 : 
     125                 :   /// ExecuteJob - Execute a single job.
     126                 :   ///
     127                 :   /// \param FailingCommand - For non-zero results, this will be set to the
     128                 :   /// Command which failed.
     129                 :   /// \return The accumulated result code of the job.
     130                 :   int ExecuteJob(const Job &J, const Command *&FailingCommand) const;
     131                 : };
     132                 : 
     133                 : } // end namespace driver
     134                 : } // end namespace clang
     135                 : 
     136                 : #endif

Generated: 2010-02-10 01:31 by zcov