[PATCH] D66816: [02/10] [llvm-readobj] Print the resource type textually for .res files
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 12:04:11 PDT 2019
mstorsjo created this revision.
mstorsjo added reviewers: thakis, rnk, ruiu.
Herald added subscribers: seiya, rupprecht.
Herald added a project: LLVM.
This already is done when dumping resources from coff objects.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D66816
Files:
llvm/test/tools/llvm-readobj/res-resources.test
llvm/tools/llvm-readobj/WindowsResourceDumper.cpp
Index: llvm/tools/llvm-readobj/WindowsResourceDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/WindowsResourceDumper.cpp
+++ llvm/tools/llvm-readobj/WindowsResourceDumper.cpp
@@ -56,8 +56,12 @@
if (Ref.checkTypeString()) {
auto NarrowStr = stripUTF16(Ref.getTypeString());
SW.printString("Resource type (string)", NarrowStr);
- } else
- SW.printNumber("Resource type (int)", Ref.getTypeID());
+ } else {
+ SmallString<20> IDStr;
+ raw_svector_ostream OS(IDStr);
+ printResourceTypeName(Ref.getTypeID(), OS);
+ SW.printString("Resource type (int)", IDStr);
+ }
if (Ref.checkNameString()) {
auto NarrowStr = stripUTF16(Ref.getNameString());
Index: llvm/test/tools/llvm-readobj/res-resources.test
===================================================================
--- llvm/test/tools/llvm-readobj/res-resources.test
+++ llvm/test/tools/llvm-readobj/res-resources.test
@@ -5,7 +5,7 @@
// RUN: llvm-readobj %p/Inputs/resources/test_resource.res | FileCheck %s
-// CHECK: Resource type (int): 9
+// CHECK: Resource type (int): ACCELERATOR (ID 9)
// CHECK-NEXT: Resource name (string): MYACCELERATORS
// CHECK-NEXT: Data version: 0
// CHECK-NEXT: Memory flags: 0x30
@@ -19,7 +19,7 @@
// CHECK-NEXT: 0010: 82001200 BC010000 |........|
// CHECK-NEXT: )
-// CHECK-DAG: Resource type (int): 2
+// CHECK-DAG: Resource type (int): BITMAP (ID 2)
// CHECK-NEXT: Resource name (string): CURSOR
// CHECK-NEXT: Data version: 0
// CHECK-NEXT: Memory flags: 0x30
@@ -82,7 +82,7 @@
// CHECK-NEXT: 0320: FFFFFFFF FFFFFFFF |........|
// CHECK-NEXT: )
-// CHECK-DAG: Resource type (int): 2
+// CHECK-DAG: Resource type (int): BITMAP (ID 2)
// CHECK-NEXT: Resource name (string): OKAY
// CHECK-NEXT: Data version: 0
// CHECK-NEXT: Memory flags: 0x30
@@ -99,7 +99,7 @@
// CHECK-NEXT: 0320: FFFFFFFF FFFFFFFF |........|
// CHECK-NEXT: )
-// CHECK-DAG: Resource type (int): 4
+// CHECK-DAG: Resource type (int): MENU (ID 4)
// CHECK-NEXT: Resource name (int): 14432
// CHECK-NEXT: Data version: 0
// CHECK-NEXT: Memory flags: 0x1030
@@ -114,7 +114,7 @@
// CHECK-NEXT: 0020: 66006B00 61006F00 79006100 0000 |f.k.a.o.y.a...|
// CHECK-NEXT: )
-// CHECK-DAG: Resource type (int): 5
+// CHECK-DAG: Resource type (int): DIALOG (ID 5)
// CHECK-NEXT: Resource name (string): TESTDIALOG
// CHECK-NEXT: Data version: 0
// CHECK-NEXT: Memory flags: 0x1030
@@ -133,7 +133,7 @@
// CHECK-NEXT: 0060: 80002600 4F004B00 00000000 |..&.O.K.....|
// CHECK-NEXT: )
-// CHECK-DAG: Resource type (int): 9
+// CHECK-DAG: Resource type (int): ACCELERATOR (ID 9)
// CHECK-NEXT: Resource name (int): 12
// CHECK-NEXT: Data version: 0
// CHECK-NEXT: Memory flags: 0x30
@@ -147,7 +147,7 @@
// CHECK-NEXT: 0010: 82001200 BC010000 |........|
// CHECK-NEXT: )
-// CHECK-DAG: Resource type (int): 4
+// CHECK-DAG: Resource type (int): MENU (ID 4)
// CHECK-NEXT: Resource name (string): "EAT"
// CHECK-NEXT: Data version: 0
// CHECK-NEXT: Memory flags: 0x1030
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66816.217463.patch
Type: text/x-patch
Size: 3199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190827/95bc3bdc/attachment.bin>
More information about the llvm-commits
mailing list