ScalarEvolution: Warn if the result of setFlags/clearFlags is unused.

This was a source of bugs in the past.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194929 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2013-11-16 16:25:47 +00:00
parent b69143c6a9
commit 2905440bdd

View File

@ -189,15 +189,16 @@ namespace llvm {
/// Convenient NoWrapFlags manipulation that hides enum casts and is /// Convenient NoWrapFlags manipulation that hides enum casts and is
/// visible in the ScalarEvolution name space. /// visible in the ScalarEvolution name space.
static SCEV::NoWrapFlags maskFlags(SCEV::NoWrapFlags Flags, int Mask) { static SCEV::NoWrapFlags LLVM_ATTRIBUTE_UNUSED_RESULT
maskFlags(SCEV::NoWrapFlags Flags, int Mask) {
return (SCEV::NoWrapFlags)(Flags & Mask); return (SCEV::NoWrapFlags)(Flags & Mask);
} }
static SCEV::NoWrapFlags setFlags(SCEV::NoWrapFlags Flags, static SCEV::NoWrapFlags LLVM_ATTRIBUTE_UNUSED_RESULT
SCEV::NoWrapFlags OnFlags) { setFlags(SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags OnFlags) {
return (SCEV::NoWrapFlags)(Flags | OnFlags); return (SCEV::NoWrapFlags)(Flags | OnFlags);
} }
static SCEV::NoWrapFlags clearFlags(SCEV::NoWrapFlags Flags, static SCEV::NoWrapFlags LLVM_ATTRIBUTE_UNUSED_RESULT
SCEV::NoWrapFlags OffFlags) { clearFlags(SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags OffFlags) {
return (SCEV::NoWrapFlags)(Flags & ~OffFlags); return (SCEV::NoWrapFlags)(Flags & ~OffFlags);
} }