[PATCH] D34013: [codeview] respect signedness of APSInts when printing to YAML

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 7 15:16:07 PDT 2017


inglorion created this revision.
Herald added a subscriber: fhahn.
Herald added a reviewer: hiraditya.

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.


https://reviews.llvm.org/D34013

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


Index: llvm/test/DebugInfo/PDB/pdbdump-yaml-types.test
===================================================================
--- llvm/test/DebugInfo/PDB/pdbdump-yaml-types.test
+++ llvm/test/DebugInfo/PDB/pdbdump-yaml-types.test
@@ -785,7 +785,7 @@
 YAML:         - Kind:            LF_ENUMERATE
 YAML:           Enumerator:      
 YAML:             Attrs:           3
-YAML:             Value:           -32768
+YAML:             Value:           32768
 YAML:             Name:            eAnonymousUsage
 YAML:         - Kind:            LF_ENUMERATE
 YAML:           Enumerator:      
Index: llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
===================================================================
--- llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
+++ llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
@@ -138,7 +138,7 @@
 
 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34013.101826.patch
Type: text/x-patch
Size: 1075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170607/90927ef2/attachment.bin>


More information about the llvm-commits mailing list