zcov: / include/clang/Basic/MacroBuilder.h


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


Programs: 4 Runs 6036


       1                 : //===--- MacroBuilder.h - CPP Macro building utility ------------*- 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                 : //  This file defines the MacroBuilder utility class.
      11                 : //
      12                 : //===----------------------------------------------------------------------===//
      13                 : 
      14                 : #ifndef LLVM_CLANG_BASIC_MACROBUILDER_H
      15                 : #define LLVM_CLANG_BASIC_MACROBUILDER_H
      16                 : 
      17                 : #include "llvm/ADT/Twine.h"
      18                 : #include "llvm/Support/raw_ostream.h"
      19                 : 
      20                 : namespace clang {
      21                 : 
      22                 : class MacroBuilder {
      23                 :   llvm::raw_ostream &Out;
      24                 : public:
      25             2520:   MacroBuilder(llvm::raw_ostream &Output) : Out(Output) {}
      26                 : 
      27                 :   /// Append a #define line for macro of the form "#define Name Value\n".
      28           265104:   void defineMacro(const llvm::Twine &Name, const llvm::Twine &Value = "1") {
      29           265104:     Out << "#define " << Name << ' ' << Value << '\n';
      30           265104:   }
      31                 : 
      32                 :   /// Append a #undef line for Name.  Name should be of the form XXX
      33                 :   /// and we emit "#undef XXX".
      34                0:   void undefineMacro(const llvm::Twine &Name) {
      35                0:     Out << "#undef " << Name << '\n';
      36                0:   }
      37                 : 
      38                 :   /// Directly append Str and a newline to the underlying buffer.
      39            10146:   void append(const llvm::Twine &Str) {
      40            10146:     Out << Str << '\n';
      41            10146:   }
      42                 : };
      43                 : 
      44                 : }  // end namespace clang
      45                 : 
      46                 : #endif

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