|
|
|
|
@ -8,34 +8,27 @@ SourceLocation(CXTranslationUnit &tu,
|
|
|
|
|
const std::string &filename, |
|
|
|
|
int line_number, |
|
|
|
|
int line_offset) { |
|
|
|
|
CXFile file = clang_getFile(tu, |
|
|
|
|
filename.c_str()); |
|
|
|
|
cx_location = clang_getLocation(tu, |
|
|
|
|
file, |
|
|
|
|
line_number, |
|
|
|
|
line_offset); |
|
|
|
|
CXFile file = clang_getFile(tu, filename.c_str()); |
|
|
|
|
cx_location = clang_getLocation(tu, file, line_number, line_offset); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
clang::SourceLocation:: |
|
|
|
|
SourceLocation(CXTranslationUnit &tu, |
|
|
|
|
const std::string &filepath, |
|
|
|
|
int offset) { |
|
|
|
|
CXFile file = clang_getFile(tu, |
|
|
|
|
filepath.c_str()); |
|
|
|
|
cx_location = clang_getLocationForOffset(tu, |
|
|
|
|
file, |
|
|
|
|
offset); |
|
|
|
|
SourceLocation(CXTranslationUnit &tu, const std::string &filepath, int offset) { |
|
|
|
|
CXFile file = clang_getFile(tu, filepath.c_str()); |
|
|
|
|
cx_location = clang_getLocationForOffset(tu, file, offset); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void clang::SourceLocation:: |
|
|
|
|
get_location_info(std::string* path, |
|
|
|
|
unsigned *line, |
|
|
|
|
unsigned *column, |
|
|
|
|
unsigned *offset) { |
|
|
|
|
CXFile file; |
|
|
|
|
clang_getExpansionLocation(cx_location, &file, line, column, offset); |
|
|
|
|
if (path != NULL && file!=NULL) { |
|
|
|
|
path->operator=(((clang_getCString((clang_getFileName(file)))))); |
|
|
|
|
} |
|
|
|
|
void clang::SourceLocation::get_data(std::string* path, unsigned *line, unsigned *column, unsigned *offset) { |
|
|
|
|
if(path==nullptr) |
|
|
|
|
clang_getExpansionLocation(cx_location, NULL, line, column, offset); |
|
|
|
|
else { |
|
|
|
|
CXFile file; |
|
|
|
|
clang_getExpansionLocation(cx_location, &file, line, column, offset); |
|
|
|
|
if (file!=NULL) { |
|
|
|
|
auto cxstr=clang_getFileName(file); |
|
|
|
|
*path=clang_getCString(cxstr); |
|
|
|
|
clang_disposeString(cxstr); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|