tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Macro.cpp (1105B)


      1 //
      2 // Copyright 2011 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 #include "compiler/preprocessor/Macro.h"
      8 
      9 #include "common/angleutils.h"
     10 #include "compiler/preprocessor/Token.h"
     11 
     12 namespace angle
     13 {
     14 
     15 namespace pp
     16 {
     17 
     18 Macro::Macro() : predefined(false), disabled(false), expansionCount(0), type(kTypeObj) {}
     19 
     20 Macro::~Macro() {}
     21 
     22 bool Macro::equals(const Macro &other) const
     23 {
     24    return (type == other.type) && (name == other.name) && (parameters == other.parameters) &&
     25           (replacements == other.replacements);
     26 }
     27 
     28 void PredefineMacro(MacroSet *macroSet, const char *name, int value)
     29 {
     30    Token token;
     31    token.type = Token::CONST_INT;
     32    token.text = ToString(value);
     33 
     34    std::shared_ptr<Macro> macro = std::make_shared<Macro>();
     35    macro->predefined            = true;
     36    macro->type                  = Macro::kTypeObj;
     37    macro->name                  = name;
     38    macro->replacements.push_back(token);
     39 
     40    (*macroSet)[name] = macro;
     41 }
     42 
     43 }  // namespace pp
     44 
     45 }  // namespace angle