@@ -864,70 +864,62 @@ TypeSystemClang::GetBuiltinTypeForEncodingAndBitSize(Encoding encoding,
864
864
return CompilerType ();
865
865
}
866
866
867
- lldb::BasicType
868
- TypeSystemClang::GetBasicTypeEnumeration (ConstString name) {
869
- if (name) {
870
- typedef UniqueCStringMap<lldb::BasicType> TypeNameToBasicTypeMap;
871
- static TypeNameToBasicTypeMap g_type_map;
872
- static llvm::once_flag g_once_flag;
873
- llvm::call_once (g_once_flag, []() {
867
+ lldb::BasicType TypeSystemClang::GetBasicTypeEnumeration (llvm::StringRef name) {
868
+ static const llvm::StringMap<lldb::BasicType> g_type_map = {
874
869
// "void"
875
- g_type_map. Append ( ConstString ( " void" ) , eBasicTypeVoid);
870
+ { " void" , eBasicTypeVoid},
876
871
877
872
// "char"
878
- g_type_map. Append ( ConstString ( " char" ) , eBasicTypeChar);
879
- g_type_map. Append ( ConstString ( " signed char" ) , eBasicTypeSignedChar);
880
- g_type_map. Append ( ConstString ( " unsigned char" ) , eBasicTypeUnsignedChar);
881
- g_type_map. Append ( ConstString ( " wchar_t" ) , eBasicTypeWChar);
882
- g_type_map. Append ( ConstString ( " signed wchar_t" ) , eBasicTypeSignedWChar);
883
- g_type_map. Append ( ConstString ( " unsigned wchar_t" ) ,
884
- eBasicTypeUnsignedWChar);
873
+ { " char" , eBasicTypeChar},
874
+ { " signed char" , eBasicTypeSignedChar},
875
+ { " unsigned char" , eBasicTypeUnsignedChar},
876
+ { " wchar_t" , eBasicTypeWChar},
877
+ { " signed wchar_t" , eBasicTypeSignedWChar},
878
+ { " unsigned wchar_t" , eBasicTypeUnsignedWChar} ,
879
+
885
880
// "short"
886
- g_type_map.Append (ConstString (" short" ), eBasicTypeShort);
887
- g_type_map.Append (ConstString (" short int" ), eBasicTypeShort);
888
- g_type_map.Append (ConstString (" unsigned short" ), eBasicTypeUnsignedShort);
889
- g_type_map.Append (ConstString (" unsigned short int" ),
890
- eBasicTypeUnsignedShort);
881
+ {" short" , eBasicTypeShort},
882
+ {" short int" , eBasicTypeShort},
883
+ {" unsigned short" , eBasicTypeUnsignedShort},
884
+ {" unsigned short int" , eBasicTypeUnsignedShort},
891
885
892
886
// "int"
893
- g_type_map. Append ( ConstString ( " int" ) , eBasicTypeInt);
894
- g_type_map. Append ( ConstString ( " signed int" ) , eBasicTypeInt);
895
- g_type_map. Append ( ConstString ( " unsigned int" ) , eBasicTypeUnsignedInt);
896
- g_type_map. Append ( ConstString ( " unsigned" ) , eBasicTypeUnsignedInt);
887
+ { " int" , eBasicTypeInt},
888
+ { " signed int" , eBasicTypeInt},
889
+ { " unsigned int" , eBasicTypeUnsignedInt},
890
+ { " unsigned" , eBasicTypeUnsignedInt},
897
891
898
892
// "long"
899
- g_type_map.Append (ConstString (" long" ), eBasicTypeLong);
900
- g_type_map.Append (ConstString (" long int" ), eBasicTypeLong);
901
- g_type_map.Append (ConstString (" unsigned long" ), eBasicTypeUnsignedLong);
902
- g_type_map.Append (ConstString (" unsigned long int" ),
903
- eBasicTypeUnsignedLong);
893
+ {" long" , eBasicTypeLong},
894
+ {" long int" , eBasicTypeLong},
895
+ {" unsigned long" , eBasicTypeUnsignedLong},
896
+ {" unsigned long int" , eBasicTypeUnsignedLong},
904
897
905
898
// "long long"
906
- g_type_map.Append (ConstString (" long long" ), eBasicTypeLongLong);
907
- g_type_map.Append (ConstString (" long long int" ), eBasicTypeLongLong);
908
- g_type_map.Append (ConstString (" unsigned long long" ),
909
- eBasicTypeUnsignedLongLong);
910
- g_type_map.Append (ConstString (" unsigned long long int" ),
911
- eBasicTypeUnsignedLongLong);
899
+ {" long long" , eBasicTypeLongLong},
900
+ {" long long int" , eBasicTypeLongLong},
901
+ {" unsigned long long" , eBasicTypeUnsignedLongLong},
902
+ {" unsigned long long int" , eBasicTypeUnsignedLongLong},
912
903
913
904
// "int128"
914
- g_type_map. Append ( ConstString ( " __int128_t" ) , eBasicTypeInt128);
915
- g_type_map. Append ( ConstString ( " __uint128_t" ) , eBasicTypeUnsignedInt128);
905
+ { " __int128_t" , eBasicTypeInt128},
906
+ { " __uint128_t" , eBasicTypeUnsignedInt128},
916
907
917
908
// Miscellaneous
918
- g_type_map.Append (ConstString (" bool" ), eBasicTypeBool);
919
- g_type_map.Append (ConstString (" float" ), eBasicTypeFloat);
920
- g_type_map.Append (ConstString (" double" ), eBasicTypeDouble);
921
- g_type_map.Append (ConstString (" long double" ), eBasicTypeLongDouble);
922
- g_type_map.Append (ConstString (" id" ), eBasicTypeObjCID);
923
- g_type_map.Append (ConstString (" SEL" ), eBasicTypeObjCSel);
924
- g_type_map.Append (ConstString (" nullptr" ), eBasicTypeNullPtr);
925
- g_type_map.Sort ();
926
- });
927
-
928
- return g_type_map.Find (name, eBasicTypeInvalid);
929
- }
930
- return eBasicTypeInvalid;
909
+ {" bool" , eBasicTypeBool},
910
+ {" float" , eBasicTypeFloat},
911
+ {" double" , eBasicTypeDouble},
912
+ {" long double" , eBasicTypeLongDouble},
913
+ {" id" , eBasicTypeObjCID},
914
+ {" SEL" , eBasicTypeObjCSel},
915
+ {" nullptr" , eBasicTypeNullPtr},
916
+ };
917
+
918
+ auto iter = g_type_map.find (name);
919
+ if (iter == g_type_map.end ())
920
+ return eBasicTypeInvalid;
921
+
922
+ return iter->second ;
931
923
}
932
924
933
925
uint32_t TypeSystemClang::GetPointerByteSize () {
0 commit comments