[llvm-commits] [llvm] r140223 - /llvm/trunk/include/llvm/DebugInfo/DIContext.h

Benjamin Kramer benny.kra at googlemail.com
Tue Sep 20 18:13:16 PDT 2011


Author: d0k
Date: Tue Sep 20 20:13:16 2011
New Revision: 140223

URL: http://llvm.org/viewvc/llvm-project?rev=140223&view=rev
Log:
DebugInfo: Add equality operators and default constructor to DILineInfo.

Modified:
    llvm/trunk/include/llvm/DebugInfo/DIContext.h

Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=140223&r1=140222&r2=140223&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Tue Sep 20 20:13:16 2011
@@ -17,6 +17,7 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DataTypes.h"
+#include <cstring>
 
 namespace llvm {
 
@@ -28,12 +29,21 @@
   uint32_t Line;
   uint32_t Column;
 public:
+  DILineInfo() : FileName("<invalid>"), Line(0), Column(0) {}
   DILineInfo(const char *fileName, uint32_t line, uint32_t column)
     : FileName(fileName), Line(line), Column(column) {}
 
   const char *getFileName() const { return FileName; }
   uint32_t getLine() const { return Line; }
   uint32_t getColumn() const { return Column; }
+
+  bool operator==(const DILineInfo &RHS) const {
+    return Line == RHS.Line && Column == RHS.Column &&
+           std::strcmp(FileName, RHS.FileName) == 0;
+  }
+  bool operator!=(const DILineInfo &RHS) const {
+    return !(*this == RHS);
+  }
 };
 
 class DIContext {





More information about the llvm-commits mailing list