summaryrefslogtreecommitdiffstats
path: root/lldb/lit/SymbolFile/PDB/Inputs
diff options
context:
space:
mode:
authorAaron Smith <aaron.smith@microsoft.com>2018-01-19 21:55:44 +0000
committerAaron Smith <aaron.smith@microsoft.com>2018-01-19 21:55:44 +0000
commit563799b3a6cf23fa56c4fcdc91d3d2cf45b015b0 (patch)
tree456f903cf2eae2772090ce6a48cf81f566ba3a45 /lldb/lit/SymbolFile/PDB/Inputs
parent04b76f40778d6eda730a06f8e494e66c94fceb3b (diff)
downloadbcm5719-llvm-563799b3a6cf23fa56c4fcdc91d3d2cf45b015b0.tar.gz
bcm5719-llvm-563799b3a6cf23fa56c4fcdc91d3d2cf45b015b0.zip
[SymbolFilePDB] Fix null array access when parsing the type of a function without any arguments, i.e. 'int main()' and add support to test it
Summary: - Fix a null array access bug. This happens when creating the lldb type for a function that has no argument. - Implement SymbolFilePDB::ParseTypes method. Using `lldb-test symbols` will show all supported types in the target. - Create lldb types for variadic function, PDBSymbolTypePointer, PDBSymbolTypeBuiltin - The underlying builtin type for PDBSymbolTypeEnum is always `Int`, correct it with the very first enumerator's encoding if any. This is more accurate when the underlying type is not signed or another integer type. - Fix a bug when the compiler type is not created based on PDB_BuiltinType. For example, basic type `long` is of same width as `int` in a 32-bit target, and the compiler type of former one will be represented by the one generated for latter if using the default method. Introduce a static function GetBuiltinTypeForPDBEncodingAndBitSize to correct this issue. - Basic type `long double` and `double` have the same bit size in MSVC and there is no information in a PDB to distinguish them. The compiler type of the former one is represented by the latter's. - There is no line informaton about typedef, enum etc in a PDB and the source and line information for them are not shown. - There is no information about scoped enumeration. The compiler type is represented as an unscoped one. Reviewers: zturner, lldb-commits, davide, asmith Reviewed By: zturner, asmith Subscribers: llvm-commits, davide Differential Revision: https://reviews.llvm.org/D41427 llvm-svn: 322995
Diffstat (limited to 'lldb/lit/SymbolFile/PDB/Inputs')
-rw-r--r--lldb/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/lldb/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp b/lldb/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
new file mode 100644
index 00000000000..42a5bfa4323
--- /dev/null
+++ b/lldb/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
@@ -0,0 +1,40 @@
+// typedef
+typedef unsigned long ULongArrayTypedef[10];
+ULongArrayTypedef ULongArrayVar;
+
+typedef long double*& RefTypedef;
+long double* LongDoublePtrVar = 0;
+RefTypedef RefVar = LongDoublePtrVar;
+
+typedef long long (*FuncPtrTypedef)(int&, unsigned char**, short[], const double, volatile bool);
+FuncPtrTypedef FuncVar;
+
+typedef char (*VarArgsFuncTypedef)(void*, long, unsigned short, unsigned int, ...);
+VarArgsFuncTypedef VarArgsFuncVar;
+
+typedef float (*VarArgsFuncTypedefA)(...);
+VarArgsFuncTypedefA VarArgsFuncVarA;
+
+// unscoped enum
+enum Enum { RED, GREEN, BLUE };
+Enum EnumVar;
+
+enum EnumConst { LOW, NORMAL = 10, HIGH };
+EnumConst EnumConstVar;
+
+enum EnumEmpty {};
+EnumEmpty EnumEmptyVar;
+
+enum EnumUChar : unsigned char { ON, OFF, AUTO };
+EnumUChar EnumCharVar;
+
+// scoped enum
+enum class EnumClass { YES, NO, DEFAULT };
+EnumClass EnumClassVar;
+
+enum struct EnumStruct { red, blue, black };
+EnumStruct EnumStructVar;
+
+int main() {
+ return 0;
+}
OpenPOWER on IntegriCloud