Path: blob/main_old/src/compiler/preprocessor/Macro.cpp
1693 views
//1// Copyright 2011 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56#include "compiler/preprocessor/Macro.h"78#include "common/angleutils.h"9#include "compiler/preprocessor/Token.h"1011namespace angle12{1314namespace pp15{1617Macro::Macro() : predefined(false), disabled(false), expansionCount(0), type(kTypeObj) {}1819Macro::~Macro() {}2021bool Macro::equals(const Macro &other) const22{23return (type == other.type) && (name == other.name) && (parameters == other.parameters) &&24(replacements == other.replacements);25}2627void PredefineMacro(MacroSet *macroSet, const char *name, int value)28{29Token token;30token.type = Token::CONST_INT;31token.text = ToString(value);3233std::shared_ptr<Macro> macro = std::make_shared<Macro>();34macro->predefined = true;35macro->type = Macro::kTypeObj;36macro->name = name;37macro->replacements.push_back(token);3839(*macroSet)[name] = macro;40}4142} // namespace pp4344} // namespace angle454647