summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp2
-rw-r--r--llvm/test/Assembler/dilocalvariable-arg-large.ll10
-rw-r--r--llvm/test/Assembler/invalid-dilocalvariable-arg-large.ll6
-rw-r--r--llvm/test/Assembler/invalid-dilocalvariable-arg-negative.ll6
4 files changed, 23 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 28419fb27c1..681af2a9007 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -3730,7 +3730,7 @@ bool LLParser::ParseDILocalVariable(MDNode *&Result, bool IsDistinct) {
OPTIONAL(file, MDField, ); \
OPTIONAL(line, LineField, ); \
OPTIONAL(type, MDField, ); \
- OPTIONAL(arg, MDUnsignedField, (0, UINT8_MAX)); \
+ OPTIONAL(arg, MDUnsignedField, (0, UINT16_MAX)); \
OPTIONAL(flags, DIFlagField, );
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS
diff --git a/llvm/test/Assembler/dilocalvariable-arg-large.ll b/llvm/test/Assembler/dilocalvariable-arg-large.ll
new file mode 100644
index 00000000000..7788186a54a
--- /dev/null
+++ b/llvm/test/Assembler/dilocalvariable-arg-large.ll
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
+; RUN: verify-uselistorder %s
+
+; CHECK: !named = !{!0, !1}
+!named = !{!0, !1}
+
+!0 = distinct !DISubprogram()
+
+; CHECK: !1 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "foo", arg: 65535, scope: !0)
+!1 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "foo", arg: 65535, scope: !0)
diff --git a/llvm/test/Assembler/invalid-dilocalvariable-arg-large.ll b/llvm/test/Assembler/invalid-dilocalvariable-arg-large.ll
new file mode 100644
index 00000000000..d62da601e13
--- /dev/null
+++ b/llvm/test/Assembler/invalid-dilocalvariable-arg-large.ll
@@ -0,0 +1,6 @@
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+
+!0 = !DILocalVariable(tag: DW_TAG_arg_variable, scope: !{}, arg: 65535)
+
+; CHECK: <stdin>:[[@LINE+1]]:66: error: value for 'arg' too large, limit is 65535
+!1 = !DILocalVariable(tag: DW_TAG_arg_variable, scope: !{}, arg: 65536)
diff --git a/llvm/test/Assembler/invalid-dilocalvariable-arg-negative.ll b/llvm/test/Assembler/invalid-dilocalvariable-arg-negative.ll
new file mode 100644
index 00000000000..08e370a3666
--- /dev/null
+++ b/llvm/test/Assembler/invalid-dilocalvariable-arg-negative.ll
@@ -0,0 +1,6 @@
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+
+!0 = !DILocalVariable(tag: DW_TAG_arg_variable, scope: !{}, arg: 0)
+
+; CHECK: <stdin>:[[@LINE+1]]:66: error: expected unsigned integer
+!1 = !DILocalVariable(tag: DW_TAG_arg_variable, scope: !{}, arg: -1)
OpenPOWER on IntegriCloud