commit | 0a88a4c2b7d06882a41eb38bbd3af7421a267dd6 | [log] [tgz] |
---|---|---|
author | Reid Kleckner <rnk@google.com> | Fri Mar 08 19:44:31 2019 |
committer | Commit Bot <commit-bot@chromium.org> | Fri Mar 08 19:44:31 2019 |
tree | 547aa9f00c2dee640af3e890d44103bccf2af931 | |
parent | d625a928dee3c272c2355f21dbacda102fadae4f [diff] |
Work around bug in clang coverage with a helper function Clang code coverage asserts on the following code pattern when targetting Android: #define LOAD_FUNCTION(lib, func) \ do { \ func##Fn = reinterpret_cast<p##func>(dlsym(lib, #func)); \ if (!func##Fn) { \ supported = false; \ LOG(ERROR) << "Unable to load function " << #func; \ } \ } while (0) The important thing in this snippet is the use of the base/logging.h macros inside another macro. Clang code coverage expects source locations to appear in ascending order, and somehow with these multiple levels of macro expansion, that invariant is broken. The upstream bug is https://llvm.org/pr39942. However, it's not making progress, so as a workaround, wrap the logging in a plain function. Test: Compile libchrome with use_clang_coverage=true for Android, build succeeds. R=backer@chromium.org, liaoyuke@chromium.org, rmcilroy@chromium.org Bug: 843356 Change-Id: I6a729adec482fd8a2903c80d919b7e0c5e6dd267 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1490740 Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Jonathan Backer <backer@chromium.org> Reviewed-by: Yuke Liao <liaoyuke@chromium.org> Commit-Queue: Reid Kleckner <rnk@chromium.org> Cr-Commit-Position: refs/heads/master@{#639124}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .