CXSourceRange get_range_whole_file() const { size_t const file_size = get_file_size(file_name.c_str()); CXFile const file = clang_getFile(translation_unit, file_name.c_str()); auto const file_begin = clang_getLocationForOffset(translation_unit, file, 0); auto const file_end = clang_getLocationForOffset(translation_unit, file, file_size); if(is_null_location(file_begin) || is_null_location(file_end)) { return clang_getNullRange(); } auto const file_range = clang_getRange(file_begin, file_end); if(clang_Range_isNull(file_range)) { return clang_getNullRange(); } return file_range; }
source_range source_range::null() { return { clang_getNullRange() }; }
SourceRange::SourceRange() : cxSourceRange(clang_getNullRange()) { }