From f0e00a8c25ff123ad23dc295ecede5736a476685 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 24 Jul 2017 14:55:51 +0200 Subject: Clang: Add symbols collector Change-Id: I64c25eef8eaa6cc6c3ff09d41866972b6c7248d0 Reviewed-by: Tim Jenssen --- .../clangrefactoringbackend/source/findcursorusr.h | 38 +++++++--------------- 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'src/tools/clangrefactoringbackend/source/findcursorusr.h') diff --git a/src/tools/clangrefactoringbackend/source/findcursorusr.h b/src/tools/clangrefactoringbackend/source/findcursorusr.h index 0c228c67e8..549086cd3a 100644 --- a/src/tools/clangrefactoringbackend/source/findcursorusr.h +++ b/src/tools/clangrefactoringbackend/source/findcursorusr.h @@ -25,26 +25,12 @@ #pragma once -#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 #include #include #include #include -#if defined(__GNUC__) -# pragma GCC diagnostic pop -#elif defined(_MSC_VER) -# pragma warning(pop) -#endif - #include namespace ClangBackEnd { @@ -54,8 +40,8 @@ class FindNamedDeclarationASTVisitor : public clang::RecursiveASTVisitor takeNamedDecl() { - return std::move(namedDeclarations); + return std::move(m_namedDeclarations); } private: @@ -138,7 +124,7 @@ private: bool isValid = isValidLocationWithCursorInside(startLocation, endLocation); if (isValid) - namedDeclarations.push_back(declaration); + m_namedDeclarations.push_back(declaration); return !isValid; } @@ -153,20 +139,20 @@ private: bool isCursorLocationBetween(const clang::SourceLocation startLocation, const clang::SourceLocation endLocation) { - return cursorSourceLocation == startLocation - || cursorSourceLocation == endLocation - || (sourceManager.isBeforeInTranslationUnit(startLocation, cursorSourceLocation) - && sourceManager.isBeforeInTranslationUnit(cursorSourceLocation, endLocation)); + return m_cursorSourceLocation == startLocation + || m_cursorSourceLocation == endLocation + || (m_sourceManager.isBeforeInTranslationUnit(startLocation, m_cursorSourceLocation) + && m_sourceManager.isBeforeInTranslationUnit(m_cursorSourceLocation, endLocation)); } - std::vector namedDeclarations; - const clang::SourceManager &sourceManager; - const clang::SourceLocation cursorSourceLocation; + std::vector m_namedDeclarations; + const clang::SourceManager &m_sourceManager; + const clang::SourceLocation m_cursorSourceLocation; }; inline std::vector namedDeclarationsAt(const clang::ASTContext &Context, - const clang::SourceLocation cursorSourceLocation) + const clang::SourceLocation cursorSourceLocation) { const auto &sourceManager = Context.getSourceManager(); const auto currentFile = sourceManager.getFilename(cursorSourceLocation); -- cgit v1.2.1