diff options
| author | Adam Nemet <anemet@apple.com> | 2016-10-04 17:05:04 +0000 |
|---|---|---|
| committer | Adam Nemet <anemet@apple.com> | 2016-10-04 17:05:04 +0000 |
| commit | 0428e93217a55384f08c754ca8353a55334f3ef8 (patch) | |
| tree | e773575d329d799a5090a57aa4177442ea18e7b4 | |
| parent | 2780ee0dc199f43f7fd6a6caa12010143e44b091 (diff) | |
| download | bcm5719-llvm-0428e93217a55384f08c754ca8353a55334f3ef8.tar.gz bcm5719-llvm-0428e93217a55384f08c754ca8353a55334f3ef8.zip | |
Serialize remark argument as a mapping to get proper quotation for the value.
llvm-svn: 283231
3 files changed, 16 insertions, 22 deletions
diff --git a/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp b/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp index bfb19762077..d4359a88870 100644 --- a/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp +++ b/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp @@ -110,18 +110,12 @@ template <> struct MappingTraits<DebugLoc> { 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; - } - - static StringRef input(StringRef scalar, void *, - DiagnosticInfoOptimizationBase::Argument &Arg) { - llvm_unreachable("input not yet implemented"); +// 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 bool mustQuote(StringRef) { return false; } }; } // end namespace yaml diff --git a/llvm/test/Transforms/Inline/optimization-remarks-passed-yaml.ll b/llvm/test/Transforms/Inline/optimization-remarks-passed-yaml.ll index dff73430b12..60d07587fdf 100644 --- a/llvm/test/Transforms/Inline/optimization-remarks-passed-yaml.ll +++ b/llvm/test/Transforms/Inline/optimization-remarks-passed-yaml.ll @@ -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: ... diff --git a/llvm/test/Transforms/Inline/optimization-remarks-yaml.ll b/llvm/test/Transforms/Inline/optimization-remarks-yaml.ll index 1ba2e0a2694..b3ee9faa108 100644 --- a/llvm/test/Transforms/Inline/optimization-remarks-yaml.ll +++ b/llvm/test/Transforms/Inline/optimization-remarks-yaml.ll @@ -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' |

