[llvm] r283231 - Serialize remark argument as a mapping to get proper quotation for the value.

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 10:05:04 PDT 2016


Author: anemet
Date: Tue Oct  4 12:05:04 2016
New Revision: 283231

URL: http://llvm.org/viewvc/llvm-project?rev=283231&view=rev
Log:
Serialize remark argument as a mapping to get proper quotation for the value.

Modified:
    llvm/trunk/lib/Analysis/OptimizationDiagnosticInfo.cpp
    llvm/trunk/test/Transforms/Inline/optimization-remarks-passed-yaml.ll
    llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll

Modified: llvm/trunk/lib/Analysis/OptimizationDiagnosticInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/OptimizationDiagnosticInfo.cpp?rev=283231&r1=283230&r2=283231&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/OptimizationDiagnosticInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/OptimizationDiagnosticInfo.cpp Tue Oct  4 12:05:04 2016
@@ -110,18 +110,12 @@ template <> struct MappingTraits<DebugLo
   static const bool flow = true;
 };
 
-template <> struct ScalarTraits<DiagnosticInfoOptimizationBase::Argument> {
-  static void output(const DiagnosticInfoOptimizationBase::Argument &Arg,
-                     void *, llvm::raw_ostream &out) {
-    out << Arg.Key << ": " << Arg.Val;
+// Implement this as a mapping for now to get proper quotation for the value.
+template <> struct MappingTraits<DiagnosticInfoOptimizationBase::Argument> {
+  static void mapping(IO &io, DiagnosticInfoOptimizationBase::Argument &A) {
+    assert(io.outputting() && "input not yet implemented");
+    io.mapRequired(A.Key.data(), A.Val);
   }
-
-  static StringRef input(StringRef scalar, void *,
-                         DiagnosticInfoOptimizationBase::Argument &Arg) {
-    llvm_unreachable("input not yet implemented");
-  }
-
-  static bool mustQuote(StringRef) { return false; }
 };
 
 } // end namespace yaml

Modified: llvm/trunk/test/Transforms/Inline/optimization-remarks-passed-yaml.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/optimization-remarks-passed-yaml.ll?rev=283231&r1=283230&r2=283231&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/optimization-remarks-passed-yaml.ll (original)
+++ llvm/trunk/test/Transforms/Inline/optimization-remarks-passed-yaml.ll Tue Oct  4 12:05:04 2016
@@ -23,13 +23,13 @@
 ; YAML-NEXT: Hotness:         30
 ; YAML-NEXT: Args:
 ; YAML-NEXT:   - Callee: foo
-; YAML-NEXT:   - String:  can be inlined into
+; YAML-NEXT:   - String: ' can be inlined into '
 ; YAML-NEXT:   - Caller: bar
-; YAML-NEXT:   - String:  with cost=
-; YAML-NEXT:   - Cost: {{[0-9]+}}
-; YAML-NEXT:   - String:  (threshold=
-; YAML-NEXT:   - Threshold: {{[0-9]+}}
-; YAML-NEXT:   - String: )
+; YAML-NEXT:   - String: ' with cost='
+; YAML-NEXT:   - Cost: '{{[0-9]+}}'
+; YAML-NEXT:   - String: ' (threshold='
+; YAML-NEXT:   - Threshold: '{{[0-9]+}}'
+; YAML-NEXT:   - String: ')'
 ; YAML-NEXT: ...
 ; YAML-NEXT: --- !Passed
 ; YAML-NEXT: Pass:            inline
@@ -39,7 +39,7 @@
 ; YAML-NEXT: Hotness:         30
 ; YAML-NEXT: Args:
 ; YAML-NEXT:   - Callee: foo
-; YAML-NEXT:   - String:  inlined into
+; YAML-NEXT:   - String: ' inlined into '
 ; YAML-NEXT:   - Caller: bar
 ; YAML-NEXT: ...
 

Modified: llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll?rev=283231&r1=283230&r2=283231&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll (original)
+++ llvm/trunk/test/Transforms/Inline/optimization-remarks-yaml.ll Tue Oct  4 12:05:04 2016
@@ -22,9 +22,9 @@
 ; YAML-NEXT: Hotness:         30
 ; YAML-NEXT: Args:
 ; YAML-NEXT:   - Callee: foo
-; YAML-NEXT:   - String:  will not be inlined into
+; YAML-NEXT:   - String: ' will not be inlined into '
 ; YAML-NEXT:   - Caller: baz
-; YAML-NEXT:   - String:  because its definition is unavailable
+; YAML-NEXT:   - String: ' because its definition is unavailable'
 ; YAML-NEXT: ...
 ; YAML-NEXT: --- !Missed
 ; YAML-NEXT: Pass:            inline
@@ -34,9 +34,9 @@
 ; YAML-NEXT: Hotness:         30
 ; YAML-NEXT: Args:
 ; YAML-NEXT:   - Callee: bar
-; YAML-NEXT:   - String:  will not be inlined into
+; YAML-NEXT:   - String: ' will not be inlined into '
 ; YAML-NEXT:   - Caller: baz
-; YAML-NEXT:   - String:  because its definition is unavailable
+; YAML-NEXT:   - String: ' because its definition is unavailable'
 ; YAML-NEXT: ...
 
 ; ModuleID = '/tmp/s.c'




More information about the llvm-commits mailing list