1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00
llvm-mirror/test/Verifier/invalid-strbool-attr.ll
Serge Guelton b2fe6dcbc2 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
2021-04-17 08:17:33 +02:00

10 lines
200 B
LLVM

; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
; CHECK: invalid value for 'no-jump-tables' attribute: yes
define void @func() #0 {
ret void
}
attributes #0 = { "no-jump-tables"="yes" }