[llvm] r305965 - [codeview] respect signedness of APSInts when printing to YAML

Bob Haarman via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 21 15:31:53 PDT 2017


Author: inglorion
Date: Wed Jun 21 17:31:52 2017
New Revision: 305965

URL: http://llvm.org/viewvc/llvm-project?rev=305965&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/ObjectYAML/CodeViewYAMLTypes.cpp
    llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test

Modified: llvm/trunk/lib/ObjectYAML/CodeViewYAMLTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLTypes.cpp?rev=305965&r1=305964&r2=305965&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/CodeViewYAMLTypes.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/CodeViewYAMLTypes.cpp Wed Jun 21 17:31:52 2017
@@ -138,7 +138,7 @@ StringRef ScalarTraits<TypeIndex>::input
 
 void ScalarTraits<APSInt>::output(const APSInt &S, void *,
                                   llvm::raw_ostream &OS) {
-  S.print(OS, true);
+  S.print(OS, S.isSigned());
 }
 
 StringRef ScalarTraits<APSInt>::input(StringRef Scalar, void *Ctx, APSInt &S) {

Modified: llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test?rev=305965&r1=305964&r2=305965&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test (original)
+++ llvm/trunk/test/DebugInfo/PDB/pdbdump-yaml-types.test Wed Jun 21 17:31:52 2017
@@ -785,7 +785,7 @@ YAML:             Name:            eIDLM
 YAML:         - Kind:            LF_ENUMERATE
 YAML:           Enumerator:      
 YAML:             Attrs:           3
-YAML:             Value:           -32768
+YAML:             Value:           32768
 YAML:             Name:            eAnonymousUsage
 YAML:         - Kind:            LF_ENUMERATE
 YAML:           Enumerator:      




More information about the llvm-commits mailing list