[IR] Have AttrBuilder::clear clear `TargetDepAttrs`.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 3 Sep 2015 22:27:42 +0000 (22:27 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 3 Sep 2015 22:27:42 +0000 (22:27 +0000)
Test case attached -- currently the parser smears the "foo bar" to all
of the formal arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246812 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Attributes.cpp
test/Assembler/incorrect-tdep-attrs-parsing.ll [new file with mode: 0644]

index d909f7b880c08239c72795c3b219465ba4a10e1b..2586cb54c3ee892b91407e41a521e5269f068e3d 100644 (file)
@@ -1108,6 +1108,7 @@ AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Index)
 
 void AttrBuilder::clear() {
   Attrs.reset();
 
 void AttrBuilder::clear() {
   Attrs.reset();
+  TargetDepAttrs.clear();
   Alignment = StackAlignment = DerefBytes = DerefOrNullBytes = 0;
 }
 
   Alignment = StackAlignment = DerefBytes = DerefOrNullBytes = 0;
 }
 
diff --git a/test/Assembler/incorrect-tdep-attrs-parsing.ll b/test/Assembler/incorrect-tdep-attrs-parsing.ll
new file mode 100644 (file)
index 0000000..bf8152b
--- /dev/null
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+; CHECK: define i32 @f(i64 "foo bar", i64, i64, i64 "xyz") {
+define i32 @f(i64 "foo bar", i64, i64, i64 "xyz") {
+  ret i32 41
+}