mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Fix some more warnings from clang
This commit is contained in:
parent
8910d0a13e
commit
c66c927c1f
@ -1,54 +0,0 @@
|
|||||||
cmake_minimum_required (VERSION 3.3.1)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Project configuration
|
|
||||||
#
|
|
||||||
project (SuperClangIndex)
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
file(GLOB SOURCE_FILES *.cc *.cpp libclangmm/*.cc)
|
|
||||||
find_program(llvm_config llvm-config-3.8)
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Find clang library and include directories
|
|
||||||
#
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${llvm_config} --includedir
|
|
||||||
OUTPUT_VARIABLE LIBCLANG_INCLUDEDIR)
|
|
||||||
string(STRIP "${LIBCLANG_INCLUDEDIR}" LIBCLANG_INCLUDEDIR)
|
|
||||||
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${llvm_config} --libdir
|
|
||||||
OUTPUT_VARIABLE LIBCLANG_LIBDIR)
|
|
||||||
string(STRIP "${LIBCLANG_LIBDIR}" LIBCLANG_LIBDIR)
|
|
||||||
|
|
||||||
find_library(LIBCLANG_LIBRARIES NAMES libclang clang
|
|
||||||
PATHS ${LIBCLANG_LIBDIR})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set(LIBCLANG_INCLUDEDIR "/usr/local/google/home/jdufault/super-clang-index/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04/include")
|
|
||||||
set(LIBCLANG_LIBDIR "/usr/local/google/home/jdufault/super-clang-index/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04/lib")
|
|
||||||
set(LIBCLANG_LIBRARIES "/usr/local/google/home/jdufault/super-clang-index/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04/lib/libclang.so")
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Debugging
|
|
||||||
#
|
|
||||||
#message("SOURCE_FILES: " ${SOURCE_FILES} )
|
|
||||||
message("LIBCLANG_INCLUDEDIR: " ${LIBCLANG_INCLUDEDIR})
|
|
||||||
message("LIBCLANG_LIBDIR: " ${LIBCLANG_LIBDIR})
|
|
||||||
message("LIBCLANG_LIBRARIES: " ${LIBCLANG_LIBRARIES})
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Setup output binary.
|
|
||||||
#
|
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/third_party/rapidjson/include")
|
|
||||||
include_directories("${LIBCLANG_INCLUDEDIR}")
|
|
||||||
|
|
||||||
add_executable (indexer ${SOURCE_FILES})
|
|
||||||
target_link_libraries(indexer ${LIBCLANG_LIBRARIES})
|
|
@ -57,6 +57,7 @@ const int kExpectedClientVersion = 1;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if false
|
||||||
std::string FormatMicroseconds(long long microseconds) {
|
std::string FormatMicroseconds(long long microseconds) {
|
||||||
long long milliseconds = microseconds / 1000;
|
long long milliseconds = microseconds / 1000;
|
||||||
long long remaining = microseconds - milliseconds;
|
long long remaining = microseconds - milliseconds;
|
||||||
@ -67,6 +68,7 @@ while (remaining >= 100)
|
|||||||
|
|
||||||
return std::to_string(milliseconds) + "." + std::to_string(remaining) + "ms";
|
return std::to_string(milliseconds) + "." + std::to_string(remaining) + "ms";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -467,6 +469,8 @@ std::vector<QueryLocation> GetDeclarationsOfSymbolForGotoDefinition(QueryDatabas
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "include_completion.h"
|
#include "include_completion.h"
|
||||||
|
|
||||||
#include "match.h"
|
#include "match.h"
|
||||||
@ -8,6 +6,8 @@
|
|||||||
#include "standard_includes.h"
|
#include "standard_includes.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
std::string ElideLongPath(Config* config, const std::string& path) {
|
std::string ElideLongPath(Config* config, const std::string& path) {
|
||||||
@ -96,7 +96,7 @@ lsCompletionItem BuildCompletionItem(Config* config, std::string path, bool use_
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
IncludeCompletion::IncludeCompletion(Config* config, Project* project)
|
IncludeCompletion::IncludeCompletion(Config* config, Project* project)
|
||||||
: config_(config), project_(project), is_scanning(false) {}
|
: is_scanning(false), config_(config), project_(project) {}
|
||||||
|
|
||||||
void IncludeCompletion::Rescan() {
|
void IncludeCompletion::Rescan() {
|
||||||
if (is_scanning)
|
if (is_scanning)
|
||||||
|
@ -412,6 +412,8 @@ clang::VisiterResult FindTypeVisitor(clang::Cursor cursor,
|
|||||||
case CXCursor_TemplateRef:
|
case CXCursor_TemplateRef:
|
||||||
*result = cursor;
|
*result = cursor;
|
||||||
return clang::VisiterResult::Break;
|
return clang::VisiterResult::Break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return clang::VisiterResult::Recurse;
|
return clang::VisiterResult::Recurse;
|
||||||
@ -485,7 +487,7 @@ clang::VisiterResult VisitDeclForTypeUsageVisitor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
param->previous_cursor = cursor;
|
param->previous_cursor = cursor;
|
||||||
break;
|
return clang::VisiterResult::Continue;
|
||||||
|
|
||||||
// We do not want to recurse for everything, since if we do that we will end
|
// We do not want to recurse for everything, since if we do that we will end
|
||||||
// up visiting method definition bodies/etc. Instead, we only recurse for
|
// up visiting method definition bodies/etc. Instead, we only recurse for
|
||||||
@ -501,6 +503,9 @@ clang::VisiterResult VisitDeclForTypeUsageVisitor(
|
|||||||
case CXCursor_CXXStaticCastExpr:
|
case CXCursor_CXXStaticCastExpr:
|
||||||
case CXCursor_CXXReinterpretCastExpr:
|
case CXCursor_CXXReinterpretCastExpr:
|
||||||
return clang::VisiterResult::Recurse;
|
return clang::VisiterResult::Recurse;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return clang::VisiterResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return clang::VisiterResult::Continue;
|
return clang::VisiterResult::Continue;
|
||||||
@ -684,7 +689,7 @@ clang::VisiterResult AddDeclInitializerUsagesVisitor(clang::Cursor cursor,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
switch (cursor.get_kind()) {
|
switch (cursor.get_kind()) {
|
||||||
case CXCursor_DeclRefExpr:
|
case CXCursor_DeclRefExpr: {
|
||||||
if (cursor.get_referenced().get_kind() != CXCursor_VarDecl)
|
if (cursor.get_referenced().get_kind() != CXCursor_VarDecl)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -712,6 +717,10 @@ clang::VisiterResult AddDeclInitializerUsagesVisitor(clang::Cursor cursor,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return clang::VisiterResult::Recurse;
|
return clang::VisiterResult::Recurse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,7 +744,7 @@ bool AreEqualLocations(CXIdxLoc loc, CXCursor cursor) {
|
|||||||
clang::VisiterResult VisitMacroDefinitionAndExpansions(clang::Cursor cursor, clang::Cursor parent, IndexParam* param) {
|
clang::VisiterResult VisitMacroDefinitionAndExpansions(clang::Cursor cursor, clang::Cursor parent, IndexParam* param) {
|
||||||
switch (cursor.get_kind()) {
|
switch (cursor.get_kind()) {
|
||||||
case CXCursor_MacroDefinition:
|
case CXCursor_MacroDefinition:
|
||||||
case CXCursor_MacroExpansion:
|
case CXCursor_MacroExpansion: {
|
||||||
// Resolve location, find IndexFile instance.
|
// Resolve location, find IndexFile instance.
|
||||||
CXSourceRange cx_source_range = clang_Cursor_getSpellingNameRange(cursor.cx_cursor, 0, 0);
|
CXSourceRange cx_source_range = clang_Cursor_getSpellingNameRange(cursor.cx_cursor, 0, 0);
|
||||||
CXSourceLocation start = clang_getRangeStart(cx_source_range);
|
CXSourceLocation start = clang_getRangeStart(cx_source_range);
|
||||||
@ -771,6 +780,9 @@ clang::VisiterResult VisitMacroDefinitionAndExpansions(clang::Cursor cursor, cla
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return clang::VisiterResult::Continue;
|
return clang::VisiterResult::Continue;
|
||||||
}
|
}
|
||||||
@ -1052,6 +1064,8 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
|||||||
// AddInterestingUsageToType(db, arg_type,
|
// AddInterestingUsageToType(db, arg_type,
|
||||||
// FindLocationOfTypeSpecifier(arg));
|
// FindLocationOfTypeSpecifier(arg));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1222,6 +1236,9 @@ bool IsFunctionCallContext(CXCursorKind kind) {
|
|||||||
// TODO: we need to test lambdas
|
// TODO: we need to test lambdas
|
||||||
case CXCursor_LambdaExpr:
|
case CXCursor_LambdaExpr:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -44,6 +44,8 @@ Type Type::strip_qualifiers() const {
|
|||||||
case CXType_LValueReference:
|
case CXType_LValueReference:
|
||||||
case CXType_Pointer:
|
case CXType_Pointer:
|
||||||
return clang_getPointeeType(cx_type);
|
return clang_getPointeeType(cx_type);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cx_type;
|
return cx_type;
|
||||||
|
@ -326,6 +326,8 @@ std::string clang::ToString(CXCursorKind kind) {
|
|||||||
// case CXCursor_FirstExtraDecl: return "FirstExtraDecl";
|
// case CXCursor_FirstExtraDecl: return "FirstExtraDecl";
|
||||||
case CXCursor_LastExtraDecl:
|
case CXCursor_LastExtraDecl:
|
||||||
return "LastExtraDecl";
|
return "LastExtraDecl";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return "<unknown kind>";
|
return "<unknown kind>";
|
||||||
}
|
}
|
||||||
|
@ -625,6 +625,8 @@ void QueryDatabase::RemoveUsrs(SymbolKind usr_kind, const std::vector<Usr>& to_r
|
|||||||
vars[usr_to_var[usr].id] = nullopt;
|
vars[usr_to_var[usr].id] = nullopt;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SymbolKind::Invalid:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user