forked from qt-creator/qt-creator
Clang: Make file ids unique
Clang file ids are only unique for one query. Because we query in parallel we have to manage our own unique ids. Change-Id: I67d57d8b1766cab75ad252a14e57bbf9dc5fdb79 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -30,27 +30,15 @@
|
||||
|
||||
#include <sourcerangescontainer.h>
|
||||
|
||||
#include <QTime>
|
||||
#include <stringcache.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#elif defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning( disable : 4100 )
|
||||
#endif
|
||||
#include <QTime>
|
||||
|
||||
#include <clang/ASTMatchers/ASTMatchers.h>
|
||||
#include <clang/ASTMatchers/ASTMatchFinder.h>
|
||||
#include <clang/ASTMatchers/Dynamic/Diagnostics.h>
|
||||
#include <clang/ASTMatchers/Dynamic/Parser.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# pragma GCC diagnostic pop
|
||||
#elif defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
using clang::ast_matchers::dynamic::Diagnostics;
|
||||
using clang::ast_matchers::dynamic::Parser;
|
||||
using clang::ast_matchers::BoundNodes;
|
||||
@@ -66,8 +54,10 @@ struct CollectBoundNodes : MatchFinder::MatchCallback {
|
||||
}
|
||||
};
|
||||
|
||||
ClangQuery::ClangQuery(Utils::SmallString &&query)
|
||||
: query(std::move(query))
|
||||
ClangQuery::ClangQuery(StringCache<Utils::PathString, std::mutex> &filePathCache,
|
||||
Utils::SmallString &&query)
|
||||
: query(std::move(query)),
|
||||
filePathCache(filePathCache)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -226,6 +216,7 @@ void ClangQuery::matchLocation(
|
||||
|
||||
SourceRangeExtractor extractor(ast->getSourceManager(),
|
||||
ast->getLangOpts(),
|
||||
filePathCache,
|
||||
sourceRangesContainer);
|
||||
extractor.addSourceRanges(sourceRanges);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user