MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ParseCppClass

Function ParseCppClass

tensorflow/compiler/aot/codegen.cc:745–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

743}
744
745Status ParseCppClass(const string& cpp_class, string* class_name,
746 std::vector<string>* namespaces) {
747 class_name->clear();
748 namespaces->clear();
749 if (cpp_class.empty()) {
750 return errors::InvalidArgument("empty cpp_class: " + cpp_class);
751 }
752 std::vector<string> parts = absl::StrSplit(cpp_class, "::");
753 if (parts.front().empty()) {
754 // Allow a fully qualified name that starts with "::".
755 parts.erase(parts.begin());
756 }
757 for (int i = 0; i < parts.size(); ++i) {
758 if (i < parts.size() - 1) {
759 TF_RETURN_IF_ERROR(ValidateCppIdent(
760 parts[i], "in namespace component of cpp_class: " + cpp_class));
761 namespaces->push_back(parts[i]);
762 } else {
763 TF_RETURN_IF_ERROR(ValidateCppIdent(
764 parts[i], "in class name of cpp_class: " + cpp_class));
765 *class_name = parts[i];
766 }
767 }
768 return Status::OK();
769}
770
771Status ValidateCppIdent(absl::string_view ident, absl::string_view msg) {
772 if (ident.empty()) {

Callers 3

MainFunction · 0.85
ExpectOKMethod · 0.85
ExpectFailMethod · 0.85

Calls 9

InvalidArgumentFunction · 0.85
ValidateCppIdentFunction · 0.85
clearMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by 2

ExpectOKMethod · 0.68
ExpectFailMethod · 0.68