1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | #include "clang/Tooling/Refactoring/Rename/SymbolOccurrences.h" |
10 | #include "clang/Tooling/Refactoring/Rename/SymbolName.h" |
11 | #include "llvm/ADT/STLExtras.h" |
12 | |
13 | using namespace clang; |
14 | using namespace tooling; |
15 | |
16 | SymbolOccurrence::SymbolOccurrence(const SymbolName &Name, OccurrenceKind Kind, |
17 | ArrayRef<SourceLocation> Locations) |
18 | : Kind(Kind) { |
19 | ArrayRef<std::string> NamePieces = Name.getNamePieces(); |
20 | (0) . __assert_fail ("Locations.size() == NamePieces.size() && \"mismatching number of locations and lengths\"", "/home/seafit/code_projects/clang_source/clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp", 21, __PRETTY_FUNCTION__))" file_link="../../../../../include/assert.h.html#88" macro="true">assert(Locations.size() == NamePieces.size() && |
21 | (0) . __assert_fail ("Locations.size() == NamePieces.size() && \"mismatching number of locations and lengths\"", "/home/seafit/code_projects/clang_source/clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp", 21, __PRETTY_FUNCTION__))" file_link="../../../../../include/assert.h.html#88" macro="true"> "mismatching number of locations and lengths"); |
22 | (0) . __assert_fail ("!Locations.empty() && \"no locations\"", "/home/seafit/code_projects/clang_source/clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp", 22, __PRETTY_FUNCTION__))" file_link="../../../../../include/assert.h.html#88" macro="true">assert(!Locations.empty() && "no locations"); |
23 | if (Locations.size() == 1) { |
24 | RangeOrNumRanges = SourceRange( |
25 | Locations[0], Locations[0].getLocWithOffset(NamePieces[0].size())); |
26 | return; |
27 | } |
28 | MultipleRanges = llvm::make_unique<SourceRange[]>(Locations.size()); |
29 | RangeOrNumRanges.setBegin( |
30 | SourceLocation::getFromRawEncoding(Locations.size())); |
31 | for (const auto &Loc : llvm::enumerate(Locations)) { |
32 | MultipleRanges[Loc.index()] = SourceRange( |
33 | Loc.value(), |
34 | Loc.value().getLocWithOffset(NamePieces[Loc.index()].size())); |
35 | } |
36 | } |
37 | |