zcov: / include/clang/Frontend/PreprocessorOptions.h


Files: 1 Branches Taken: 0.0% 0 / 0
Generated: 2010-02-10 01:31 Branches Executed: 0.0% 0 / 0
Line Coverage: 86.4% 19 / 22


Programs: 9 Runs 14969


       1                 : //===--- PreprocessorOptionms.h ---------------------------------*- 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 LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
      11                 : #define LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
      12                 : 
      13                 : #include "llvm/ADT/StringRef.h"
      14                 : #include <cassert>
      15                 : #include <string>
      16                 : #include <utility>
      17                 : #include <vector>
      18                 : 
      19                 : namespace llvm {
      20                 :   class MemoryBuffer;
      21                 : }
      22                 : 
      23                 : namespace clang {
      24                 : 
      25                 : class Preprocessor;
      26                 : class LangOptions;
      27                 : 
      28                 : /// PreprocessorOptions - This class is used for passing the various options
      29                 : /// used in preprocessor initialization to InitializePreprocessor().
      30             2532: class PreprocessorOptions {
      31                 : public:
      32                 :   std::vector<std::pair<std::string, bool/*isUndef*/> > Macros;
      33                 :   std::vector<std::string> Includes;
      34                 :   std::vector<std::string> MacroIncludes;
      35                 : 
      36                 :   unsigned UsePredefines : 1; /// Initialize the preprocessor with the compiler
      37                 :                               /// and target specific predefines.
      38                 : 
      39                 :   /// The implicit PCH included at the start of the translation unit, or empty.
      40                 :   std::string ImplicitPCHInclude;
      41                 : 
      42                 :   /// The implicit PTH input included at the start of the translation unit, or
      43                 :   /// empty.
      44                 :   std::string ImplicitPTHInclude;
      45                 : 
      46                 :   /// If given, a PTH cache file to use for speeding up header parsing.
      47                 :   std::string TokenCache;
      48                 : 
      49                 :   /// \brief The set of file remappings, which take existing files on
      50                 :   /// the system (the first part of each pair) and gives them the
      51                 :   /// contents of other files on the system (the second part of each
      52                 :   /// pair).
      53                 :   std::vector<std::pair<std::string, std::string> >  RemappedFiles;
      54                 : 
      55                 :   /// \brief The set of file-to-buffer remappings, which take existing files
      56                 :   /// on the system (the first part of each pair) and gives them the contents
      57                 :   /// of the specified memory buffer (the second part of each pair).
      58                 :   std::vector<std::pair<std::string, const llvm::MemoryBuffer *> > 
      59                 :     RemappedFileBuffers;
      60                 :   
      61                 :   typedef std::vector<std::pair<std::string, std::string> >::const_iterator
      62                 :     remapped_file_iterator;
      63             2520:   remapped_file_iterator remapped_file_begin() const { 
      64             2520:     return RemappedFiles.begin();
      65                 :   }
      66             2520:   remapped_file_iterator remapped_file_end() const { 
      67             2520:     return RemappedFiles.end();
      68                 :   }
      69                 : 
      70                 :   typedef std::vector<std::pair<std::string, const llvm::MemoryBuffer *> >::
      71                 :                                   const_iterator remapped_file_buffer_iterator;
      72             2520:   remapped_file_buffer_iterator remapped_file_buffer_begin() const {
      73             2520:     return RemappedFileBuffers.begin();
      74                 :   }
      75             2520:   remapped_file_buffer_iterator remapped_file_buffer_end() const {
      76             2520:     return RemappedFileBuffers.end();
      77                 :   }
      78                 :   
      79                 : public:
      80             2532:   PreprocessorOptions() : UsePredefines(true) {}
      81                 : 
      82               78:   void addMacroDef(llvm::StringRef Name) {
      83               78:     Macros.push_back(std::make_pair(Name, false));
      84               78:   }
      85                0:   void addMacroUndef(llvm::StringRef Name) {
      86                0:     Macros.push_back(std::make_pair(Name, true));
      87                0:   }
      88                6:   void addRemappedFile(llvm::StringRef From, llvm::StringRef To) {
      89                6:     RemappedFiles.push_back(std::make_pair(From, To));
      90                6:   }
      91                3:   void addRemappedFile(llvm::StringRef From, const llvm::MemoryBuffer * To) {
      92                3:     RemappedFileBuffers.push_back(std::make_pair(From, To));
      93                3:   }
      94                 : };
      95                 : 
      96                 : } // end namespace clang
      97                 : 
      98                 : #endif

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