HomePhabricator

Normalize interaction with boolean attributes

Authored by serge-sans-paille on Mar 24 2021, 1:45 PM.

Description

Normalize interaction with boolean attributes

Such attributes can either be unset, or set to "true" or "false" (as string).
throughout the codebase, this led to inelegant checks ranging from

if (Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true")

to

if (Fn->hasAttribute("no-jump-tables") && Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true")

Introduce a getValueAsBool that normalize the check, with the following
behavior:

no attributes or attribute set to "false" => return false
attribute set to "true" => return true

Differential Revision: https://reviews.llvm.org/D99299

Details

Committed
serge-sans-pailleFri, Apr 16, 11:17 PM
Differential Revision
D99299: Normalize interaction with boolean attributes
Parents
rGbbba69425c61: [libc][NFC] Use explicit conversion in aarch64 FEnv.
Branches
Unknown
Tags
Unknown