Blender V5.3
symbol_template.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "ast.hh"
12#include "diagnostic.hh"
13#include "symbol_variable.hh"
14
15#include <unordered_map>
16
17namespace bsl {
18
19struct SymbolTable;
20struct SymbolScope;
21struct SymbolClass;
22struct SymbolFunction;
23
28template<typename T> struct SymbolTemplate {
29 /* Definition. */
31
32 unordered_map<string, T *> instances;
33
34 /* For argument dependent lookup. Maps a template argument to a function argument. */
36
38
39 bool is_adl_possible() const
40 {
41 return !temp_arg_index_in_fn_arg.empty();
42 }
43
45 const SymbolScope &scope,
46 const SymbolTable &table) const;
49 const SymbolScope &scope) const;
50
51 private:
52 ast::IdQualified id() const
53 {
54 if (decl.is_class()) {
55 return ast::ClassDecl(decl.decl()).identifier();
56 }
57 return ast::FuncDecl(decl.decl()).identifier();
58 }
59};
60
63
64} // namespace bsl
Definition codegen.cc:18
SymbolTemplate< SymbolClass > SymbolClassTemplate
SymbolTemplate< SymbolFunction > SymbolFunctionTemplate
Result< T * > lookup_adl(const SymbolTable &symbols, ast::FuncParamList list, const SymbolScope &scope) const
bool is_adl_possible() const
SymbolTemplate(ast::TemplateDecl temp)
unordered_map< string, SymbolClass * > instances
ResultPair< T *, string > lookup_inst(ast::TemplateParamList list, const SymbolScope &scope, const SymbolTable &table) const