Skip to content

Commit

Permalink
[DwarfDebug] Add forward declarations of "<" operators [NFC]
Browse files Browse the repository at this point in the history
The operators are defined in DwarfDebug.cpp but are
referenced in the struct definitions of FrameIndexExpr and
EntryValueInfo in DwarfDebug.h, and since they weren't
declared before, gcc warned with

 [694/5646] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/DwarfDebug.cpp.o
 ../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:273:6: warning: 'bool llvm::operator<(const llvm::FrameIndexExpr&, const llvm::FrameIndexExpr&)' has not been declared within 'llvm'
   273 | bool llvm::operator<(const FrameIndexExpr &LHS, const FrameIndexExpr &RHS) {
       |      ^~~~
 In file included from ../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:13:
 ../lib/CodeGen/AsmPrinter/DwarfDebug.h:112:15: note: only here as a 'friend'
   112 |   friend bool operator<(const FrameIndexExpr &LHS, const FrameIndexExpr &RHS);
       |               ^~~~~~~~
 ../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:278:6: warning: 'bool llvm::operator<(const llvm::EntryValueInfo&, const llvm::EntryValueInfo&)' has not been declared within 'llvm'
   278 | bool llvm::operator<(const EntryValueInfo &LHS, const EntryValueInfo &RHS) {
       |      ^~~~
 In file included from ../lib/CodeGen/AsmPrinter/DwarfDebug.cpp:13:
 ../lib/CodeGen/AsmPrinter/DwarfDebug.h:121:15: note: only here as a 'friend'
   121 |   friend bool operator<(const EntryValueInfo &LHS, const EntryValueInfo &RHS);
       |               ^~~~~~~~
  • Loading branch information
mikaelholmen committed Sep 29, 2023
1 parent 535665e commit 23b8a19
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ class DbgEntity {

class DbgVariable;

bool operator<(const struct FrameIndexExpr &LHS,
const struct FrameIndexExpr &RHS);
bool operator<(const struct EntryValueInfo &LHS,
const struct EntryValueInfo &RHS);

/// Proxy for one MMI entry.
struct FrameIndexExpr {
int FI;
Expand Down

0 comments on commit 23b8a19

Please sign in to comment.