IR: Stop printing 'metadata' in Metadata::print()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 16 Dec 2014 07:40:31 +0000 (07:40 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 16 Dec 2014 07:40:31 +0000 (07:40 +0000)
Stop printing `metadata` in `Metadata::print()` and
`Metadata::printAsOperand()`.

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

lib/IR/AsmWriter.cpp
test/Verifier/ident-meta1.ll
test/Verifier/ident-meta3.ll
test/Verifier/module-flags-1.ll
test/Verifier/range-1.ll
unittests/IR/MetadataTest.cpp

index 1d867fc8371eb573ec9f35005023ff959a739c15..e883cba7f9dd30e77f1c90b140a60a59d6049f70 100644 (file)
@@ -2567,7 +2567,6 @@ void Value::printAsOperand(raw_ostream &O, bool PrintType, const Module *M) cons
 void Metadata::print(raw_ostream &ROS) const {
   formatted_raw_ostream OS(ROS);
   if (auto *N = dyn_cast<MDNode>(this)) {
-    OS << "metadata ";
     SlotTracker SlotTable(static_cast<Function *>(nullptr));
     AssemblyWriter W(OS, SlotTable, nullptr, nullptr);
     W.printMDNodeBody(N);
@@ -2580,8 +2579,6 @@ void Metadata::print(raw_ostream &ROS) const {
 void Metadata::printAsOperand(raw_ostream &ROS, bool PrintType,
                               const Module *M) const {
   formatted_raw_ostream OS(ROS);
-  if (PrintType)
-    OS << "metadata ";
 
   std::unique_ptr<TypePrinting> TypePrinter;
   if (PrintType) {
index 40c76728e5b0e24a8797ceb4b9e5cd32a88c23a8..3202fbd3e8f79d2bc38fee35f2c2e4b7084f5d1c 100644 (file)
@@ -8,5 +8,5 @@
 !1 = !{!"string1", !"string2"}
 ; CHECK: assembly parsed, but does not verify as correct!
 ; CHECK-NEXT: incorrect number of operands in llvm.ident metadata
-; CHECK-NEXT: metadata !1
+; CHECK-NEXT: !1
 
index 06f47a0faa833544f398a005490c37c0a392140c..91e1cfec5023bc93ff873972e88e861e69458403 100644 (file)
@@ -7,4 +7,4 @@
 !0 = !{!{!"nested metadata"}}
 ; CHECK: assembly parsed, but does not verify as correct!
 ; CHECK-NEXT: invalid value for llvm.ident metadata entry operand(the operand should be a string)
-; CHECK-NEXT: metadata !1
+; CHECK-NEXT: !1
index d64e6c8daef96a1dbaeed987f02e1016df9fe317..36bcb335ffc21bdcfe044e58d28d5a5762fca904 100644 (file)
@@ -3,10 +3,10 @@
 ; Check that module flags are structurally correct.
 ;
 ; CHECK: incorrect number of operands in module flag
-; CHECK: metadata !0
+; CHECK: !0
 !0 = !{i32 1}
 ; CHECK: invalid behavior operand in module flag (expected constant integer)
-; CHECK: metadata !"foo"
+; CHECK: !"foo"
 !1 = !{!"foo", !"foo", i32 42}
 ; CHECK: invalid behavior operand in module flag (unexpected constant)
 ; CHECK: i32 999
@@ -18,7 +18,7 @@
 ; CHECK: i32 45
 !4 = !{i32 3, !"bla", i32 45}
 ; CHECK: invalid value for 'require' module flag (expected metadata pair)
-; CHECK: metadata !
+; CHECK: !
 !5 = !{i32 3, !"bla", !{i32 46}}
 ; CHECK: invalid value for 'require' module flag (first value operand should be a string)
 ; CHECK: i32 47
index 93222214a8ffe70fd830687e39b07a89e6dee2da..fda65cbbbb897cc97f76496ed984a0f1dac46846 100644 (file)
@@ -16,7 +16,6 @@ entry:
 }
 !1 = !{}
 ; CHECK: It should have at least one range!
-; CHECK-NEXT: metadata
 
 define i8 @f3(i8* %x) {
 entry:
@@ -148,4 +147,3 @@ entry:
 }
 !18 = !{}
 ; CHECK: It should have at least one range!
-; CHECK-NEXT: metadata
index cdbcc995e4c63758b46c88371a8032aa9b56aaa1..d00964ef9205db952ec8176da19359c23ab6702f 100644 (file)
@@ -63,7 +63,7 @@ TEST_F(MDStringTest, PrintingSimple) {
   std::string Str;
   raw_string_ostream oss(Str);
   s->print(oss);
-  EXPECT_STREQ("metadata !\"testing 1 2 3\"", oss.str().c_str());
+  EXPECT_STREQ("!\"testing 1 2 3\"", oss.str().c_str());
 }
 
 // Test printing of MDString with non-printable characters.
@@ -73,7 +73,7 @@ TEST_F(MDStringTest, PrintingComplex) {
   std::string Str;
   raw_string_ostream oss(Str);
   s->print(oss);
-  EXPECT_STREQ("metadata !\"\\00\\0A\\22\\5C\\FF\"", oss.str().c_str());
+  EXPECT_STREQ("!\"\\00\\0A\\22\\5C\\FF\"", oss.str().c_str());
 }
 
 typedef MetadataTest MDNodeTest;
@@ -182,10 +182,10 @@ TEST_F(MDNodeTest, Print) {
   std::string Expected;
   {
     raw_string_ostream OS(Expected);
-    OS << "metadata !{";
+    OS << "!{";
     C->printAsOperand(OS);
     OS << ", ";
-    S->printAsOperand(OS, false);
+    S->printAsOperand(OS);
     OS << ", null";
     MDNode *Nodes[] = {N0, N1, N2};
     for (auto *Node : Nodes)