[llvm] r271566 - [CodeView] Use None instead of Void if there is no subprogram
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 11:51:25 PDT 2016
Author: majnemer
Date: Thu Jun 2 13:51:24 2016
New Revision: 271566
URL: http://llvm.org/viewvc/llvm-project?rev=271566&view=rev
Log:
[CodeView] Use None instead of Void if there is no subprogram
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h
llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h?rev=271566&r1=271565&r2=271566&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h Thu Jun 2 13:51:24 2016
@@ -103,7 +103,7 @@ public:
uint32_t getIndex() const { return Index; }
bool isSimple() const { return Index < FirstNonSimpleIndex; }
- bool isNoType() const { return Index == 0; }
+ bool isNoneType() const { return *this == None(); }
SimpleTypeKind getSimpleKind() const {
assert(isSimple());
@@ -115,6 +115,7 @@ public:
return static_cast<SimpleTypeMode>(Index & SimpleModeMask);
}
+ static TypeIndex None() { return TypeIndex(SimpleTypeKind::None); }
static TypeIndex Void() { return TypeIndex(SimpleTypeKind::Void); }
static TypeIndex VoidPointer32() {
return TypeIndex(SimpleTypeKind::Void, SimpleTypeMode::NearPointer32);
@@ -157,33 +158,34 @@ public:
static TypeIndex Float32() { return TypeIndex(SimpleTypeKind::Float32); }
static TypeIndex Float64() { return TypeIndex(SimpleTypeKind::Float64); }
-private:
- support::ulittle32_t Index;
-};
+ friend inline bool operator==(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() == B.getIndex();
+ }
-inline bool operator==(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() == B.getIndex();
-}
+ friend inline bool operator!=(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() != B.getIndex();
+ }
-inline bool operator!=(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() != B.getIndex();
-}
+ friend inline bool operator<(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() < B.getIndex();
+ }
-inline bool operator<(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() < B.getIndex();
-}
+ friend inline bool operator<=(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() <= B.getIndex();
+ }
-inline bool operator<=(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() <= B.getIndex();
-}
+ friend inline bool operator>(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() > B.getIndex();
+ }
-inline bool operator>(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() > B.getIndex();
-}
+ friend inline bool operator>=(const TypeIndex &A, const TypeIndex &B) {
+ return A.getIndex() >= B.getIndex();
+ }
+
+private:
+ support::ulittle32_t Index;
+};
-inline bool operator>=(const TypeIndex &A, const TypeIndex &B) {
- return A.getIndex() >= B.getIndex();
-}
}
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=271566&r1=271565&r2=271566&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Thu Jun 2 13:51:24 2016
@@ -126,7 +126,7 @@ TypeIndex CodeViewDebug::getFuncIdForSub
// It's possible to ask for the FuncId of a function which doesn't have a
// subprogram: inlining a function with debug info into a function with none.
if (!SP)
- return TypeIndex::Void();
+ return TypeIndex::None();
// Check if we've already translated this subprogram.
auto I = TypeIndices.find(SP);
Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp?rev=271566&r1=271565&r2=271566&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp Thu Jun 2 13:51:24 2016
@@ -641,7 +641,7 @@ void CVTypeDumperImpl::visitVirtualBaseC
}
StringRef CVTypeDumper::getTypeName(TypeIndex TI) {
- if (TI.isNoType())
+ if (TI.isNoneType())
return "<no type>";
if (TI.isSimple()) {
@@ -669,7 +669,7 @@ StringRef CVTypeDumper::getTypeName(Type
void CVTypeDumper::printTypeIndex(StringRef FieldName, TypeIndex TI) {
StringRef TypeName;
- if (!TI.isNoType())
+ if (!TI.isNoneType())
TypeName = getTypeName(TI);
if (!TypeName.empty())
W->printHex(FieldName, TypeName, TI.getIndex());
More information about the llvm-commits
mailing list