1. 13 Jan, 2020 1 commit
  2. 09 Jan, 2020 3 commits
    • mustiikhalil's avatar
      [Swift] Swift implementation 🎉🎉 (#5603) · 04d80f25
      mustiikhalil authored
      * Implemented the swift version of Flatbuffers
      
      Implemented serailzing, reading, and mutating data from object monster
      
      Fixes mis-aligned pointer issue
      
      Fixes issue when shared strings are removed from table
      
      Adds swift enum, structs code gen
      
      Fixed namespace issues + started implementing the table gen
      
      Added Mutate function to the code generator
      
      Generated linux test cases
      
      Fixed an issue with bools, and structs readers in table writer
      
      Swift docker image added
      
      Updated the test cases, and removed a method parameters in swift
      
      Fixed createVector api when called with scalars
      
      Fixed issues with scalar arrays, and fixed the code gen namespaces, added sample_binary.swift
      
      Cleaned up project
      
      Added enum vectors, and their readers
      
      Refactored code
      
      Added swift into the support document
      
      Added documentation in docs, and fixed a small issue with Data() not being returned correctly
      
      Fixes Lowercase issue, and prevents generating lookups for deprecated keys
      
      * Made all the required funcs to have const + removed unneeded code + fix lowercase func
      
      * Removed transform from lowercased and moved it to function
      
      * Fixes an issue with iOS allocation from read
      
      * Refactored cpp code to be more readable
      
      * casts position into int for position
      
      * Fix enums issue, moves scalar writer code to use memcpy
      
      * Removed c_str from struct function
      
      * Fixed script to generate new objects when ran on travis ci: fix
      
      * Handles deallocating space allocated for structs
      
      * Updated the test cases to adhere to the fileprivate lookup, no mutation for unions, and updated the names of the vector functions
      04d80f25
    • Wouter van Oortmerssen's avatar
      Changed direct calls to strtod to use StringToNumber · 55686100
      Wouter van Oortmerssen authored
      StringToNumber will correctly use locale-insensitive functions
      when available.
      
      Change-Id: I6bde11039a541634186f8f791012af2eb0d86b8d
      55686100
    • emkornfield's avatar
  3. 06 Jan, 2020 3 commits
  4. 02 Jan, 2020 3 commits
    • Robert Winslow's avatar
      Rust: Temporarily disable 2 endianness unit tests (#5695) · 3b458f7a
      Robert Winslow authored
      Rare failures occur on AppVeyor in these functions; the failures appear
      spurious.
      3b458f7a
    • David P. Sicilia's avatar
      [C++17] Add Traits class for Tables and Factory function within it. (#5678) · a5d9d0f7
      David P. Sicilia authored
      * Include flattests_cpp17 in unit tests when C++17 build is enabled.
      
      * [C++17] Generate generic table factory function.
      
      1. For each table, generate a convenient free-standing factory
         function that allows creating the table in a generic way by
         specifying only the type.  This is the first change in a series
         of changes to make Flatbuffers generated C++ code more friendly
         to code bases that make use of C++ template metaprogramming
         techniques to manage the serialization process.  Example:
      
           Before :(
      
             // The name of the Flatbuffers type (and namespace) must
             // be hard-coded when writing the factory function.
             auto monster = MyGame::Example::CreateMonster(fbb, ...);
      
           After  :)
      
             using type_to_create = MyGame::Example::Monster;
             // No namespace needed on CreateByTagType.
             auto monster = CreateByTagType((type_to_create*)nullptr,
                                            fbb, ...);
      
         This feature requires building with C++14 or greater, and thus
         it is guarded behind --cpp-std >= c++17 in the flatbuffers C++
         generator.
      
      2. Fix a CMake bug to include C++17 unit tests in test suite.
      
      * [C++17] Replace standalone variadic factory function with type_traits.
      
      Add a `type_traits` to each table class.  This `type_traits` can be
      populated with various compile-time info about the table.  Initially,
      we have the Create* function and type, but is extensible in the future.
      
      * Remove empty line and fix stale comments.
      
      * Rename type_traits to Traits and move fwd declaration.
      
      * Fix parameter evaluation order issue and use lambda for scope.
      a5d9d0f7
    • Wouter van Oortmerssen's avatar
      Removed code_generators.cpp from library targets · 3cd9b643
      Wouter van Oortmerssen authored
      Change-Id: Ia6e032a77983bf1838b8675f51d1c910acc991d8
      3cd9b643
  5. 31 Dec, 2019 1 commit
    • Max Burke's avatar
      [rust] Make enum names public (#5690) · 355dfd48
      Max Burke authored
      * Bugfix for Rust generation of union fields named with language keywords
      
      Looking at ParseField, it appears that in the case of unions, an extra field with a `UnionTypeFieldSuffix` is added to the type definition, however, if the name of this field is a keyword in the target language, it isn't escaped.
      
      For example, if generating code for rust for a union field named `type`, flatc will generate a (non-keyword escaped) field named `type_type` for this hidden union field, and one (keyword escaped) called `type_` for the actual union contents.
      
      When the union accessors are generated, they refer to this `type_type` field, but they will escape it mistakenly, generating code like this:
      
      ```
        #[inline]
        #[allow(non_snake_case)]
        pub fn type__as_int(&self) -> Option<Int<'a>> {
          if self.type__type() == Type::Int {
            self.type_().map(|u| Int::init_from_table(u))
          } else {
            None
          }
        }
      ```
      
      Which will fail to build because the field is called `self.type_type()`, not `self.type__type()`.
      
      * [Rust] Add crate-relative use statements for FBS includes.
      
      At present if a flatbuffer description includes a reference to a type in
      another file, the generated Rust code needs to be hand-modified to add
      the appropriate `use` statements.
      
      This assumes that the dependencies are built into the same crate, which
      I think is a reasonable assumption?
      
      * Revert "[Rust] Add crate-relative use statements for FBS includes."
      
      This reverts commit d554d79fecf5afd6da6fb993b30b4cd523a5889a.
      
      * Address comments raised in PR
      
      * Update documentation comments per feedback
      
      * Fix typo
      
      * [rust] Make enum variant names public.
      
      * Update generated test files
      
      * Add test for public enum names
      355dfd48
  6. 30 Dec, 2019 1 commit
  7. 27 Dec, 2019 1 commit
  8. 26 Dec, 2019 6 commits
  9. 24 Dec, 2019 3 commits
  10. 23 Dec, 2019 6 commits
  11. 18 Dec, 2019 1 commit
  12. 17 Dec, 2019 2 commits
  13. 15 Dec, 2019 1 commit
    • Max Burke's avatar
      Bugfix for Rust generation of union fields named with language keywords (#5592) · eddebec1
      Max Burke authored
      * Bugfix for Rust generation of union fields named with language keywords
      
      Looking at ParseField, it appears that in the case of unions, an extra field with a `UnionTypeFieldSuffix` is added to the type definition, however, if the name of this field is a keyword in the target language, it isn't escaped.
      
      For example, if generating code for rust for a union field named `type`, flatc will generate a (non-keyword escaped) field named `type_type` for this hidden union field, and one (keyword escaped) called `type_` for the actual union contents.
      
      When the union accessors are generated, they refer to this `type_type` field, but they will escape it mistakenly, generating code like this:
      
      ```
        #[inline]
        #[allow(non_snake_case)]
        pub fn type__as_int(&self) -> Option<Int<'a>> {
          if self.type__type() == Type::Int {
            self.type_().map(|u| Int::init_from_table(u))
          } else {
            None
          }
        }
      ```
      
      Which will fail to build because the field is called `self.type_type()`, not `self.type__type()`.
      
      * [Rust] Add crate-relative use statements for FBS includes.
      
      At present if a flatbuffer description includes a reference to a type in
      another file, the generated Rust code needs to be hand-modified to add
      the appropriate `use` statements.
      
      This assumes that the dependencies are built into the same crate, which
      I think is a reasonable assumption?
      
      * Revert "[Rust] Add crate-relative use statements for FBS includes."
      
      This reverts commit d554d79fecf5afd6da6fb993b30b4cd523a5889a.
      
      * Address comments raised in PR
      
      * Update documentation comments per feedback
      
      * Fix typo
      eddebec1
  14. 13 Dec, 2019 1 commit
  15. 09 Dec, 2019 2 commits
  16. 06 Dec, 2019 1 commit
    • cryptocode's avatar
      Add --force-empty-vectors option (#5653) · a8e800bd
      cryptocode authored
      The rationale for this option is that JSON clients typically want empty arrays (i.e [] in the JSON) instead of missing properties, but not empty strings when the value isn't set.
      --force-empty is kept as-is, i.e. it will force both empty strings and vectors.
      
      Closes #5652
      a8e800bd
  17. 05 Dec, 2019 1 commit
  18. 02 Dec, 2019 3 commits
    • bttk's avatar
      Split Bazel targets into multiple packages (#5640) · 99d11e27
      bttk authored
      * Split Bazel targets into multiple packages
      
      * Merge /include/BUILD back into /BUILD
      99d11e27
    • Google AutoFuzz Team's avatar
      Remove a static_assert (#5643) · 4fd8eb21
      Google AutoFuzz Team authored
      Having a static_assert on MSAN and ASAN prevents
      the fuzzers from being used with different engines,
      like TSAN, UBSAN, … but also with fuzzers that aren't
      using MSAN/ASAN like afl for example.
      4fd8eb21
    • lu-wang-g's avatar
      Flatbuffers Python Object API (#5616) · 65f87035
      lu-wang-g authored
      * Flatbuffers Python Object API
      
      Implement the logic to generate the Python object API that can
      unpack the data from a buf class into an object class, and pack
      the data of an object class to a buf class.
      
      * Fix the build issues
      
      Remove unused parameters and replace auto in the for-loop statement
      with std::string to make it compatible with VS2010.
      
      * Fix the build issues.
      
      * Add support for Array type
      
      Added logic to handle Array type in Python Object API. Updated the
      generated code accordingly.
      
      * Fix the old style casting from int to char
      
      * Fixed another conversion from int to char
      
      * Fixed the import for typing
      
      Importing typing may cause errors when a machine do not have the
      moduel typing installed. This PR fixes the issue by guarding
      "import typing" with the "try/except" statement.
      
      * Fix issue of iterating the vector of import list
      
      * Update the generated examples using generate_code.sh
      
      * Fix the import order for typing
      
      The import list was stored in unordered_set, so that each generated
      codes may have different import order. Therefore, it failed in the
      consistency test where two generated copies need to have exactly the
      same apperance.
      
      * Optimize unpack using numpy
      
      Use numpy to unpack vector whenever it is possible to improve unpack
      performance.
      
      Also, added codegen command for Python specificly in generate_code.sh,
      because --no-includes cannot be turn on for Python.
      
      * Fix the import order
      
      * Update generate_code.bat for windows accordingly
      
      * Replace error message with pass
      
      Avoid printing error message for every Python2 users about typing.
      Replace it with pass.
      65f87035