@@ -834,6 +834,7 @@ namespace translate {
834834
835835
836836
837+ #if __clang_major__ < 16
837838namespace translate {
838839template <>
839840struct from_object <llvm::Optional<llvm::DIFile::ChecksumInfo<llvm::StringRef>>, std::true_type> {
@@ -873,7 +874,49 @@ struct from_object<llvm::Optional<llvm::DIFile::ChecksumInfo<llvm::StringRef>>,
873874 }
874875};
875876};
877+ #else
878+ namespace translate {
879+ template <>
880+ struct from_object <std::optional<llvm::DIFile::ChecksumInfo<llvm::StringRef>>, std::true_type> {
881+ typedef std::optional<llvm::DIFile::ChecksumInfo<llvm::StringRef>> DeclareType;
882+ DeclareType _v;
883+ std::string _Storage;
884+ from_object (core::T_sp object) {
885+ // printf("%s:%d:%s object = %s\n", __FILE__, __LINE__, __FUNCTION__, core::_rep_(object).c_str());
886+ core::SymbolToEnumConverter_sp converter = gc::As<core::SymbolToEnumConverter_sp>(llvmo::_sym_CSKEnum->symbolValue ());
887+ if (object.nilp ()) {
888+ DeclareType none;
889+ this ->_v = none;
890+ // printf("%s:%d:%s ChecksumInfo RESET this->_v -> %d\n", __FILE__, __LINE__, __FUNCTION__, this->_v.hasValue() );
891+ } else if (gc::IsA<core::Symbol_sp>(object)) {
892+ core::Symbol_sp sobject = gc::As<core::Symbol_sp>(object);
893+ this ->_Storage = sobject->symbolNameAsString ();
894+ llvm::DIFile::ChecksumKind kind = converter->enumForSymbol <llvm::DIFile::ChecksumKind>(sobject);
895+ for ( int p=0 ; p<this ->_Storage .size (); p++ ) {
896+ if (this ->_Storage [p] == ' -' ) this ->_Storage [p] = ' _' ;
897+ }
898+ llvm::DIFile::ChecksumInfo<llvm::StringRef> checksum (kind,this ->_Storage );
899+ this ->_v = checksum;
900+ // printf("%s:%d:%s ChecksumInfo kind = %d str = %s \n", __FILE__, __LINE__, __FUNCTION__, kind, this->_Storage.c_str() );
901+ } else {
902+ SIMPLE_ERROR (" You must pass a valid Checksum like :CSK_MD5" );
903+ }
904+ }
905+ from_object (const from_object& orig) = delete ;
906+ from_object (from_object&& orig) : _Storage(std::move(orig._Storage)), _v(orig._v) {
907+ if (this ->_v .has_value ()) {
908+ // printf("%s:%d:%s from_object move ctor\n", __FILE__, __LINE__, __FUNCTION__ );
909+ llvm::DIFile::ChecksumInfo<llvm::StringRef> checksum (this ->_v ->Kind ,this ->_Storage );
910+ this ->_v = checksum;
911+ } else {
912+ // printf("%s:%d:%s from_object move ctor NIL\n", __FILE__, __LINE__, __FUNCTION__ );
913+ }
914+ }
915+ };
916+ };
917+ #endif
876918
919+ #if __clang_major__ < 16
877920namespace translate {
878921template <>
879922struct from_object <llvm::Optional<llvm::StringRef>, std::true_type> {
@@ -897,6 +940,31 @@ struct from_object<llvm::Optional<llvm::StringRef>, std::true_type> {
897940 }
898941};
899942};
943+ #else
944+ namespace translate {
945+ template <>
946+ struct from_object <std::optional<llvm::StringRef>, std::true_type> {
947+ typedef std::optional<llvm::StringRef> DeclareType;
948+ std::string _Storage;
949+ DeclareType _v;
950+ from_object (core::T_sp object) {
951+ if (object.nilp ()) {
952+ DeclareType none;
953+ _v = none;
954+ } else if (gc::IsA<core::String_sp>(object)) {
955+ _Storage = gc::As<core::String_sp>(object)->get_std_string ();
956+ _v = _Storage;
957+ } else {
958+ SIMPLE_ERROR (" You must pass a String or NIL" );
959+ }
960+ }
961+ from_object (const from_object& orig) = delete ;
962+ from_object (from_object&& orig) : _Storage(std::move(orig._Storage)), _v(orig._v) {
963+ if (_v.has_value ()) _v = _Storage;
964+ }
965+ };
966+ };
967+ #endif
900968
901969// DIContext_O
902970namespace llvmo {
0 commit comments