This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Drop const qualifier to fix -Wrange-loop-analysis. NFC
ClosedPublic

Authored by MaskRay on Jan 4 2020, 11:59 AM.

Details

Summary
lld/ELF/Relocations.cpp:1622:56: warning: loop variable 'ts' of type 'const std::pair<ThunkSection *, uint32_t>' (aka 'const pair<lld::elf::ThunkSection *, unsigned int>') creates a copy from type 'const std::pair<ThunkSection *, uint32_t>' [-Wrange-loop-analysis]
        for (const std::pair<ThunkSection *, uint32_t> ts : isd->thunkSections)

Drop const qualifier to fix -Wrange-loop-analysis.
We can make -Wrange-loop-analysis warnings on const A more permissive on more
types (e.g. POD -> trivially copyable), unfortunately it will not make std::pair good,
because constexpr pair& operator=(const pair& p); is unfortunately user-defined.

Diff Detail

Event Timeline

MaskRay created this revision.Jan 4 2020, 11:59 AM
Mordante accepted this revision.Jan 4 2020, 12:13 PM

LGTM
I proposed the same change in D72210, but I'll adjust that patch once accepted.

This revision is now accepted and ready to land.Jan 4 2020, 12:13 PM

Unit tests: pass. 61247 tests passed, 0 failed and 736 were skipped.

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

This revision was automatically updated to reflect the committed changes.