[llvm] r341609 - [PDB] Rename some files in the native reader.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 6 17:12:56 PDT 2018
Author: zturner
Date: Thu Sep 6 17:12:56 2018
New Revision: 341609
URL: http://llvm.org/viewvc/llvm-project?rev=341609&view=rev
Log:
[PDB] Rename some files in the native reader.
By calling these NativeType<foo>.cpp, they will all be sorted
together, and it also distinguishes the types from the symbols.
Added:
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
Removed:
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeBuiltinSymbol.h
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h
llvm/trunk/lib/DebugInfo/PDB/Native/NativeBuiltinSymbol.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumSymbol.cpp
Modified:
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h
llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt
llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp
Removed: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeBuiltinSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeBuiltinSymbol.h?rev=341608&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeBuiltinSymbol.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeBuiltinSymbol.h (removed)
@@ -1,49 +0,0 @@
-//===- NativeBuiltinSymbol.h -------------------------------------- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVEBUILTINSYMBOL_H
-#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVEBUILTINSYMBOL_H
-
-#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
-
-#include "llvm/DebugInfo/PDB/PDBTypes.h"
-
-namespace llvm {
-namespace pdb {
-
-class NativeSession;
-
-class NativeBuiltinSymbol : public NativeRawSymbol {
-public:
- NativeBuiltinSymbol(NativeSession &PDBSession, SymIndexId Id,
- PDB_BuiltinType T, uint64_t L);
- ~NativeBuiltinSymbol() override;
-
- virtual std::unique_ptr<NativeRawSymbol> clone() const override;
-
- void dump(raw_ostream &OS, int Indent) const override;
-
- PDB_SymType getSymTag() const override;
-
- PDB_BuiltinType getBuiltinType() const override;
- bool isConstType() const override;
- uint64_t getLength() const override;
- bool isUnalignedType() const override;
- bool isVolatileType() const override;
-
-protected:
- NativeSession &Session;
- PDB_BuiltinType Type;
- uint64_t Length;
-};
-
-} // namespace pdb
-} // namespace llvm
-
-#endif
Removed: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h?rev=341608&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h (removed)
@@ -1,60 +0,0 @@
-//===- NativeEnumSymbol.h - info about enum type ----------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVEENUMSYMBOL_H
-#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVEENUMSYMBOL_H
-
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
-#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
-#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
-
-namespace llvm {
-namespace pdb {
-
-class NativeEnumSymbol : public NativeRawSymbol,
- public codeview::TypeVisitorCallbacks {
-public:
- NativeEnumSymbol(NativeSession &Session, SymIndexId Id,
- const codeview::CVType &CV);
- ~NativeEnumSymbol() override;
-
- std::unique_ptr<NativeRawSymbol> clone() const override;
-
- std::unique_ptr<IPDBEnumSymbols>
- findChildren(PDB_SymType Type) const override;
-
- Error visitKnownRecord(codeview::CVType &CVR,
- codeview::EnumRecord &Record) override;
- Error visitKnownMember(codeview::CVMemberRecord &CVM,
- codeview::EnumeratorRecord &Record) override;
-
- PDB_SymType getSymTag() const override;
- uint32_t getClassParentId() const override;
- uint32_t getUnmodifiedTypeId() const override;
- bool hasConstructor() const override;
- bool hasAssignmentOperator() const override;
- bool hasCastOperator() const override;
- uint64_t getLength() const override;
- std::string getName() const override;
- bool isNested() const override;
- bool hasOverloadedOperator() const override;
- bool isPacked() const override;
- bool isScoped() const override;
- uint32_t getTypeId() const override;
-
-protected:
- codeview::CVType CV;
- codeview::EnumRecord Record;
-};
-
-} // namespace pdb
-} // namespace llvm
-
-#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVEENUMSYMBOL_H
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h?rev=341609&r1=341608&r2=341609&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h Thu Sep 6 17:12:56 2018
@@ -15,7 +15,6 @@
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/Native/NativeBuiltinSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
#include "llvm/Support/Allocator.h"
Added: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h?rev=341609&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h (added)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h Thu Sep 6 17:12:56 2018
@@ -0,0 +1,49 @@
+//===- NativeTypeBuiltin.h ---------------------------------------- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEBUILTIN_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEBUILTIN_H
+
+#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
+
+#include "llvm/DebugInfo/PDB/PDBTypes.h"
+
+namespace llvm {
+namespace pdb {
+
+class NativeSession;
+
+class NativeTypeBuiltin : public NativeRawSymbol {
+public:
+ NativeTypeBuiltin(NativeSession &PDBSession, SymIndexId Id, PDB_BuiltinType T,
+ uint64_t L);
+ ~NativeTypeBuiltin() override;
+
+ virtual std::unique_ptr<NativeRawSymbol> clone() const override;
+
+ void dump(raw_ostream &OS, int Indent) const override;
+
+ PDB_SymType getSymTag() const override;
+
+ PDB_BuiltinType getBuiltinType() const override;
+ bool isConstType() const override;
+ uint64_t getLength() const override;
+ bool isUnalignedType() const override;
+ bool isVolatileType() const override;
+
+protected:
+ NativeSession &Session;
+ PDB_BuiltinType Type;
+ uint64_t Length;
+};
+
+} // namespace pdb
+} // namespace llvm
+
+#endif
Added: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h?rev=341609&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h (added)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h Thu Sep 6 17:12:56 2018
@@ -0,0 +1,60 @@
+//===- NativeTypeEnum.h - info about enum type ------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEENUM_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEENUM_H
+
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
+#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+
+namespace llvm {
+namespace pdb {
+
+class NativeTypeEnum : public NativeRawSymbol,
+ public codeview::TypeVisitorCallbacks {
+public:
+ NativeTypeEnum(NativeSession &Session, SymIndexId Id,
+ const codeview::CVType &CV);
+ ~NativeTypeEnum() override;
+
+ std::unique_ptr<NativeRawSymbol> clone() const override;
+
+ std::unique_ptr<IPDBEnumSymbols>
+ findChildren(PDB_SymType Type) const override;
+
+ Error visitKnownRecord(codeview::CVType &CVR,
+ codeview::EnumRecord &Record) override;
+ Error visitKnownMember(codeview::CVMemberRecord &CVM,
+ codeview::EnumeratorRecord &Record) override;
+
+ PDB_SymType getSymTag() const override;
+ uint32_t getClassParentId() const override;
+ uint32_t getUnmodifiedTypeId() const override;
+ bool hasConstructor() const override;
+ bool hasAssignmentOperator() const override;
+ bool hasCastOperator() const override;
+ uint64_t getLength() const override;
+ std::string getName() const override;
+ bool isNested() const override;
+ bool hasOverloadedOperator() const override;
+ bool isPacked() const override;
+ bool isScoped() const override;
+ uint32_t getTypeId() const override;
+
+protected:
+ codeview::CVType CV;
+ codeview::EnumRecord Record;
+};
+
+} // namespace pdb
+} // namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEENUM_H
Modified: llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt?rev=341609&r1=341608&r2=341609&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt (original)
+++ llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt Thu Sep 6 17:12:56 2018
@@ -46,13 +46,13 @@ add_pdb_impl_folder(Native
Native/InfoStream.cpp
Native/InfoStreamBuilder.cpp
Native/ModuleDebugStream.cpp
- Native/NativeBuiltinSymbol.cpp
Native/NativeCompilandSymbol.cpp
Native/NativeEnumModules.cpp
- Native/NativeEnumSymbol.cpp
Native/NativeEnumTypes.cpp
Native/NativeExeSymbol.cpp
Native/NativeRawSymbol.cpp
+ Native/NativeTypeBuiltin.cpp
+ Native/NativeTypeEnum.cpp
Native/NamedStreamMap.cpp
Native/NativeSession.cpp
Native/PDBFile.cpp
Removed: llvm/trunk/lib/DebugInfo/PDB/Native/NativeBuiltinSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeBuiltinSymbol.cpp?rev=341608&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeBuiltinSymbol.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeBuiltinSymbol.cpp (removed)
@@ -1,47 +0,0 @@
-//===- NativeBuiltinSymbol.cpp ------------------------------------ C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/DebugInfo/PDB/Native/NativeBuiltinSymbol.h"
-
-
-namespace llvm {
-namespace pdb {
-
-NativeBuiltinSymbol::NativeBuiltinSymbol(NativeSession &PDBSession,
- SymIndexId Id, PDB_BuiltinType T,
- uint64_t L)
- : NativeRawSymbol(PDBSession, PDB_SymType::BuiltinType, Id),
- Session(PDBSession), Type(T), Length(L) {}
-
-NativeBuiltinSymbol::~NativeBuiltinSymbol() {}
-
-std::unique_ptr<NativeRawSymbol> NativeBuiltinSymbol::clone() const {
- return llvm::make_unique<NativeBuiltinSymbol>(Session, SymbolId, Type, Length);
-}
-
-void NativeBuiltinSymbol::dump(raw_ostream &OS, int Indent) const {
- // TODO: Apparently nothing needs this yet.
-}
-
-PDB_SymType NativeBuiltinSymbol::getSymTag() const {
- return PDB_SymType::BuiltinType;
-}
-
-PDB_BuiltinType NativeBuiltinSymbol::getBuiltinType() const { return Type; }
-
-bool NativeBuiltinSymbol::isConstType() const { return false; }
-
-uint64_t NativeBuiltinSymbol::getLength() const { return Length; }
-
-bool NativeBuiltinSymbol::isUnalignedType() const { return false; }
-
-bool NativeBuiltinSymbol::isVolatileType() const { return false; }
-
-} // namespace pdb
-} // namespace llvm
Removed: llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumSymbol.cpp?rev=341608&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumSymbol.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumSymbol.cpp (removed)
@@ -1,111 +0,0 @@
-//===- NativeEnumSymbol.cpp - info about enum type --------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h"
-
-#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
-#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
-
-#include <cassert>
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-NativeEnumSymbol::NativeEnumSymbol(NativeSession &Session, SymIndexId Id,
- const codeview::CVType &CVT)
- : NativeRawSymbol(Session, PDB_SymType::Enum, Id), CV(CVT),
- Record(codeview::TypeRecordKind::Enum) {
- assert(CV.kind() == codeview::TypeLeafKind::LF_ENUM);
- cantFail(visitTypeRecord(CV, *this));
-}
-
-NativeEnumSymbol::~NativeEnumSymbol() {}
-
-std::unique_ptr<NativeRawSymbol> NativeEnumSymbol::clone() const {
- return llvm::make_unique<NativeEnumSymbol>(Session, SymbolId, CV);
-}
-
-std::unique_ptr<IPDBEnumSymbols>
-NativeEnumSymbol::findChildren(PDB_SymType Type) const {
- switch (Type) {
- case PDB_SymType::Data: {
- // TODO(amccarth): Provide an actual implementation.
- return nullptr;
- }
- default:
- return nullptr;
- }
-}
-
-Error NativeEnumSymbol::visitKnownRecord(codeview::CVType &CVR,
- codeview::EnumRecord &ER) {
- Record = ER;
- return Error::success();
-}
-
-Error NativeEnumSymbol::visitKnownMember(codeview::CVMemberRecord &CVM,
- codeview::EnumeratorRecord &R) {
- return Error::success();
-}
-
-PDB_SymType NativeEnumSymbol::getSymTag() const { return PDB_SymType::Enum; }
-
-uint32_t NativeEnumSymbol::getClassParentId() const { return 0xFFFFFFFF; }
-
-uint32_t NativeEnumSymbol::getUnmodifiedTypeId() const { return 0; }
-
-bool NativeEnumSymbol::hasConstructor() const {
- return bool(Record.getOptions() &
- codeview::ClassOptions::HasConstructorOrDestructor);
-}
-
-bool NativeEnumSymbol::hasAssignmentOperator() const {
- return bool(Record.getOptions() &
- codeview::ClassOptions::HasOverloadedAssignmentOperator);
-}
-
-bool NativeEnumSymbol::hasCastOperator() const {
- return bool(Record.getOptions() &
- codeview::ClassOptions::HasConversionOperator);
-}
-
-uint64_t NativeEnumSymbol::getLength() const {
- const auto Id = Session.getSymbolCache().findSymbolByTypeIndex(
- Record.getUnderlyingType());
- const auto UnderlyingType =
- Session.getConcreteSymbolById<PDBSymbolTypeBuiltin>(Id);
- return UnderlyingType ? UnderlyingType->getLength() : 0;
-}
-
-std::string NativeEnumSymbol::getName() const { return Record.getName(); }
-
-bool NativeEnumSymbol::isNested() const {
- return bool(Record.getOptions() & codeview::ClassOptions::Nested);
-}
-
-bool NativeEnumSymbol::hasOverloadedOperator() const {
- return bool(Record.getOptions() &
- codeview::ClassOptions::HasOverloadedOperator);
-}
-
-bool NativeEnumSymbol::isPacked() const {
- return bool(Record.getOptions() & codeview::ClassOptions::Packed);
-}
-
-bool NativeEnumSymbol::isScoped() const {
- return bool(Record.getOptions() & codeview::ClassOptions::Scoped);
-}
-
-uint32_t NativeEnumSymbol::getTypeId() const {
- return Session.getSymbolCache().findSymbolByTypeIndex(
- Record.getUnderlyingType());
-}
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp?rev=341609&r1=341608&r2=341609&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp Thu Sep 6 17:12:56 2018
@@ -10,8 +10,8 @@
#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp?rev=341609&r1=341608&r2=341609&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp Thu Sep 6 17:12:56 2018
@@ -13,11 +13,11 @@
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
-#include "llvm/DebugInfo/PDB/Native/NativeBuiltinSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
#include "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h"
+#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
Added: llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp?rev=341609&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp (added)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp Thu Sep 6 17:12:56 2018
@@ -0,0 +1,45 @@
+//===- NativeTypeBuiltin.cpp -------------------------------------- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
+
+namespace llvm {
+namespace pdb {
+
+NativeTypeBuiltin::NativeTypeBuiltin(NativeSession &PDBSession, SymIndexId Id,
+ PDB_BuiltinType T, uint64_t L)
+ : NativeRawSymbol(PDBSession, PDB_SymType::BuiltinType, Id),
+ Session(PDBSession), Type(T), Length(L) {}
+
+NativeTypeBuiltin::~NativeTypeBuiltin() {}
+
+std::unique_ptr<NativeRawSymbol> NativeTypeBuiltin::clone() const {
+ return llvm::make_unique<NativeTypeBuiltin>(Session, SymbolId, Type, Length);
+}
+
+void NativeTypeBuiltin::dump(raw_ostream &OS, int Indent) const {
+ // TODO: Apparently nothing needs this yet.
+}
+
+PDB_SymType NativeTypeBuiltin::getSymTag() const {
+ return PDB_SymType::BuiltinType;
+}
+
+PDB_BuiltinType NativeTypeBuiltin::getBuiltinType() const { return Type; }
+
+bool NativeTypeBuiltin::isConstType() const { return false; }
+
+uint64_t NativeTypeBuiltin::getLength() const { return Length; }
+
+bool NativeTypeBuiltin::isUnalignedType() const { return false; }
+
+bool NativeTypeBuiltin::isVolatileType() const { return false; }
+
+} // namespace pdb
+} // namespace llvm
Added: llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp?rev=341609&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp (added)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp Thu Sep 6 17:12:56 2018
@@ -0,0 +1,111 @@
+//===- NativeTypeEnum.cpp - info about enum type ----------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
+
+#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
+#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+
+#include <cassert>
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+NativeTypeEnum::NativeTypeEnum(NativeSession &Session, SymIndexId Id,
+ const codeview::CVType &CVT)
+ : NativeRawSymbol(Session, PDB_SymType::Enum, Id), CV(CVT),
+ Record(codeview::TypeRecordKind::Enum) {
+ assert(CV.kind() == codeview::TypeLeafKind::LF_ENUM);
+ cantFail(visitTypeRecord(CV, *this));
+}
+
+NativeTypeEnum::~NativeTypeEnum() {}
+
+std::unique_ptr<NativeRawSymbol> NativeTypeEnum::clone() const {
+ return llvm::make_unique<NativeTypeEnum>(Session, SymbolId, CV);
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+NativeTypeEnum::findChildren(PDB_SymType Type) const {
+ switch (Type) {
+ case PDB_SymType::Data: {
+ // TODO(amccarth): Provide an actual implementation.
+ return nullptr;
+ }
+ default:
+ return nullptr;
+ }
+}
+
+Error NativeTypeEnum::visitKnownRecord(codeview::CVType &CVR,
+ codeview::EnumRecord &ER) {
+ Record = ER;
+ return Error::success();
+}
+
+Error NativeTypeEnum::visitKnownMember(codeview::CVMemberRecord &CVM,
+ codeview::EnumeratorRecord &R) {
+ return Error::success();
+}
+
+PDB_SymType NativeTypeEnum::getSymTag() const { return PDB_SymType::Enum; }
+
+uint32_t NativeTypeEnum::getClassParentId() const { return 0xFFFFFFFF; }
+
+uint32_t NativeTypeEnum::getUnmodifiedTypeId() const { return 0; }
+
+bool NativeTypeEnum::hasConstructor() const {
+ return bool(Record.getOptions() &
+ codeview::ClassOptions::HasConstructorOrDestructor);
+}
+
+bool NativeTypeEnum::hasAssignmentOperator() const {
+ return bool(Record.getOptions() &
+ codeview::ClassOptions::HasOverloadedAssignmentOperator);
+}
+
+bool NativeTypeEnum::hasCastOperator() const {
+ return bool(Record.getOptions() &
+ codeview::ClassOptions::HasConversionOperator);
+}
+
+uint64_t NativeTypeEnum::getLength() const {
+ const auto Id = Session.getSymbolCache().findSymbolByTypeIndex(
+ Record.getUnderlyingType());
+ const auto UnderlyingType =
+ Session.getConcreteSymbolById<PDBSymbolTypeBuiltin>(Id);
+ return UnderlyingType ? UnderlyingType->getLength() : 0;
+}
+
+std::string NativeTypeEnum::getName() const { return Record.getName(); }
+
+bool NativeTypeEnum::isNested() const {
+ return bool(Record.getOptions() & codeview::ClassOptions::Nested);
+}
+
+bool NativeTypeEnum::hasOverloadedOperator() const {
+ return bool(Record.getOptions() &
+ codeview::ClassOptions::HasOverloadedOperator);
+}
+
+bool NativeTypeEnum::isPacked() const {
+ return bool(Record.getOptions() & codeview::ClassOptions::Packed);
+}
+
+bool NativeTypeEnum::isScoped() const {
+ return bool(Record.getOptions() & codeview::ClassOptions::Scoped);
+}
+
+uint32_t NativeTypeEnum::getTypeId() const {
+ return Session.getSymbolCache().findSymbolByTypeIndex(
+ Record.getUnderlyingType());
+}
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp?rev=341609&r1=341608&r2=341609&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp Thu Sep 6 17:12:56 2018
@@ -2,10 +2,11 @@
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
-#include "llvm/DebugInfo/PDB/Native/NativeEnumSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
@@ -83,8 +84,8 @@ SymIndexId SymbolCache::findSymbolByType
if (It == std::end(BuiltinTypes))
return 0;
SymIndexId Id = Cache.size();
- Cache.emplace_back(llvm::make_unique<NativeBuiltinSymbol>(
- Session, Id, It->Type, It->Size));
+ Cache.emplace_back(
+ llvm::make_unique<NativeTypeBuiltin>(Session, Id, It->Type, It->Size));
TypeIndexToSymbolId[Index] = Id;
return Id;
}
@@ -101,7 +102,7 @@ SymIndexId SymbolCache::findSymbolByType
SymIndexId Id = 0;
switch (CVT.kind()) {
case codeview::LF_ENUM:
- Id = createSymbol<NativeEnumSymbol>(CVT);
+ Id = createSymbol<NativeTypeEnum>(CVT);
break;
default:
assert(false && "Unsupported native symbol type!");
More information about the llvm-commits
mailing list