Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2020-08-21 17:14:13 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2020-08-21 17:33:27 +0300
commita07441568e9933d39372d943c66797598ea9fff8 (patch)
tree227e0d3bdc78390705c82758e758efcd40d4fa30 /spirv_cross_parsed_ir.hpp
parentf0fe4442e32a900f49140f8597d54fefb4ba32d0 (diff)
Overhaul how we deal with reserved identifiers.
- Do not silently drop reserved identifiers in the parser. This makes it possible to reflect identifiers which are reserved by the cross-compiler module. - Instead of dropping the name, emit _RESERVED_IDENTIFIER_FIXUP in the source to make it clear that a name has been rewritten. - Document what is reserved and not.
Diffstat (limited to 'spirv_cross_parsed_ir.hpp')
-rw-r--r--spirv_cross_parsed_ir.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/spirv_cross_parsed_ir.hpp b/spirv_cross_parsed_ir.hpp
index 4880c841..36d6ac7b 100644
--- a/spirv_cross_parsed_ir.hpp
+++ b/spirv_cross_parsed_ir.hpp
@@ -208,6 +208,12 @@ public:
void make_constant_null(uint32_t id, uint32_t type, bool add_to_typed_id_set);
+ void fixup_reserved_names();
+
+ static void sanitize_underscores(std::string &str);
+ static void sanitize_identifier(std::string &str, bool member, bool allow_reserved_prefixes);
+ static bool is_globally_reserved_identifier(std::string &str, bool allow_reserved_prefixes);
+
private:
template <typename T>
T &get(uint32_t id)
@@ -225,6 +231,8 @@ private:
mutable uint32_t loop_iteration_depth_soft = 0;
std::string empty_string;
Bitset cleared_bitset;
+
+ std::unordered_set<uint32_t> meta_needing_name_fixup;
};
} // namespace SPIRV_CROSS_NAMESPACE