summaryrefslogtreecommitdiffstats
path: root/Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Macro.cpp
blob: fccca966dd9bee297992f2dd57c8323cb42341e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

#include "Macro.h"

#include <algorithm>

#include "stl_utils.h"

namespace pp
{

Macro::Macro(Type type,
             std::string* name,
             TokenVector* parameters,
             TokenVector* replacements)
    : mType(type),
      mName(name),
      mParameters(parameters),
      mReplacements(replacements)
{
}

Macro::~Macro()
{
    delete mName;

    if (mParameters)
    {
        std::for_each(mParameters->begin(), mParameters->end(), Delete());
        delete mParameters;
    }

    if (mReplacements)
    {
        std::for_each(mReplacements->begin(), mReplacements->end(), Delete());
        delete mReplacements;
    }
}

}  // namespace pp