From 0d2ef0158926973d6a977d71de5cc455cff2599a Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Sat, 16 Apr 2016 03:23:48 +0000 Subject: [PATCH] [DebugInfo] Correct the assertion introduced in r266509 + update test. llvm-svn: 266512 --- llvm/include/llvm/IR/DebugInfoMetadata.h | 4 ++-- llvm/unittests/IR/MetadataTest.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h index ae5711e..3f9172f 100644 --- a/llvm/include/llvm/IR/DebugInfoMetadata.h +++ b/llvm/include/llvm/IR/DebugInfoMetadata.h @@ -1875,8 +1875,8 @@ class DILocalVariable : public DIVariable { unsigned Arg, unsigned Flags, ArrayRef Ops) : DIVariable(C, DILocalVariableKind, Storage, Line, Ops), Arg(Arg), Flags(Flags) { - assert(Flags < ((1 << 16) - 1) && "DILocalVariable: Flags out of range"); - assert(Arg < ((1 << 16) - 1) && "DILocalVariable: Arg out of range"); + assert(Flags < (1 << 16) && "DILocalVariable: Flags out of range"); + assert(Arg < (1 << 16) && "DILocalVariable: Arg out of range"); } ~DILocalVariable() = default; diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp index 1159616..1addd15 100644 --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -1817,6 +1817,7 @@ TEST_F(DILocalVariableTest, get) { DITypeRef Type = getDerivedType(); unsigned Arg = 6; unsigned Flags = 7; + unsigned NotFlags = (~Flags) & ((1 << 16) - 1); auto *N = DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg, Flags); @@ -1847,7 +1848,7 @@ TEST_F(DILocalVariableTest, get) { EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg + 1, Flags)); EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg, - ~Flags)); + NotFlags)); TempDILocalVariable Temp = N->clone(); EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp))); -- 2.7.4