Commit Graph

19 Commits

Author SHA1 Message Date
Mu-Le Lee
e5f137adf2 Update tests due to clang variable and struct naming changes.
Test: ANDROID_BUILD_TOP=`realpath .` \
      PATH=$PATH:`realpath out/soong/dist/bin`:`realpath out/soong/host/linux-x86/bin` \
      development/vndk/tools/header-checker/tests/test.py
Bug: 236780777
Change-Id: I794bcb9e9c922c642c3fbf0808fb60de4445ab65
2022-06-22 04:10:43 +00:00
Hsin-Yi Chen
6f22e7b610 Write relative paths to name fields in sdump
The "name" fields of anonymous types contain the source paths. This
commit changes them to relative paths.

Test: ./test.py
Bug: 154177636
Change-Id: I1b8e0272acf32f078f0d980dad97b9dda0731e88
2020-06-24 14:36:48 +08:00
Hsin-Yi Chen
7e15a236a3 Write relative paths to source_file fields in sdump
This commit adds --root-dir as a parameter to the ABI tools. It defaults
to current working directory. The source_file fields in the dump files
are relative to the root dir, so the file content doesn't depend on the
absolute path to Android source tree.

Test: ./header-checker-unittests
Test: ./test.py
Bug: 154177636
Change-Id: Ia07d0d3b913c921e9e91ea01c4f1e9c3c62c6ea9
2020-06-24 14:36:08 +08:00
Hsin-Yi Chen
08a2e32d8a Include anonymous enum in ABI dumps
The definitions of anonymous enums are stored in "enum_types" entry in
lsdump files. The linker_set_key for an anonymous enum consists of the
enclosing scopes and the lexicographically smallest field.

Bug: 141709599
Test: ./test.py
Change-Id: I4cecfd593e29c5432af6847de2429350a4178842
2019-12-30 23:19:04 +08:00
Logan Chien
59b208c79d header-checker: Remove type_id
This commit removes type_id and replace them with linker_set_key so
that a more deterministic output can be generated.

This should improve the human-readability of the ABI dump files.

Bug: 74764811
Bug: 109867439
Test: ./tests/test.py
Change-Id: I15df481058c5be6820189b1e60726cefd59d4d5f
2019-05-03 14:38:57 -07:00
Logan Chien
f6100313dd header-checker: Remove unique_id
This commit removes unique_id because it seems that there are some
overlapping between unique_id and linker_set_key.  Furthermore, this
helps us centralize type ID related code.

Bug: 74764811
Test: ./tests/test.py
Test: lunch walleye-userdebug && make
Change-Id: Ie7a27a428f9f8d729134047debc05d5a597e2452
2019-05-03 14:38:56 -07:00
Logan Chien
598b869846 header-checker: header-abi-dumper should use ModuleIR instead
This commit redirects header-abi-dumper output to ModuleIR and then
write ModuleIR with `IRDumper::Dump(module)`.  This decouples ABI
information extraction from IRDumper and allows post-processing ModuleIR
before writing to files.

This commit also sorts the reference test data.

Test: ./tests/test.py
Change-Id: Ibc7a9a94c08df496ff76351f951170bddc1a66a9
2019-03-20 17:16:09 +08:00
Logan Chien
ac8d2f2a51 Revert "Revert "Build header-abi-dumper with clang-r339409b""
This reverts commit fd439e926c.

Bug: 111579848
Test: prebuilts/clang-tools/build-prebuilts.sh
Test: out/soong/dist/bin/header-abi-dumper --help
Change-Id: I6d12f28b0c78418aaa2837eed2a9f7a0d7c9ce32
2018-10-12 16:01:45 +08:00
Logan Chien
fd439e926c Revert "Build header-abi-dumper with clang-r339409b"
This reverts commit 638f53cbfb.

Reason for revert: Breaks Mac OS X build

Change-Id: I5bf40c462f54c2caaa1c2635192503fa2311ec93
2018-10-12 03:38:41 +00:00
Jayant Chowdhary
638f53cbfb Build header-abi-dumper with clang-r339409b
Bug: 111579848
Test: header-abi-dumper builds with clang-r339409b prebuilts
Test: create_reference_dumps.py
Change-Id: I7b762548fe586398f98ff05767307c6d71103434
2018-10-12 02:09:37 +00:00
Yi-yo Chiang
c79ffcedda Remove "is_inlined" from header-abi-dumper
This commit removes "is_inlined" flag from lsdump's VTableComponent,
because the clang library used to walk the ast doesn't report accurate
information about whether a member function is inlined or not.

Also update the testcases.

Bug: 80217511
Test: ./tests/test.py
Change-Id: I0e133b140a4f3debff8030de7d6712590cf98d76
2018-08-03 14:36:35 +08:00
Yi-yo Chiang
0218a940cb Add is_inlined and is_pure property to header-abi-dump
- abi_dump.proto: Adds is_inlined and is_pure flag to VTableComponent.
is_inlined means a virtual function is inlined and probably not exported.
is_pure means a virtual function is pure and probably not exported.

Bug: 80217511
Test: ./tests/test.py
Change-Id: Ic1562ed47faba1f3d7eec6dffe94991296ba7176
2018-07-23 14:58:03 +08:00
Jayant Chowdhary
e5037fd0f1 Add information to denote whether a function parameter is 'this'.
Function signatures produced by header-abi-dumper should specify which
parameters are 'this'.

Bug: 72697345

Test: tests/test.py

Change-Id: I18a1f974e1530b6caa8f081dcd2101616ba3dc19
2018-04-09 11:17:36 -07:00
Jayant Chowdhary
dd38a73879 Name anonymous records, don't depend on fully qualified name for type-id.
- Use 'anonymous at <source>:<line>:<column>' as a name for anonymous records
  within a translation unit

- Don't depend on clang's getFullyQualifiedName() for computing type-ids since
  it isn't reliable (can miss out qualification of template parameters).
  Factor in the final destination type, i.e either built-in type name or
  tag type mangledCXXRTTI name. This is an internal name and not exposed
  through intermediate .sdump files, so should not affect backwards
  compatibility.

Bug: 77649155

Test: tests/test.py

Change-Id: I8890cc59fbe24fb6083e191d69be7fff45b51861
2018-04-06 11:40:04 -07:00
Jayant Chowdhary
d026c88b34 Do not dump records not visible outside a translation unit.
Also use non-mangled name for C structs and enums as their unique id.

We do this as attempt to protect against bugs similar to those mentioned
in https://android-review.googlesource.com/c/platform/external/clang/+/599002
which might not have been discovered yet.

Bug: 71486971

Test: Build android source tree for aosp_arm64_ab with -no-filter on
      header-abi-dumper.

Test: tests/test.py

Change-Id: I3e25425d9f3015cd7dece3bd5a27f88e050c1acb
2018-01-24 15:12:31 -08:00
Jayant Chowdhary
cdeafb7467 Update tests after type-ids were introduced to refer to types.
Bug: 71486971

Test: tests/gen_all.py; tests/test.py; all tests pass.

Change-Id: I1011f41d990a37b92b766819a38fdf76bcc184d2
2018-01-23 20:50:05 -08:00
Jayant Chowdhary
82a9f51a14 Use mangled name as unique id for C structs as well.
Some structs could be included without extern "C" guards. If the same
struct is included in a C++ source file and a C source file, it's unique
type name will be mangled in  one and its name in the other. To work
around this inconsistency, mangle their names regardless of context.

Bug: 69568963

Test: tests/test.py

Change-Id: Ie285c4691dbaa58389a041fee5116ccbfc7985ce
2017-12-19 00:21:23 -08:00
Jayant Chowdhary
9b6c50323e Add a 'unique id' for TagDecls for type uniquing.
libclang's getFullyQualifiedName API can miss default template arguments
and sometimes does not fully qualify template parameters as well. So for
type uniquing, use the API used by LLVM for TBAA : mangleCXXRTTIName.

Test: tests/test.py, all tests pass.

Bug: 69568963

Change-Id: Ibc97f5d3b0a1cb0eeed5f5df3e9c373bcb9573b4
2017-12-11 02:06:33 -08:00
Jayant Chowdhary
860b41407e Add more comprehensive tests for abi diffing.
1) We do not involve the build system to create test reference dumps. Symbols
in tests, are faked through version scripts to avoid checking in prebuilt .so
test files.

2) Also add a script to create reference abi dumps.

3) Fix a comment in ast_processing.cpp

Test: Run tests/test.py, all tests run and pass on generic arm64, mips64
and x86_64 builds.

Change-Id: Id3a420c1ae093a05a79da4c29e85071f28d714d1
2017-08-24 23:41:01 -07:00