Page MenuHomePhabricator

Clang: Allow selecting the hash algorithm for file checksums in debug info.
Needs ReviewPublic

Authored by arlosi on Mar 11 2021, 10:20 AM.

Details

Summary

Adds clang-cl support for the /ZH: option used to select MD5, SHA1,
or SHA_256 hashing algorithms in debug info.

Previously only the MD5 algorithm was supported.

Diff Detail

Unit TestsFailed

TimeTest
120 msx64 debian > LLVM.tools/UpdateTestChecks/update_llc_test_checks::aarch64-function-name.test
Script: -- : 'RUN: at line 4'; cp -f /mnt/disks/ssd0/agent/llvm-project/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_function_name.ll /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/aarch64-function-name.test.tmp.ll && '/usr/bin/python3.8' /mnt/disks/ssd0/agent/llvm-project/build/test/../../llvm/utils/update_llc_test_checks.py --llc-binary /mnt/disks/ssd0/agent/llvm-project/build/test/../bin/llc /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/aarch64-function-name.test.tmp.ll
110 msx64 debian > LLVM.tools/UpdateTestChecks/update_llc_test_checks::aarch64_generated_funcs.test
Script: -- : 'RUN: at line 4'; cp -f /mnt/disks/ssd0/agent/llvm-project/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_generated_funcs.ll /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/aarch64_generated_funcs.test.tmp.ll && '/usr/bin/python3.8' /mnt/disks/ssd0/agent/llvm-project/build/test/../../llvm/utils/update_llc_test_checks.py --llc-binary /mnt/disks/ssd0/agent/llvm-project/build/test/../bin/llc --include-generated-funcs /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/aarch64_generated_funcs.test.tmp.ll
110 msx64 debian > LLVM.tools/UpdateTestChecks/update_llc_test_checks::amdgpu-function-name.test
Script: -- : 'RUN: at line 4'; cp -f /mnt/disks/ssd0/agent/llvm-project/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_function_name.ll /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/amdgpu-function-name.test.tmp.ll && '/usr/bin/python3.8' /mnt/disks/ssd0/agent/llvm-project/build/test/../../llvm/utils/update_llc_test_checks.py --llc-binary /mnt/disks/ssd0/agent/llvm-project/build/test/../bin/llc /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/amdgpu-function-name.test.tmp.ll
110 msx64 debian > LLVM.tools/UpdateTestChecks/update_llc_test_checks::amdgpu_generated_funcs.test
Script: -- : 'RUN: at line 4'; cp -f /mnt/disks/ssd0/agent/llvm-project/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_generated_funcs.ll /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/amdgpu_generated_funcs.test.tmp.ll && '/usr/bin/python3.8' /mnt/disks/ssd0/agent/llvm-project/build/test/../../llvm/utils/update_llc_test_checks.py --llc-binary /mnt/disks/ssd0/agent/llvm-project/build/test/../bin/llc --include-generated-funcs /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/amdgpu_generated_funcs.test.tmp.ll
110 msx64 debian > LLVM.tools/UpdateTestChecks/update_llc_test_checks::arm-function-name.test
Script: -- : 'RUN: at line 4'; cp -f /mnt/disks/ssd0/agent/llvm-project/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/arm_function_name.ll /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/arm-function-name.test.tmp.ll && '/usr/bin/python3.8' /mnt/disks/ssd0/agent/llvm-project/build/test/../../llvm/utils/update_llc_test_checks.py --llc-binary /mnt/disks/ssd0/agent/llvm-project/build/test/../bin/llc /mnt/disks/ssd0/agent/llvm-project/build/test/tools/UpdateTestChecks/update_llc_test_checks/Output/arm-function-name.test.tmp.ll
View Full Test Results (30 Failed)

Event Timeline

arlosi created this revision.Mar 11 2021, 10:20 AM
arlosi requested review of this revision.Mar 11 2021, 10:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2021, 10:20 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jansvoboda11 added inline comments.Mar 11 2021, 11:20 PM
clang/include/clang/Driver/Options.td
2775

Can you please use a marshalling annotation here and remove the code in CompilerInvocation.cpp? https://clang.llvm.org/docs/InternalsManual.html#adding-new-command-line-option

arlosi updated this revision to Diff 330386.Mar 12 2021, 3:25 PM
arlosi marked an inline comment as done.

Use automatic marshaling for command line arguments.

hans added a subscriber: hans.Jan 10 2022, 10:14 AM

Sorry for not seeing this sooner.

I think this looks great, just a few comments, and it also needs tests.

clang/include/clang/Basic/CodeGenOptions.def
303

Why does it need 4 bits? Wouldn't 2 be enough?

clang/lib/CodeGen/CGDebugInfo.cpp
368–369

I'm not sure changing the return type helps that much? I suppose it makes the calling code a little cleaner, but I think it makes the function itself a little more confusing.

398

toHex() from StringExtras.h is much nicer, and MD5 should be using that internally too.

hans added a comment.Jan 21 2022, 5:24 AM

Do you think you'll have time to work on this? Otherwise I'd be happy to take it over.

I wouldn't be able to look at this for a few weeks. If you have the time to
take it over, that works for me. Thanks!