Browse Source

Reverted byte offset addition in clangmm::Offset

merge-requests/37/head
eidheim 8 years ago
parent
commit
f333da6a4e
  1. 6
      src/SourceLocation.cc
  2. 3
      src/SourceLocation.h

6
src/SourceLocation.cc

@ -20,9 +20,9 @@ std::string clangmm::SourceLocation::get_path() {
return path; return path;
} }
clangmm::Offset clangmm::SourceLocation::get_offset() { clangmm::Offset clangmm::SourceLocation::get_offset() {
unsigned line, index, offset; unsigned line, index;
get_data(nullptr, &line, &index, &offset); get_data(nullptr, &line, &index, nullptr);
return {line, index, offset}; return {line, index};
} }
void clangmm::SourceLocation::get_data(std::string* path, unsigned *line, unsigned *column, unsigned *offset) { void clangmm::SourceLocation::get_data(std::string* path, unsigned *line, unsigned *column, unsigned *offset) {

3
src/SourceLocation.h

@ -6,11 +6,10 @@
namespace clangmm { namespace clangmm {
class Offset { class Offset {
public: public:
bool operator==(const clangmm::Offset &o) {return offset==o.offset;} bool operator==(const clangmm::Offset &o) {return line==o.line && index==o.index;}
bool operator!=(const clangmm::Offset &o) {return !(*this==o);} bool operator!=(const clangmm::Offset &o) {return !(*this==o);}
unsigned line; unsigned line;
unsigned index; //byte index in line (not char number) unsigned index; //byte index in line (not char number)
unsigned offset;
}; };
class SourceLocation { class SourceLocation {

Loading…
Cancel
Save