From 3c0d9fa2d4f1fe389f45a2651aabb2ab50693fa1 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Mon, 16 Mar 2015 19:01:54 +0000 Subject: [PATCH] AsmParser: Stop requiring 'name:' when it's not printed r230877 optimized which fields are written out for `CHECK`-ability, but apparently missed changing some of them to optional in `LLParser`. Fixes PR22921. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232400 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/LLParser.cpp | 6 +++--- test/Assembler/invalid-mdglobalvariable-missing-name.ll | 4 ---- test/Assembler/invalid-mdobjcproperty-missing-name.ll | 4 ---- test/Assembler/invalid-mdsubprogram-missing-name.ll | 4 ---- test/Assembler/mdglobalvariable.ll | 4 ++-- test/Assembler/mdobjcproperty.ll | 6 +++--- test/Assembler/mdsubprogram.ll | 4 ++-- 7 files changed, 10 insertions(+), 22 deletions(-) delete mode 100644 test/Assembler/invalid-mdglobalvariable-missing-name.ll delete mode 100644 test/Assembler/invalid-mdobjcproperty-missing-name.ll delete mode 100644 test/Assembler/invalid-mdsubprogram-missing-name.ll diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index bb822fe3b8d..0e98692e11c 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -3534,7 +3534,7 @@ bool LLParser::ParseMDCompileUnit(MDNode *&Result, bool IsDistinct) { bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(scope, MDField, ); \ - REQUIRED(name, MDStringField, ); \ + OPTIONAL(name, MDStringField, ); \ OPTIONAL(linkageName, MDStringField, ); \ OPTIONAL(file, MDField, ); \ OPTIONAL(line, LineField, ); \ @@ -3649,7 +3649,7 @@ bool LLParser::ParseMDTemplateValueParameter(MDNode *&Result, bool IsDistinct) { bool LLParser::ParseMDGlobalVariable(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ OPTIONAL(scope, MDField, ); \ - REQUIRED(name, MDStringField, ); \ + OPTIONAL(name, MDStringField, ); \ OPTIONAL(linkageName, MDStringField, ); \ OPTIONAL(file, MDField, ); \ OPTIONAL(line, LineField, ); \ @@ -3735,7 +3735,7 @@ bool LLParser::ParseMDExpression(MDNode *&Result, bool IsDistinct) { /// getter: "getFoo", attributes: 7, type: !2) bool LLParser::ParseMDObjCProperty(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ - REQUIRED(name, MDStringField, ); \ + OPTIONAL(name, MDStringField, ); \ OPTIONAL(file, MDField, ); \ OPTIONAL(line, LineField, ); \ OPTIONAL(setter, MDStringField, ); \ diff --git a/test/Assembler/invalid-mdglobalvariable-missing-name.ll b/test/Assembler/invalid-mdglobalvariable-missing-name.ll deleted file mode 100644 index bc0f72434a5..00000000000 --- a/test/Assembler/invalid-mdglobalvariable-missing-name.ll +++ /dev/null @@ -1,4 +0,0 @@ -; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s - -; CHECK: :[[@LINE+1]]:42: error: missing required field 'name' -!0 = !MDGlobalVariable(linkageName: "foo") diff --git a/test/Assembler/invalid-mdobjcproperty-missing-name.ll b/test/Assembler/invalid-mdobjcproperty-missing-name.ll deleted file mode 100644 index b55cfa83c80..00000000000 --- a/test/Assembler/invalid-mdobjcproperty-missing-name.ll +++ /dev/null @@ -1,4 +0,0 @@ -; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s - -; CHECK: [[@LINE+1]]:38: error: missing required field 'name' -!0 = !MDObjCProperty(setter: "setFoo") diff --git a/test/Assembler/invalid-mdsubprogram-missing-name.ll b/test/Assembler/invalid-mdsubprogram-missing-name.ll deleted file mode 100644 index 54ded222231..00000000000 --- a/test/Assembler/invalid-mdsubprogram-missing-name.ll +++ /dev/null @@ -1,4 +0,0 @@ -; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s - -; CHECK: :[[@LINE+1]]:38: error: missing required field 'name' -!0 = !MDSubprogram(linkageName: "foo") diff --git a/test/Assembler/mdglobalvariable.ll b/test/Assembler/mdglobalvariable.ll index 18549601cd2..09d20bf5188 100644 --- a/test/Assembler/mdglobalvariable.ll +++ b/test/Assembler/mdglobalvariable.ll @@ -18,5 +18,5 @@ isDefinition: false, variable: i32* @foo, declaration: !4) -; CHECK: !6 = !MDGlobalVariable(name: "bar", scope: null, isLocal: false, isDefinition: true) -!6 = !MDGlobalVariable(name: "bar") +; CHECK: !6 = !MDGlobalVariable(scope: null, isLocal: false, isDefinition: true) +!6 = !MDGlobalVariable() diff --git a/test/Assembler/mdobjcproperty.ll b/test/Assembler/mdobjcproperty.ll index 8afe9438787..cb2f4d32383 100644 --- a/test/Assembler/mdobjcproperty.ll +++ b/test/Assembler/mdobjcproperty.ll @@ -14,7 +14,7 @@ !3 = !MDObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo", getter: "getFoo", attributes: 7, type: !2) -; CHECK-NEXT: !4 = !MDObjCProperty(name: "foo") -!4 = !MDObjCProperty(name: "foo", file: null, line: 0, setter: "", getter: "", +; CHECK-NEXT: !4 = !MDObjCProperty() +!4 = !MDObjCProperty(name: "", file: null, line: 0, setter: "", getter: "", attributes: 0, type: null) -!5 = !MDObjCProperty(name: "foo") +!5 = !MDObjCProperty() diff --git a/test/Assembler/mdsubprogram.ll b/test/Assembler/mdsubprogram.ll index ff7b1fe821a..7447166056b 100644 --- a/test/Assembler/mdsubprogram.ll +++ b/test/Assembler/mdsubprogram.ll @@ -23,6 +23,6 @@ declare void @_Z3foov() flags: DIFlagPrototyped, isOptimized: true, function: void ()* @_Z3foov, templateParams: !5, declaration: !6, variables: !7) -; CHECK: !9 = !MDSubprogram(name: "bar", scope: null, isLocal: false, isDefinition: true, isOptimized: false) -!9 = !MDSubprogram(name: "bar") +; CHECK: !9 = !MDSubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false) +!9 = !MDSubprogram() -- 2.34.1