diff --git a/llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst b/llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst index 453af0751e2a1..1264f80206618 100644 --- a/llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst +++ b/llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst @@ -676,8 +676,7 @@ INTERNAL Typically these kind of options are available only in *debug* builds. :program:`llvm-debuginfo-analyzer` supports these advanced options in - both *release* and *debug* builds, with the exception of the unique ID - that is generated only in *debug* builds. + both *release* and *debug* builds. .. option:: --internal= diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLine.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLine.h index c979dc4a6be2e..3618ce7b0ecda 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLine.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLine.h @@ -105,10 +105,6 @@ class LLVM_ABI LVLine : public LVElement { void print(raw_ostream &OS, bool Full = true) const override; void printExtra(raw_ostream &OS, bool Full = true) const override {} - -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - void dump() const override { print(dbgs()); } -#endif }; // Class to represent a DWARF line record object. diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h index 7b466ae206e4e..0718e33f5645b 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h @@ -51,7 +51,7 @@ class LVOperation final { LLVM_ABI void print(raw_ostream &OS, bool Full = true) const; #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - void dump() { print(dbgs()); } + void dump() const { print(dbgs()); } #endif }; @@ -159,10 +159,6 @@ class LLVM_ABI LVLocation : public LVObject { void print(raw_ostream &OS, bool Full = true) const override; void printExtra(raw_ostream &OS, bool Full = true) const override; - -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - void dump() const override { print(dbgs()); } -#endif }; class LLVM_ABI LVLocationSymbol final : public LVLocation { diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h index ec02120e69b73..be64cdaea3d78 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h @@ -36,7 +36,7 @@ namespace logicalview { using LVSectionIndex = uint64_t; using LVAddress = uint64_t; using LVHalf = uint16_t; -using LVLevel = uint32_t; +using LVLevel = uint16_t; using LVOffset = uint64_t; using LVSigned = int64_t; using LVUnsigned = uint64_t; @@ -129,8 +129,6 @@ class LLVM_ABI LVObject { HasCodeViewLocation, // CodeView object with debug location. LastEntry }; - // Typed bitvector with properties for this object. - LVProperties Properties; LVOffset Offset = 0; uint32_t LineNumber = 0; @@ -140,6 +138,14 @@ class LLVM_ABI LVObject { dwarf::Attribute Attr; LVSmall Opcode; } TagAttrOpcode = {dwarf::DW_TAG_null}; + // Typed bitvector with properties for this object. + LVProperties Properties; + + // This is an internal ID used for debugging logical elements. It is used + // for cases where an unique offset within the binary input file is not + // available. + static uint32_t GID; + uint32_t ID = 0; // The parent of this object (nullptr if the root scope). For locations, // the parent is a symbol object; otherwise it is a scope object. @@ -155,9 +161,7 @@ class LLVM_ABI LVObject { // copy constructor to create that object; it is used to print a reference // to another object and in the case of templates, to print its encoded args. LVObject(const LVObject &Object) { -#ifndef NDEBUG incID(); -#endif Properties = Object.Properties; Offset = Object.Offset; LineNumber = Object.LineNumber; @@ -166,18 +170,10 @@ class LLVM_ABI LVObject { Parent = Object.Parent; } -#ifndef NDEBUG - // This is an internal ID used for debugging logical elements. It is used - // for cases where an unique offset within the binary input file is not - // available. - static uint64_t GID; - uint64_t ID = 0; - void incID() { ++GID; ID = GID; } -#endif protected: // Get a string representation for the given number and discriminator. @@ -193,11 +189,7 @@ class LLVM_ABI LVObject { virtual void printFileIndex(raw_ostream &OS, bool Full = true) const {} public: - LVObject() { -#ifndef NDEBUG - incID(); -#endif - }; + LVObject() { incID(); }; LVObject &operator=(const LVObject &) = delete; virtual ~LVObject() = default; @@ -313,17 +305,10 @@ class LLVM_ABI LVObject { virtual void printExtra(raw_ostream &OS, bool Full = true) const {} #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - virtual void dump() const { print(dbgs()); } + void dump() const { print(dbgs()); } #endif - uint64_t getID() const { - return -#ifndef NDEBUG - ID; -#else - 0; -#endif - } + uint32_t getID() const { return ID; } }; } // end namespace logicalview diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVRange.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVRange.h index 07d5813e5b19b..b5c833330e59e 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVRange.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVRange.h @@ -87,10 +87,6 @@ class LLVM_ABI LVRange final : public LVObject { void print(raw_ostream &OS, bool Full = true) const override; void printExtra(raw_ostream &OS, bool Full = true) const override {} - -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - void dump() const override { print(dbgs()); } -#endif }; } // end namespace logicalview diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVScope.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVScope.h index 0f536b5c16b96..5715a37185b2b 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVScope.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVScope.h @@ -325,10 +325,6 @@ class LLVM_ABI LVScope : public LVElement { void printExtra(raw_ostream &OS, bool Full = true) const override; virtual void printWarnings(raw_ostream &OS, bool Full = true) const {} virtual void printMatchedElements(raw_ostream &OS, bool UseMatchedElements) {} - -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - void dump() const override { print(dbgs()); } -#endif }; // Class to represent a DWARF Union/Structure/Class. diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h index 93ca2a73d64dd..ec9017e16b659 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h @@ -183,10 +183,6 @@ class LLVM_ABI LVSymbol final : public LVElement { void print(raw_ostream &OS, bool Full = true) const override; void printExtra(raw_ostream &OS, bool Full = true) const override; - -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - void dump() const override { print(dbgs()); } -#endif }; } // end namespace logicalview diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVType.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVType.h index cbce9cb65c920..59e6a92be8ce6 100644 --- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVType.h +++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVType.h @@ -146,10 +146,6 @@ class LLVM_ABI LVType : public LVElement { void print(raw_ostream &OS, bool Full = true) const override; void printExtra(raw_ostream &OS, bool Full = true) const override; - -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - void dump() const override { print(dbgs()); } -#endif }; // Class to represent DW_TAG_typedef_type. diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVObject.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVObject.cpp index 75acbf3225e08..5ccbcbfa4f0aa 100644 --- a/llvm/lib/DebugInfo/LogicalView/Core/LVObject.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Core/LVObject.cpp @@ -21,9 +21,7 @@ using namespace llvm::logicalview; #define DEBUG_TYPE "Object" -#ifndef NDEBUG -uint64_t LVObject::GID = 0; -#endif +uint32_t LVObject::GID = 0; StringRef llvm::logicalview::typeNone() { return StringRef(); } StringRef llvm::logicalview::typeVoid() { return "void"; } @@ -137,10 +135,8 @@ void LVObject::printAttributes(raw_ostream &OS, bool Full, StringRef Name, } void LVObject::printAttributes(raw_ostream &OS, bool Full) const { -#ifndef NDEBUG if (options().getInternalID()) OS << hexSquareString(getID()); -#endif if (options().getCompareExecute() && (options().getAttributeAdded() || options().getAttributeMissing())) OS << (getIsAdded() ? '+' : getIsMissing() ? '-' : ' '); diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp index 467bb98670b40..af35e58ac0dd6 100644 --- a/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp @@ -259,12 +259,10 @@ void LVOptions::resolveDependencies() { } void LVOptions::calculateIndentationSize() { -#ifndef NDEBUG if (getInternalID()) { std::string String = hexSquareString(0); IndentationSize += String.length(); } -#endif if (getCompareExecute() && (getAttributeAdded() || getAttributeMissing())) ++IndentationSize; if (getAttributeOffset()) {