1 // 2 // Copyright 2020 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_TRANSLATOR_TRANSLATORMETALDIRECT_WRAPMAIN_H_ 8 #define COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_WRAPMAIN_H_ 9 10 #include "compiler/translator/TranslatorMetalDirect/IdGen.h" 11 #include "compiler/translator/tree_util/IntermTraverse.h" 12 13 namespace sh 14 { 15 16 // Changes 17 // void main(args) { main-body } 18 // To 19 // void FRESH_NAME(args) { main-body } 20 // void main(args) { FRESH_NAME(args); } 21 // 22 // This transformation is useful if the original `main` has multiple return paths because this 23 // reduces down to a single path in the new `main`. Nice for inserting cleanup code in `main`. 24 ANGLE_NO_DISCARD bool WrapMain(TCompiler &compiler, IdGen &idGen, TIntermBlock &root); 25 26 } // namespace sh 27 28 #endif // COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_WRAPMAIN_H_ 29