move read/writeEmbedded[References]From/ToParcel out

from hidl_string, hidl_vec, and structs.

* Add a hwtypes.h in the autogenerated files, which
  contains the read/writeEmbeddedFrom/ToParcel
  methods for structs defined in types.h.

* Fixes the hack that remove the warnings when compiling
  the generated code (useParentInEmitResolveReferencesEmbedded())
  and add one more hack (useNameInEmitReaderWriterEmbedded())

* Some clean-up on Scope.cpp (add a forEachType function)

Test: mma
Test: hidl_test

Bug: 32756130

Change-Id: Icfd116b5d92fef78d257337c3f2ef02071f7600b
15 files changed
tree: e298b88f42b0e47a28a1a1e9d60cae0d41ed384b
  1. c2hal/
  2. test/
  3. utils/
  4. Android.bp
  5. Annotation.cpp
  6. Annotation.h
  7. ArrayType.cpp
  8. ArrayType.h
  9. AST.cpp
  10. AST.h
  11. CompoundType.cpp
  12. CompoundType.h
  13. ConstantExpression.cpp
  14. ConstantExpression.h
  15. Coordinator.cpp
  16. Coordinator.h
  17. EnumType.cpp
  18. EnumType.h
  19. FQName.cpp
  20. FQName.h
  21. generateCpp.cpp
  22. generateCppImpl.cpp
  23. generateJava.cpp
  24. generateVts.cpp
  25. GenericBinder.cpp
  26. GenericBinder.h
  27. HandleType.cpp
  28. HandleType.h
  29. hidl-gen_l.ll
  30. hidl-gen_y.yy
  31. Interface.cpp
  32. Interface.h
  33. Location.h
  34. main.cpp
  35. Method.cpp
  36. Method.h
  37. MODULE_LICENSE_APACHE2
  38. NamedType.cpp
  39. NamedType.h
  40. NOTICE
  41. PredefinedType.cpp
  42. PredefinedType.h
  43. README.md
  44. RefType.cpp
  45. RefType.h
  46. ScalarType.cpp
  47. ScalarType.h
  48. Scope.cpp
  49. Scope.h
  50. StringType.cpp
  51. StringType.h
  52. Type.cpp
  53. Type.h
  54. TypeDef.cpp
  55. TypeDef.h
  56. VectorType.cpp
  57. VectorType.h
README.md

hidl-gen user guide

1. Build

croot
make hidl-gen

2. Run

hidl-gen -o output-path -L language (-r interface-root) fqname

output-path: directory to store the output files.
language: output file for given language. e.g.c++, vts..

fqname: fully qualified name of the input files.
For singe file input, follow the format: package@version::fileName
For directory input, follow the format: package@version

interface-root(optional): prefix and root path for fqname.
If not set, use the default prefix: android.hardware and default root path
defined in $TOP.

examples:

hidl-gen -o output -L c++ android.hardware.nfc@1.0::INfc.hal
hidl-gen -o output -L vts android.hardware.nfc@1.0
hidl-gen -o test -L c++ -r android.hardware:/home/android/master/hardware/interfaces android.hardware.nfc@1.0