Commit Graph

1549 Commits

Author SHA1 Message Date
Yi Kong
fda7cced69 Update clang version to clang-r487747c
Test: presubmit
Bug: 279955553
Change-Id: I8043ab75173420f60e828d973ba69d47011c2953
2023-05-13 18:11:44 +01:00
Hsin-Yi Chen
934663b2f0 Merge "Add README about opt-in ABI dumps" 2023-04-25 10:24:17 +00:00
Inseob Kim
46628fff98 Add min_sdk_version prop to snapshots
Bug: 277403349
Test: build vndk/vendor snapshot and build
Change-Id: I460c69cbc5820132690c9d3fb325c5eb504f5366
2023-04-18 16:50:20 +09:00
Justin Yun
9e48f54e06 VNDK snapshot tool generates license information from json
VNDK snapshot zip file includes license information in json files.
Instead of parsing the license text files, read the information from
the json files.
VNDK snapshot v33 and older do not include this information and must
parse the license text files as before.

Bug: 277317599
Test: generate snapshots with/without json information && m nothing
Change-Id: Ibdbc571c9effe6c17f5d82a7a0894ad2d800711f
2023-04-17 15:47:24 +09:00
Hsin-Yi Chen
35fabff46a Add README about opt-in ABI dumps
- Add the commands to write Android.bp, create reference dumps, and
  find the generated dumps.
- Remove "persistent-" from the repo command as it's internal only.

Test: None
Bug: 227282691
Change-Id: I07dc947c0436e2a0e7e5b3a4f812800bd7df2720
2023-04-14 19:31:49 +08:00
Hsin-Yi Chen
62081d11b4 Fix the internal type of enum values
EnumFieldIR has member functions that determine whether the enum value
is signed. The JSON dumper uses the functions to distinguish between
negative values and values >= (1 << 63).

Bug: 277299761
Test: ./test.py
Change-Id: If5f3a33aaf5f53f39019fdd10dde366d48a50340
2023-04-12 11:37:10 +00:00
Yi Kong
1784c71446 Merge "Revert^2 "Update clang version to clang-r487747"" 2023-03-24 13:19:52 +00:00
Hsin-Yi Chen
35fce6fed2 Collect libc++ headers that have no file name extensions
Test: LD_LIBRARY_PATH=prebuilts/clang/host/linux-x86/clang-r475365b/lib \
      out/soong/host/linux-x86/nativetest64/header-checker-unittests/header-checker-unittests
Bug: 271382846
Change-Id: Ica435ac635f6ab4f500e31ae1c38c2928b6dc6ac
2023-03-10 14:45:20 +08:00
Yi Kong
4476b23303 Revert^2 "Update clang version to clang-r487747"
78eb9e45d8

Change-Id: Iefe6911e88102848ef7185b6214020261f73e43e
2023-03-06 08:04:44 +00:00
Hsin-Yi Chen
0802314c7b Collect header files in subdirectories
Test: LD_LIBRARY_PATH=prebuilts/clang/host/linux-x86/clang-r487747/lib \
      out/soong/host/linux-x86/nativetest64/header-checker-unittests/header-checker-unittests
Bug: 271382846
Change-Id: I2f82c0d04870d31e29f854f5256a0d5a6b5455f0
2023-03-03 18:06:12 +08:00
Yi Kong
78eb9e45d8 Revert "Update clang version to clang-r487747"
Revert submission 2462733-fix-clang-tools-r487747

Rollback compiler update

Reverted changes: /q/submissionid:2462733-fix-clang-tools-r487747

Change-Id: I728d075c70c1a9938475069643c62a2cdf2a968f
2023-03-02 08:36:20 +00:00
Yi Kong
c08ebcfe53 Update clang version to clang-r487747
Change-Id: I254e4e31244599c7931a169a571f56b44d34b801
Test: presubmit
Bug: 264965700
2023-03-01 16:45:59 +09:00
Hsin-Yi Chen
feab6687e7 Merge "Convert type_queue to a member of AbiDiffHelper" 2023-02-23 05:04:56 +00:00
Hsin-Yi Chen
3b7728c88b Convert type_queue to a member of AbiDiffHelper
Test: ./test.py
Bug: 255702405
Change-Id: Ic1561812fe2b456b8c21440ef8a2439b0545f874
2023-02-22 13:44:09 +08:00
Hsin-Yi Chen
9a0530cb9b Link clang tools' lib directory before copying clang libraries
This commit restores lib/libc++.so.1 and lib/libclang-cpp.so.16 which
are indirect dependencies of clang tools.

Bug: 218706358
Test: out/soong/dist/bin/versioner -h
Change-Id: I3b9414645dc5b56d322d21e082feca260519d053
2023-02-21 08:26:14 +00:00
Hsin-Yi Chen
78562c0157 Merge "Replace TypeQueueCheckAndPushBack with TypeStackGuard" 2023-02-21 03:10:18 +00:00
Hsin-Yi Chen
4602059a36 Merge "Return DiffStatus from FilterOutRenamedRecordFields" 2023-02-20 08:24:42 +00:00
Hsin-Yi Chen
16e50ed2a6 Merge "Simplify the return value of CompareCommonRecordFields" 2023-02-16 02:32:37 +00:00
Yi Kong
f30be10e46 Merge "Migrate to the new clang lib dir" 2023-02-15 10:05:52 +00:00
Hsin-Yi Chen
033af47aa6 Replace TypeQueueCheckAndPushBack with TypeStackGuard
A followup commit will rename type_queue to type_stack.

Test: ./test.py
Bug: 255702405
Change-Id: Ie5c21b0883f08386d30b80ca955708aa7f4bdb16
2023-02-15 16:48:19 +08:00
Hsin-Yi Chen
17d6299cae Return DiffStatus from FilterOutRenamedRecordFields
The status of the filtered out fields is either kNoDiff or
kIndirectDiff. It does not affect the diff report, but makes
ModuleMerger determine redefined types more accurately.

Test: ./test.py ; update the prebuilt clang tools and build
Bug: 255702405
Change-Id: Ia94225d25e00597affa8b1e01a7c9de592bf5b05
2023-02-15 16:44:32 +08:00
Hsin-Yi Chen
3417140281 Simplify the return value of CompareCommonRecordFields
Before this commit, the function returns
(kDirectDiff, RecordFieldDiffIR *) or (kIndirectDiff/kNoDiff, nullptr).
The commit changes the return value to a DiffStatus. The caller decides
whether to create a RecordFieldDiffIR by the DiffStatus.

Test: ./test.py
Bug: 255702405
Change-Id: If2bfd5bca78e9d924be34ad5c522db9b91382cde
2023-02-15 16:44:18 +08:00
Yi Kong
7daeb1f361 Migrate to the new clang lib dir
Test: presubmit
Bug: 218706358
Change-Id: I6825f7c1f4340a30a14d9d8ce0fb5a3caf813f9e
2023-02-15 16:50:07 +09:00
Hsin-Yi Chen
08e0ce1066 Diff the fields located at the same offset in a class
- Rewrite the diff algorithm to handle multiple fields located at the
  same offset in a class, struct or union.
- Allow renaming a field if its (offset, type) pair is unique.

Bug: 255702405
Test: ./test.py
Change-Id: I79ebe9a827822b0f89d95952fa7d8c30499ca680
2023-02-13 10:23:02 +08:00
Hsin-Yi Chen
9b286a1967 Merge "Diff array types" 2023-02-02 08:27:42 +00:00
Hsin-Yi Chen
6ecc9e3997 Merge "Rename GenericFieldDiffInfo to RecordFieldDiffResult" 2023-02-02 06:31:49 +00:00
Hsin-Yi Chen
64930c428f Diff array types
This commit implements the function that compares array size, alignment,
and element type.

Test: ./test.py ; update prebuilts/clang-tools and build
Bug: 255702405

Change-Id: I4f25d22f060cfda04bbd88b9c2521461b95e6829
2023-02-02 12:58:35 +08:00
Hsin-Yi Chen
eb5797a263 Rename GenericFieldDiffInfo to RecordFieldDiffResult
Test: ./test.py
Bug: 255702405
Change-Id: I7e1112697f75b0a93ab821a128054e7e80acd6e1
2023-02-01 16:22:31 +08:00
Yabin Cui
7d47151afb Merge "Update clang-tools build to clang-r475365b" 2023-01-19 20:42:44 +00:00
Yabin Cui
deddd88b27 Update clang-tools build to clang-r475365b
Also remove -std=c++14 flag. Because clang 16 uses c++17
by default. And some headers don't compile with c++14.

Bug: 253033919
Test: run build-prebuilts.sh
Change-Id: Ia76c227831ed62a9de190fb1d816f23d7c92fad2
2023-01-18 10:27:50 -08:00
Hsin-Yi Chen
3a51bf53f1 Add a field for arrays of unknown bound
The ABI tools do not diff the array length. They cannot distinguish
between arrays of unknown bound (e.g., int foo[]) and arrays of zero
length (e.g., int bar[0]). To implement array diff, this commit adds
"is_of_unknown_bound" field to the ABI dumps. It defaults to false so
that it can be omitted for common cases.

Test: ./test.py ; update prebuilts/clang-tools and build
Bug: 255702405
Change-Id: I5db163eb62e95fa01377ef7202e70cc2a0e89524
2023-01-16 17:36:38 +08:00
Hsin-Yi Chen
e07e343451 Merge "Fix the bug that generates multiple definition of references" 2023-01-10 03:08:11 +00:00
Hsin-Yi Chen
6e5894f6a2 Fix the bug that generates multiple definition of references
If a type ID is persent in local_to_global_type_id_map,
ModuleMerger functions should report that was_newly_added_ = false.

Test: ./test.py ; update prebuilts/clang-tools and build
Bug: 255702405
Change-Id: I0fbe68ebbc6b8df3ea4ae36a017d0bb61bc7d553
2023-01-07 16:24:43 +08:00
Hsin-Yi Chen
a062a6cf35 Determine struct extensions before calling IRDiffDumper
This commit moves the functions that determine struct extensions from
ir_diff_representation.cpp to abi_diff_helpers.cpp. The functions
are called before IRDiffDumper so that the IR and the dumper do not
include the diff logic.

Test: ./test.py
Bug: 259148872
Change-Id: I93aaa3028bf6a30312f0b0e5b1ef5f6ae1041f21
2022-12-30 16:33:48 +08:00
Hsin-Yi Chen
82b8191b50 Merge "Allow extending qualifiers of function parameters and return values" 2022-12-28 09:31:24 +00:00
Hsin-Yi Chen
e77c10f563 Allow extending qualifiers of function parameters and return values
`header-abi-diff --allow-extensions` allows function parameters to be
more qualified, and return types to be less qualified. The ABI tools
follows the qualifier conversion rules in C++.

The ABI tool only allows extending the qualifiers of the functions that
have corresponding symbols. The qualifiers of the other types, such as
function pointers, class members, and global variables, must be
identical between the old and new ABIs.

Test: ./test.py
Bug: 259148872
Change-Id: I227f6ed774cc88009713acce955e35f1c3cff1ca
2022-12-28 10:19:00 +08:00
Yu Liu
0d3029fb87 Explicitly search header files in abi dumper.
Bug: None
Test: Manual
Change-Id: Ie72e0c4490ab9e29152fcdc45e48ca9724e31f7d
2022-12-15 21:48:11 -08:00
Hsin-Yi Chen
4a0b74b22a Refactor DiffStatus into a class
DiffStatus is a class that exposes constants and member functions.
AbiDiffHelper calls the member functions to determine how to report the
diff. The actual value of a DiffStatus object is encapsulated so that
developers can define new status without changing existing logic.

Test: ./test.py
Bug: 259148872
Change-Id: I2c3be62046aa01d68c84690cb158f8fc7a5b474b
2022-12-14 10:06:13 +08:00
Hsin-Yi Chen
98d1ee8c04 Assert the output file of header-abi-diff
Test: ./test.py
Bug: 259148872
Change-Id: Ie4270b3fe8c76a63d0b82f246e012d7ca2622fd4
2022-12-13 18:22:34 +08:00
Hsin-Yi Chen
231fe7b57a Do not remove reference dumps before building new dumps
Adding or removing the dump files cause soong to regenerate the
ninja files, which takes a few minutes for every product.
create_reference_dumps.py makes "findlsdumps" and the lsdumps paths.
These targets do not trigger ABI diff. Thus it is not necessary to
remove the reference dumps before building new dumps.

Test: ./create_reference_dumps.py
Bug: 255702405
Change-Id: I4f4a43476d7a9c46d41ef237b846547ed41c7c04
2022-12-09 11:47:19 +08:00
Hsin-Yi Chen
0bfb1a674b Merge "Remove DiffStatus::opaque_diff" 2022-12-06 07:42:04 +00:00
Hsin-Yi Chen
e14853c82d Remove DiffStatus::opaque_diff
Since the helper function can compare the opaque types' unique IDs, it
is not necessary to return opaque_diff and compare the reference types'
names.

Test: ./test.py
Bug: 255702405
Change-Id: I1264b0f4d0db178a3dc2202a265c5ccb38df7dc2
2022-12-06 10:38:52 +08:00
Justin Yun
9d2e85ec43 multi_update.py update all VNDK snapshots at once.
multi_update.py runs the update.py for all branches at once.
It makes vndk snapshot update much easy.

Bug: 260021945
Test: development/vndk/snapshot/multi_update.py --all -vv
Change-Id: Iaeadf75c8e05f54bcda2c577aba58f483e99ca00
2022-11-30 04:43:03 +00:00
Hsin-Yi Chen
21861cfece Do not create ABI dumps in AOSP directories for vendor libraries
create_reference_dumps.py recognizes VENDOR and PRODUCT tags in
lsdump_paths.txt. The dumps tagged with VENDOR, PRODUCT, VNDK-ext, or
VNDK-SP-ext cannot be created in the AOSP directories in
prebuilts/abi-dumps. The user who wants to generate dumps for vendor
libraries must specify -ref-dump-dir.

Test: ./create_reference_dumps.py -libs libutils
Test: ./create_reference_dumps.py -libs libutils -ref-dump-dir ./test-abi-dumps
Bug: 227282691
Change-Id: Iecf695d23d7a2e5a67859954c905fa9d1481b8ae
2022-11-29 16:20:54 +08:00
Hsin-Yi Chen
1c028bb8dd Deprecate compressed reference dumps
create_reference_dumps.py no longer supports compressing dumps because
they cannot be reviewed or merged.

Bug: 227282691
Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py
Change-Id: If4adccb865e3dba1e8045a6850478e46c9eae5de
2022-11-25 07:48:59 +00:00
Hsin-Yi Chen
9a49ca01f9 Do not create versioned subdirectories in -ref-dump-dir
This commit changes the structure of -ref-dump-dir. If the argument is
specified, create_reference_dumps.py generates
<arch>/source-based/<lib>.so.lsdump. Otherwise, the script generates
<version>/<binder>/<arch>/source-based/<lib>.so.lsdump in the default
dump directories. Library developers need to use -ref-dump-dir to create
opt-in reference dumps.

Bug: 227282691
Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py \
      -libs libutils -ref-dump-dir system/core/libutils/abi-dumps
Change-Id: I74cf7d092de405c76df31757104d66f75fcb9056
2022-11-25 10:39:37 +08:00
Hsin-Yi Chen
315d047b46 Fix the unit test for header-abi-dumper -print-resource-dir
The resource dir has been changed from lib64 to lib since clang-r468909.
build-prebuilts.sh creates lib in the dist dir so that developers can
easily run the binaries.

Test: development/vndk/tools/header-checker/android/build-prebuilts.sh
Test: development/vndk/tools/header-checker/tests/test.py
Bug: 255702405
Change-Id: I9bed6f0fd7948830a89d9e24889d9341ebf1a9c4
2022-11-17 02:32:06 +00:00
Hsin-Yi Chen
f5b6ebad09 Filter global variables and functions by -ignore-linker-set-key
Test: ./test.py HeaderCheckerTest.test_libgolden_cpp_return_type_diff
Bug: 259148872
Change-Id: I81f672d650a93eee69107ade07fc660a64c38e45
2022-11-16 15:43:22 +08:00
Hsin-Yi Chen
393ba54671 Allow extending vtables
This commit adds VTableLayoutDiffIR::IsExtended() that determines
whether the difference is a pure extension, i.e., appending virtual
functions to vtables.

Test: ./test.py
Bug: 248418092
Change-Id: I339713c5fff1dfa50dc7875272c0e3a59f858f57
2022-11-07 14:51:13 +08:00
Hsin-Yi Chen
3776a20379 Add the instructions to resolve ABI difference
The instructions are organized into a section. The developers who need
to resolve ABI difference can easily find it.

Test: None
Bug: 244520027
Change-Id: I211de0e1f65eece093fe716122753ea795c43b3e
2022-10-24 16:41:14 +08:00