@@ -40,6 +40,11 @@ inline bool is_h5_attr_name(llvm::StringRef name) {
4040 || name == " serialize_full" ;
4141}
4242
43+ inline bool is_rlp_attr_name (llvm::StringRef name) {
44+ return name == " name" || name == " ignore" || name == " doc"
45+ || name == " alias" || name == " required" || name == " timestamp" ;
46+ }
47+
4348inline bool is_json_attr_name (llvm::StringRef name) {
4449 return name == " name" || name == " ignore" || name == " doc"
4550 || name == " alias" || name == " version" || name == " name_all"
@@ -176,6 +181,10 @@ inline std::string rewrite_one_attr(llvm::StringRef spec) {
176181 llvm::StringRef leading = spec.substr (0 , start);
177182 llvm::StringRef body = spec.substr (start);
178183
184+ bool is_h5 = body.starts_with (" h5::" );
185+ bool is_rlp = body.starts_with (" rlp::" );
186+ if (!is_h5 && !is_rlp) return spec.str ();
187+ llvm::StringRef ns = is_h5 ? " h5::" : " rlp::" ;
179188 bool is_h5 = body.starts_with (" h5::" );
180189 bool is_json = body.starts_with (" json::" );
181190 if (!is_h5 && !is_json) return spec.str ();
@@ -205,6 +214,8 @@ inline std::string rewrite_one_attr(llvm::StringRef spec) {
205214 if (i == 0 ) return spec.str ();
206215 llvm::StringRef name = body.substr (0 , i);
207216 if (is_h5 && !is_h5_attr_name (name)) return spec.str ();
217+ if (is_rlp && !is_rlp_attr_name (name)) return spec.str ();
218+ if (is_h5 && !is_h5_attr_name (name)) return spec.str ();
208219 if (is_json && !is_json_attr_name (name)) return spec.str ();
209220 if (is_h5 && !is_h5_attr_name (name)) return spec.str ();
210221 if (is_msgpack && !is_msgpack_attr_name (name)) return spec.str ();
@@ -283,6 +294,7 @@ inline std::string rewrite(llvm::StringRef src) {
283294 continue ;
284295 }
285296 llvm::StringRef block = src.substr (i + 2 , close - i - 2 );
297+ if (block.contains (" h5::" ) || block.contains (" rlp::" )) {
286298 if (block.contains (" h5::" ) || block.contains (" json::" )) {
287299 if (block.contains (" h5::" ) || block.contains (" msgpack::" )) {
288300 if (block.contains (" h5::" ) || block.contains (" cbor::" )) {
@@ -320,6 +332,7 @@ inline void install_virtual_files(clang::tooling::ClangTool& Tool,
320332 for (const auto & p : paths) {
321333 std::string content = read_file (p);
322334 if (content.empty ()) continue ;
335+ if (content.find (" h5::" ) == std::string::npos && content.find (" rlp::" ) == std::string::npos) continue ;
323336 if (content.find (" h5::" ) == std::string::npos && content.find (" json::" ) == std::string::npos) continue ;
324337 if (content.find (" h5::" ) == std::string::npos && content.find (" msgpack::" ) == std::string::npos) continue ;
325338 if (content.find (" h5::" ) == std::string::npos && content.find (" cbor::" ) == std::string::npos) continue ;
0 commit comments