zenilib: zenilib/jni/external/angle/src/compiler/RenameFunction.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RenameFunction.h
Go to the documentation of this file.
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_RENAME_FUNCTION
8 #define COMPILER_RENAME_FUNCTION
9
10 #include "compiler/intermediate.h"
11
12 //
13 // Renames a function, including its declaration and any calls to it.
14 //
15 class RenameFunction : public TIntermTraverser
16 {
17 public:
18 RenameFunction(const TString& oldFunctionName, const TString& newFunctionName)
19 : TIntermTraverser(true, false, false)
20 , mOldFunctionName(oldFunctionName)
21 , mNewFunctionName(newFunctionName) {}
22
23 virtual bool visitAggregate(Visit visit, TIntermAggregate* node)
24 {
25 TOperator op = node->getOp();
26 if ((op == EOpFunction || op == EOpFunctionCall) && node->getName() == mOldFunctionName)
27 node->setName(mNewFunctionName);
28 return true;
29 }
30
31 private:
32 const TString mOldFunctionName;
33 const TString mNewFunctionName;
34 };
35
36 #endif // COMPILER_RENAME_FUNCTION
TOperator
TOperator
Definition: intermediate.h:29
Visit
Visit
Definition: intermediate.h:524
TIntermOperator::getOp
TOperator getOp() const
Definition: intermediate.h:389
EOpFunctionCall
Definition: intermediate.h:32
TIntermAggregate::setName
void setName(const TString &n)
Definition: intermediate.h:471
intermediate.h
TIntermAggregate
Definition: intermediate.h:460
true
#define true
Definition: ftrandom.c:49
EOpFunction
Definition: intermediate.h:33
TIntermAggregate::getName
const TString & getName() const
Definition: intermediate.h:472
TIntermTraverser
Definition: intermediate.h:539
TString
std::basic_string< char, std::char_traits< char >, TStringAllocator > TString
Definition: Common.h:41
RenameFunction::RenameFunction
RenameFunction(const TString &oldFunctionName, const TString &newFunctionName)
Definition: RenameFunction.h:18
RenameFunction
Definition: RenameFunction.h:15
RenameFunction::visitAggregate
virtual bool visitAggregate(Visit visit, TIntermAggregate *node)
Definition: RenameFunction.h:23
false
#define false
Definition: ftrandom.c:50