Clang: Fix template renaming

Change-Id: I8040fe8dfc99d66e242ce2ff8589aa914838bfc9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2016-08-04 19:55:54 +02:00
parent fe3a7d6479
commit 98a167c0d5
4 changed files with 93 additions and 24 deletions

View File

@@ -49,10 +49,9 @@ namespace ClangBackEnd {
class FindLocationsOfUSRsASTVisitor : public clang::RecursiveASTVisitor<FindLocationsOfUSRsASTVisitor>
{
public:
explicit FindLocationsOfUSRsASTVisitor(std::vector<USRName> &unifiedSymbolResolutions)
explicit FindLocationsOfUSRsASTVisitor(const std::vector<USRName> &unifiedSymbolResolutions)
: unifiedSymbolResolutions(unifiedSymbolResolutions)
{
std::sort(unifiedSymbolResolutions.begin(), unifiedSymbolResolutions.end());
}
bool VisitNamedDecl(const clang::NamedDecl *declaration) {
@@ -108,15 +107,17 @@ private:
bool containsUSR(const USRName &unifiedSymbolResolution)
{
return std::binary_search(unifiedSymbolResolutions.cbegin(),
unifiedSymbolResolutions.cend(),
unifiedSymbolResolution);
auto found = std::find(unifiedSymbolResolutions.cbegin(),
unifiedSymbolResolutions.cend(),
unifiedSymbolResolution);
return found != unifiedSymbolResolutions.cend();
}
private:
// All the locations of the USR were found.
std::vector<USRName> unifiedSymbolResolutions;
const std::vector<USRName> unifiedSymbolResolutions;
std::vector<clang::SourceLocation> foundLocations;
};