Export of internal Abseil changes
-- 832be2d52d7695cf72fd70248909791fb8ad1003 by Gennadiy Rozental <rogeeff@google.com>: Migrate some FlagImpl fields to bit fields. To save padding space we are migrating some fields representing bool and enums into bit fields. Eventually we'll use remaining padding space for call_once control flag. No other semantic changes made in this CL. PiperOrigin-RevId: 293878165 -- 09162bba5fd8eddacfd732d46fcfeb33074a259f by Samuel Benzaquen <sbenza@google.com>: Correctly initialize the `length_mod` member. Now that it is a raw enum, the default initialization is not enough. PiperOrigin-RevId: 293827817 -- 842b7b805d75c5ab670c52ccd7368cdeba11853d by Matthew Brown <matthewbr@google.com>: Move str_format_internal::LengthMod from extension.h to parser.h; change to enum PiperOrigin-RevId: 293697274 GitOrigin-RevId: 832be2d52d7695cf72fd70248909791fb8ad1003 Change-Id: I90899519e9480543e22638616fdf31a41e7f75c0
This commit is contained in:
		
							parent
							
								
									24713a7036
								
							
						
					
					
						commit
						d95d156716
					
				
					 9 changed files with 120 additions and 132 deletions
				
			
		|  | @ -18,7 +18,8 @@ ABSL_NAMESPACE_BEGIN | |||
| namespace str_format_internal { | ||||
| 
 | ||||
| using CC = ConversionChar::Id; | ||||
| using LM = LengthMod::Id; | ||||
| using LM = LengthMod; | ||||
| 
 | ||||
| ABSL_CONST_INIT const ConvTag kTags[256] = { | ||||
|     {},    {},    {},    {},    {},    {},    {},    {},     // 00-07
 | ||||
|     {},    {},    {},    {},    {},    {},    {},    {},     // 08-0f
 | ||||
|  | @ -205,11 +206,11 @@ flags_done: | |||
|     using str_format_internal::LengthMod; | ||||
|     LengthMod length_mod = tag.as_length(); | ||||
|     ABSL_FORMAT_PARSER_INTERNAL_GET_CHAR(); | ||||
|     if (c == 'h' && length_mod.id() == LengthMod::h) { | ||||
|       conv->length_mod = LengthMod::FromId(LengthMod::hh); | ||||
|     if (c == 'h' && length_mod == LengthMod::h) { | ||||
|       conv->length_mod = LengthMod::hh; | ||||
|       ABSL_FORMAT_PARSER_INTERNAL_GET_CHAR(); | ||||
|     } else if (c == 'l' && length_mod.id() == LengthMod::l) { | ||||
|       conv->length_mod = LengthMod::FromId(LengthMod::ll); | ||||
|     } else if (c == 'l' && length_mod == LengthMod::l) { | ||||
|       conv->length_mod = LengthMod::ll; | ||||
|       ABSL_FORMAT_PARSER_INTERNAL_GET_CHAR(); | ||||
|     } else { | ||||
|       conv->length_mod = length_mod; | ||||
|  | @ -228,6 +229,32 @@ flags_done: | |||
| 
 | ||||
| }  // namespace
 | ||||
| 
 | ||||
| std::string LengthModToString(LengthMod v) { | ||||
|   switch (v) { | ||||
|     case LengthMod::h: | ||||
|       return "h"; | ||||
|     case LengthMod::hh: | ||||
|       return "hh"; | ||||
|     case LengthMod::l: | ||||
|       return "l"; | ||||
|     case LengthMod::ll: | ||||
|       return "ll"; | ||||
|     case LengthMod::L: | ||||
|       return "L"; | ||||
|     case LengthMod::j: | ||||
|       return "j"; | ||||
|     case LengthMod::z: | ||||
|       return "z"; | ||||
|     case LengthMod::t: | ||||
|       return "t"; | ||||
|     case LengthMod::q: | ||||
|       return "q"; | ||||
|     case LengthMod::none: | ||||
|       return ""; | ||||
|   } | ||||
|   return ""; | ||||
| } | ||||
| 
 | ||||
| const char *ConsumeUnboundConversion(const char *p, const char *end, | ||||
|                                      UnboundConversion *conv, int *next_arg) { | ||||
|   if (*next_arg < 0) return ConsumeConversion<true>(p, end, conv, next_arg); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue