LCOV - code coverage report
Current view: top level - gfx/angle/src/compiler/preprocessor - MacroExpander.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
       3             : // Use of this source code is governed by a BSD-style license that can be
       4             : // found in the LICENSE file.
       5             : //
       6             : 
       7             : #ifndef COMPILER_PREPROCESSOR_MACROEXPANDER_H_
       8             : #define COMPILER_PREPROCESSOR_MACROEXPANDER_H_
       9             : 
      10             : #include <memory>
      11             : #include <vector>
      12             : 
      13             : #include "compiler/preprocessor/Lexer.h"
      14             : #include "compiler/preprocessor/Macro.h"
      15             : 
      16             : namespace pp
      17             : {
      18             : 
      19             : class Diagnostics;
      20             : struct SourceLocation;
      21             : 
      22             : class MacroExpander : public Lexer
      23             : {
      24             :   public:
      25             :     MacroExpander(Lexer *lexer,
      26             :                   MacroSet *macroSet,
      27             :                   Diagnostics *diagnostics,
      28             :                   int allowedMacroExpansionDepth);
      29             :     ~MacroExpander() override;
      30             : 
      31             :     void lex(Token *token) override;
      32             : 
      33             :   private:
      34             :     void getToken(Token *token);
      35             :     void ungetToken(const Token &token);
      36             :     bool isNextTokenLeftParen();
      37             : 
      38             :     bool pushMacro(const Macro &macro, const Token &identifier);
      39             :     void popMacro();
      40             : 
      41             :     bool expandMacro(const Macro &macro,
      42             :                      const Token &identifier,
      43             :                      std::vector<Token> *replacements);
      44             : 
      45             :     typedef std::vector<Token> MacroArg;
      46             :     bool collectMacroArgs(const Macro &macro,
      47             :                           const Token &identifier,
      48             :                           std::vector<MacroArg> *args,
      49             :                           SourceLocation *closingParenthesisLocation);
      50             :     void replaceMacroParams(const Macro &macro,
      51             :                             const std::vector<MacroArg> &args,
      52             :                             std::vector<Token> *replacements);
      53             : 
      54           0 :     struct MacroContext
      55             :     {
      56             :         MacroContext();
      57             :         bool empty() const;
      58             :         const Token &get();
      59             :         void unget();
      60             : 
      61             :         const Macro *macro;
      62             :         std::size_t index;
      63             :         std::vector<Token> replacements;
      64             :     };
      65             : 
      66             :     Lexer *mLexer;
      67             :     MacroSet *mMacroSet;
      68             :     Diagnostics *mDiagnostics;
      69             : 
      70             :     std::unique_ptr<Token> mReserveToken;
      71             :     std::vector<MacroContext *> mContextStack;
      72             :     size_t mTotalTokensInContexts;
      73             : 
      74             :     int mAllowedMacroExpansionDepth;
      75             : 
      76             :     bool mDeferReenablingMacros;
      77             :     std::vector<const Macro *> mMacrosToReenable;
      78             : 
      79             :     class ScopedMacroReenabler;
      80             : };
      81             : 
      82             : }  // namespace pp
      83             : 
      84             : #endif  // COMPILER_PREPROCESSOR_MACROEXPANDER_H_

Generated by: LCOV version 1.13