SPIRV-Tools/source
qining 1773b95737 Pull out the number parsing logic
Pull out the number parsing logic from
AssemblyContext::binaryEncodeNumericLiteral() to utilities.

The new utility function: `ParseAndEncodeNumber()` now accepts:
  * number text to parse
  * number type
  * a emit function, which is a function which will be called with each
    parsed uint32 word.
  * a pointer to std::string to be overwritten with error messages.
    (pass nullptr if expect no error message)
and returns:
  * an enum result type to indicate the status

Type/Structs moved to utility:
  * template<typename T> class ClampToZeroIfUnsignedType

New type:
* enum EncodeNumberStatus: success or error code
* NumberType: hold the number type information for the number to be parsed.
 * several helper functions are also added for NumberType.

Functions moved to utility:
  * Helpers:
    * template<typename T> checkRangeAndIfHexThenSignExtend() -> CheckRangeAndIfHex....()
  * Interfaces:
    * template<typename T> parseNumber() -> ParseNumber()
    * binaryEncodeIntegerLiteral() -> ParseAndEncodeIntegerNumber()
    * binaryEncodeFloatingPointLiteral() -> ParseAndEncodeFloatingPointNumber()
    * binaryEncodeNumericLiteral() -> ParseAndEncodeNumber()

Tests added/moved to test/ParseNumber.cpp, including tests for:
* ParseNumber(): This is moved from TextToBinary.cpp to ParseNumber.cpp
* ParseAndEncodeIntegerNumber(): New added
* ParseAndEncodeFloatingPointNumber(): New added
* ParseAndEncodeNumber(): New added

Note that the error messages are kept almost the same as before, but
they may be inappropriate for an utility function. Those will be fixed
in another CL.
2016-09-08 18:42:54 -04:00
..
opt Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
util Pull out the number parsing logic 2016-09-08 18:42:54 -04:00
val Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
assembly_grammar.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
assembly_grammar.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
binary.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
binary.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
CMakeLists.txt Pull out the number parsing logic 2016-09-08 18:42:54 -04:00
diagnostic.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
diagnostic.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
disassemble.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
enum_set.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
enum_set.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
ext_inst.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
ext_inst.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
extinst-1.0.opencl.std.grammar.json Fix OpenCL pow and pown arguments 2016-06-14 12:14:38 -04:00
instruction.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
instruction.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
macro.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
name_mapper.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
name_mapper.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
opcode.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
opcode.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
operand.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
operand.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
print.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
print.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
software_version.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
spirv_constant.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
spirv_definition.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
spirv_endian.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
spirv_endian.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
spirv_target_env.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
spirv_target_env.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
table.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
table.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
text_handler.cpp Pull out the number parsing logic 2016-09-08 18:42:54 -04:00
text_handler.h Pull out the number parsing logic 2016-09-08 18:42:54 -04:00
text.cpp Pull out the number parsing logic 2016-09-08 18:42:54 -04:00
text.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
validate_cfg.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
validate_id.cpp Kill the spvCheck macro which is just alias to if-statement. 2016-09-07 11:12:54 -04:00
validate_instruction.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
validate_layout.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
validate.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
validate.h Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00