Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f237c52

Browse filesBrowse files
committed
[llvm-debuginfo-analyzer] Use LLVM_BUILD_DEBUG in class definitions
Some data members are only part of a class definition in a Debug build, e.g. `LVObject::ID`. If `debuginfologicalview` is used as a library, `NDEBUG` cannot be used for this purpose, as this PP macro may have a different definition in a downstream project, which in turn triggers an ODR violation. See #139098 for details. Instead, rely on `LLVM_BUILD_DEBUG` for class definitions.
1 parent 2910163 commit f237c52
Copy full SHA for f237c52

File tree

17 files changed

+25
-24
lines changed
Filter options

17 files changed

+25
-24
lines changed

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVCompare.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVCompare.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class LVCompare final {
7676
void printItem(LVElement *Element, LVComparePass Pass);
7777
void print(raw_ostream &OS) const;
7878

79-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
79+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
8080
void dump() const { print(dbgs()); }
8181
#endif
8282
};

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVLine.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVLine.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class LVLine : public LVElement {
105105
void print(raw_ostream &OS, bool Full = true) const override;
106106
void printExtra(raw_ostream &OS, bool Full = true) const override {}
107107

108-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
108+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
109109
void dump() const override { print(dbgs()); }
110110
#endif
111111
};

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVLocation.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class LVOperation final {
4949

5050
void print(raw_ostream &OS, bool Full = true) const;
5151

52-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
52+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
5353
void dump() { print(dbgs()); }
5454
#endif
5555
};
@@ -159,7 +159,7 @@ class LVLocation : public LVObject {
159159
void print(raw_ostream &OS, bool Full = true) const override;
160160
void printExtra(raw_ostream &OS, bool Full = true) const override;
161161

162-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
162+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
163163
void dump() const override { print(dbgs()); }
164164
#endif
165165
};

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVOBJECT_H
1616

1717
#include "llvm/BinaryFormat/Dwarf.h"
18+
#include "llvm/Config/llvm-config.h"
1819
#include "llvm/DebugInfo/CodeView/CodeView.h"
1920
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
2021
#include "llvm/DebugInfo/LogicalView/Core/LVSupport.h"
@@ -154,7 +155,7 @@ class LVObject {
154155
// copy constructor to create that object; it is used to print a reference
155156
// to another object and in the case of templates, to print its encoded args.
156157
LVObject(const LVObject &Object) {
157-
#ifndef NDEBUG
158+
#ifdef LLVM_BUILD_DEBUG
158159
incID();
159160
#endif
160161
Properties = Object.Properties;
@@ -165,7 +166,7 @@ class LVObject {
165166
Parent = Object.Parent;
166167
}
167168

168-
#ifndef NDEBUG
169+
#ifdef LLVM_BUILD_DEBUG
169170
// This is an internal ID used for debugging logical elements. It is used
170171
// for cases where an unique offset within the binary input file is not
171172
// available.
@@ -193,7 +194,7 @@ class LVObject {
193194

194195
public:
195196
LVObject() {
196-
#ifndef NDEBUG
197+
#ifdef LLVM_BUILD_DEBUG
197198
incID();
198199
#endif
199200
};
@@ -311,13 +312,13 @@ class LVObject {
311312
// (class attributes, debug ranges, files, directories, etc).
312313
virtual void printExtra(raw_ostream &OS, bool Full = true) const {}
313314

314-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
315+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
315316
virtual void dump() const { print(dbgs()); }
316317
#endif
317318

318319
uint64_t getID() const {
319320
return
320-
#ifndef NDEBUG
321+
#ifdef LLVM_BUILD_DEBUG
321322
ID;
322323
#else
323324
0;

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ class LVOptions {
435435

436436
void print(raw_ostream &OS) const;
437437

438-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
438+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
439439
void dump() const { print(dbgs()); }
440440
#endif
441441
};
@@ -632,7 +632,7 @@ class LVPatterns final {
632632

633633
void print(raw_ostream &OS) const;
634634

635-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
635+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
636636
void dump() const { print(dbgs()); }
637637
#endif
638638
};

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVRange.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVRange.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class LVRange final : public LVObject {
8787
void print(raw_ostream &OS, bool Full = true) const override;
8888
void printExtra(raw_ostream &OS, bool Full = true) const override {}
8989

90-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
90+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
9191
void dump() const override { print(dbgs()); }
9292
#endif
9393
};

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVReader.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVReader.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class LVReader {
325325
void print(raw_ostream &OS) const;
326326
virtual void printRecords(raw_ostream &OS) const {}
327327

328-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
328+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
329329
void dump() const { print(dbgs()); }
330330
#endif
331331
};

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVScope.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVScope.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class LVScope : public LVElement {
317317
virtual void printWarnings(raw_ostream &OS, bool Full = true) const {}
318318
virtual void printMatchedElements(raw_ostream &OS, bool UseMatchedElements) {}
319319

320-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
320+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
321321
void dump() const override { print(dbgs()); }
322322
#endif
323323
};

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVStringPool.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class LVStringPool {
8080
}
8181
}
8282

83-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
83+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
8484
void dump() const { print(dbgs()); }
8585
#endif
8686
};

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVSymbol.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class LVSymbol final : public LVElement {
183183
void print(raw_ostream &OS, bool Full = true) const override;
184184
void printExtra(raw_ostream &OS, bool Full = true) const override;
185185

186-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
186+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
187187
void dump() const override { print(dbgs()); }
188188
#endif
189189
};

‎llvm/include/llvm/DebugInfo/LogicalView/Core/LVType.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Core/LVType.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class LVType : public LVElement {
139139
void print(raw_ostream &OS, bool Full = true) const override;
140140
void printExtra(raw_ostream &OS, bool Full = true) const override;
141141

142-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
142+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
143143
void dump() const override { print(dbgs()); }
144144
#endif
145145
};

‎llvm/include/llvm/DebugInfo/LogicalView/LVReaderHandler.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/LVReaderHandler.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class LVReaderHandler {
8888

8989
void print(raw_ostream &OS) const;
9090

91-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
91+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
9292
void dump() const { print(dbgs()); }
9393
#endif
9494
};

‎llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class LVBinaryReader : public LVReader {
232232

233233
void print(raw_ostream &OS) const;
234234

235-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
235+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
236236
void dump() const { print(dbgs()); }
237237
#endif
238238
};

‎llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class LVCodeViewReader final : public LVBinaryReader {
225225
LogicalVisitor.printRecords(OS);
226226
};
227227

228-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
228+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
229229
void dump() const { print(dbgs()); }
230230
#endif
231231
};

‎llvm/include/llvm/DebugInfo/LogicalView/Readers/LVDWARFReader.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/DebugInfo/LogicalView/Readers/LVDWARFReader.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class LVDWARFReader final : public LVBinaryReader {
146146

147147
void print(raw_ostream &OS) const;
148148

149-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
149+
#if defined(LLVM_BUILD_DEBUG) || defined(LLVM_ENABLE_DUMP)
150150
void dump() const { print(dbgs()); }
151151
#endif
152152
};

‎llvm/lib/DebugInfo/LogicalView/Core/LVObject.cpp

Copy file name to clipboardExpand all lines: llvm/lib/DebugInfo/LogicalView/Core/LVObject.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ using namespace llvm::logicalview;
2121

2222
#define DEBUG_TYPE "Object"
2323

24-
#ifndef NDEBUG
24+
#ifdef LLVM_BUILD_DEBUG
2525
uint64_t LVObject::GID = 0;
2626
#endif
2727

@@ -137,7 +137,7 @@ void LVObject::printAttributes(raw_ostream &OS, bool Full, StringRef Name,
137137
}
138138

139139
void LVObject::printAttributes(raw_ostream &OS, bool Full) const {
140-
#ifndef NDEBUG
140+
#ifdef LLVM_BUILD_DEBUG
141141
if (options().getInternalID())
142142
OS << hexSquareString(getID());
143143
#endif

‎llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp

Copy file name to clipboardExpand all lines: llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ void LVOptions::resolveDependencies() {
256256
}
257257

258258
void LVOptions::calculateIndentationSize() {
259-
#ifndef NDEBUG
259+
#ifdef LLVM_BUILD_DEBUG
260260
if (getInternalID()) {
261261
std::string String = hexSquareString(0);
262262
IndentationSize += String.length();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.