From d0b66dbf40bd486836b49f6b4b13b972a36d37f4 Mon Sep 17 00:00:00 2001 From: Bob Haarman Date: Wed, 21 Jun 2017 22:31:52 +0000 Subject: [PATCH] [codeview] respect signedness of APSInts when printing to YAML Summary: This fixes a bug where we always treat APSInts in Codeview as signed when writing them to YAML. One symptom of this problem is that llvm-pdbdump raw would show Enumerator Values that differ between the original PDB and a PDB that has been round-tripped through YAML. Reviewers: zturner Reviewed By: zturner Subscribers: llvm-commits, fhahn Differential Revision: https://reviews.llvm.org/D34013 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305965 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ObjectYAML/CodeViewYAMLTypes.cpp | 2 +- test/DebugInfo/PDB/pdbdump-yaml-types.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ObjectYAML/CodeViewYAMLTypes.cpp b/lib/ObjectYAML/CodeViewYAMLTypes.cpp index a03b9cd50fa..2d1cb4b1b27 100644 --- a/lib/ObjectYAML/CodeViewYAMLTypes.cpp +++ b/lib/ObjectYAML/CodeViewYAMLTypes.cpp @@ -138,7 +138,7 @@ StringRef ScalarTraits::input(StringRef Scalar, void *Ctx, void ScalarTraits::output(const APSInt &S, void *, llvm::raw_ostream &OS) { - S.print(OS, true); + S.print(OS, S.isSigned()); } StringRef ScalarTraits::input(StringRef Scalar, void *Ctx, APSInt &S) { diff --git a/test/DebugInfo/PDB/pdbdump-yaml-types.test b/test/DebugInfo/PDB/pdbdump-yaml-types.test index a01edcee1e9..493ff379198 100644 --- a/test/DebugInfo/PDB/pdbdump-yaml-types.test +++ b/test/DebugInfo/PDB/pdbdump-yaml-types.test @@ -785,7 +785,7 @@ YAML: Name: eIDLModuleUsage YAML: - Kind: LF_ENUMERATE YAML: Enumerator: YAML: Attrs: 3 -YAML: Value: -32768 +YAML: Value: 32768 YAML: Name: eAnonymousUsage YAML: - Kind: LF_ENUMERATE YAML: Enumerator: -- 2.40.0