1 // Copyright 2021 The Tint Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef SRC_AST_INTERNAL_DECORATION_H_ 16 #define SRC_AST_INTERNAL_DECORATION_H_ 17 18 #include <string> 19 20 #include "src/ast/decoration.h" 21 22 namespace tint { 23 namespace ast { 24 25 /// A decoration used to indicate that a function is tint-internal. 26 /// These decorations are not produced by generators, but instead are usually 27 /// created by transforms for consumption by a particular backend. 28 class InternalDecoration : public Castable<InternalDecoration, Decoration> { 29 public: 30 /// Constructor 31 /// @param program_id the identifier of the program that owns this node 32 explicit InternalDecoration(ProgramID program_id); 33 34 /// Destructor 35 ~InternalDecoration() override; 36 37 /// @return a short description of the internal decoration which will be 38 /// displayed in WGSL as `[[internal(<name>)]]` (but is not parsable). 39 virtual std::string InternalName() const = 0; 40 41 /// @returns the WGSL name for the decoration 42 std::string Name() const override; 43 }; 44 45 } // namespace ast 46 } // namespace tint 47 48 #endif // SRC_AST_INTERNAL_DECORATION_H_ 49