[PATCH] D41427: Fix crash when parsing the type of a function without any arguments, i.e. 'int main()'

Aaron Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 20:00:55 PST 2018


asmith updated this revision to Diff 130088.
asmith retitled this revision from "Fix crash when parsing the type of a function without any arguments" to "Fix crash when parsing the type of a function without any arguments, i.e. 'int main()'".
asmith edited the summary of this revision.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D41427

Files:
  lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
  lit/SymbolFile/PDB/enums-layout.test
  lit/SymbolFile/PDB/typedefs.test
  source/Plugins/SymbolFile/PDB/PDBASTParser.cpp


Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===================================================================
--- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -126,14 +126,14 @@
       return CompilerType(ast, ast->WCharTy);
     break;
   case PDB_BuiltinType::Float:
-    // Note: Basic type `long double` and `double` have same bit size in MSVC.
-    // PDB does not have information to distinguish them. So when falling back
-    // to default search, compiler type of `long double` will be represented by
+    // Note: types `long double` and `double` have same bit size in MSVC and there
+    // is no information in the PDB to distinguish them. So when falling back
+    // to default search, the compiler type of `long double` will be represented by
     // the one generated for `double`.
     break;
   }
-  // If not match up PDB_BuiltinType, fall back to default search by encoding
-  // and width only
+  // If there is no match on PDB_BuiltinType, fall back to default search
+  // by encoding and width only
   return clang_ast->GetBuiltinTypeForEncodingAndBitSize(encoding, width);
 }
 
Index: lit/SymbolFile/PDB/typedefs.test
===================================================================
--- lit/SymbolFile/PDB/typedefs.test
+++ lit/SymbolFile/PDB/typedefs.test
@@ -1,16 +1,16 @@
 REQUIRES: windows
 RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.typedefs.obj
-RUN: link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /Entry:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe
+RUN: link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe
 RUN: lldb-test symbols %T/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s
 
 ; Generate 32-bit target
 
-; FIXME: For now, PDB does not have line information for typedef statements.
-; So source and line information of them not tested.
+; FIXME: PDB does not have line information for typedef statements so source
+; and line information for them is not tested.
 
-; Note, basic type `long double` and `double` have same bit size in MSVC.
-; There is no information in PDB to distinguish them. So compiler type of them
-; is represented by the one generated for `double`.
+; Note, types `long double` and `double` have same bit size in MSVC and there
+; is no information in the PDB to distinguish them. So the compiler type for 
+; both of them is the same.
 
 CHECK: Module [[CU:.*]]
 CHECK-DAG:  {{^[0-9A-F]+}}: SymbolVendor ([[CU]])
Index: lit/SymbolFile/PDB/enums-layout.test
===================================================================
--- lit/SymbolFile/PDB/enums-layout.test
+++ lit/SymbolFile/PDB/enums-layout.test
@@ -1,10 +1,10 @@
 REQUIRES: windows
 RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.enums.obj
-RUN: link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /Entry:main /OUT:%T/SimpleTypesTest.cpp.enums.exe
+RUN: link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.enums.exe
 RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck %s
 
-; FIXME: For now, PDB does not have information about scoped enumeration (Enum class). 
-; So compiler type of it is represented by the one generated for unscoped enumeration.
+; FIXME: PDB does not have information about scoped enumeration (Enum class) so the  
+; compiler type used is the same as the one for unscoped enumeration.
 
 CHECK: Module [[CU:.*]]
 CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[CU]])
Index: lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
===================================================================
--- lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
+++ lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
@@ -19,7 +19,7 @@
 enum Enum { RED, GREEN, BLUE };
 Enum EnumVar;
 
-enum EnumConst {LOW, NORMAL = 10, HIGH };
+enum EnumConst { LOW, NORMAL = 10, HIGH };
 EnumConst EnumConstVar;
 
 enum EnumEmpty {};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41427.130088.patch
Type: text/x-patch
Size: 4039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180117/245ba8a2/attachment.bin>


More information about the llvm-commits mailing list