mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35: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,16 +57,18 @@ const int kExpectedClientVersion = 1;
|
||||
|
||||
|
||||
|
||||
#if false
|
||||
std::string FormatMicroseconds(long long microseconds) {
|
||||
long long milliseconds = microseconds / 1000;
|
||||
long long remaining = microseconds - milliseconds;
|
||||
long long milliseconds = microseconds / 1000;
|
||||
long long remaining = microseconds - milliseconds;
|
||||
|
||||
// Only show two digits after the dot.
|
||||
while (remaining >= 100)
|
||||
// Only show two digits after the dot.
|
||||
while (remaining >= 100)
|
||||
remaining /= 10;
|
||||
|
||||
return std::to_string(milliseconds) + "." + std::to_string(remaining) + "ms";
|
||||
return std::to_string(milliseconds) + "." + std::to_string(remaining) + "ms";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -86,15 +88,15 @@ return std::to_string(milliseconds) + "." + std::to_string(remaining) + "ms";
|
||||
// the user erases a character. vscode will resend the completion request if
|
||||
// that happens.
|
||||
struct CodeCompleteCache {
|
||||
optional<std::string> cached_path;
|
||||
optional<lsPosition> cached_completion_position;
|
||||
NonElidedVector<lsCompletionItem> cached_results;
|
||||
NonElidedVector<lsDiagnostic> cached_diagnostics;
|
||||
optional<std::string> cached_path;
|
||||
optional<lsPosition> cached_completion_position;
|
||||
NonElidedVector<lsCompletionItem> cached_results;
|
||||
NonElidedVector<lsDiagnostic> cached_diagnostics;
|
||||
|
||||
bool IsCacheValid(lsTextDocumentPositionParams position) const {
|
||||
bool IsCacheValid(lsTextDocumentPositionParams position) const {
|
||||
return cached_path == position.textDocument.uri.GetPath() &&
|
||||
cached_completion_position == position.position;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -467,6 +469,8 @@ std::vector<QueryLocation> GetDeclarationsOfSymbolForGotoDefinition(QueryDatabas
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return {};
|
||||
|
@ -1,5 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "include_completion.h"
|
||||
|
||||
#include "match.h"
|
||||
@ -8,6 +6,8 @@
|
||||
#include "standard_includes.h"
|
||||
#include "timer.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
namespace {
|
||||
|
||||
std::string ElideLongPath(Config* config, const std::string& path) {
|
||||
@ -96,7 +96,7 @@ lsCompletionItem BuildCompletionItem(Config* config, std::string path, bool use_
|
||||
} // namespace
|
||||
|
||||
IncludeCompletion::IncludeCompletion(Config* config, Project* project)
|
||||
: config_(config), project_(project), is_scanning(false) {}
|
||||
: is_scanning(false), config_(config), project_(project) {}
|
||||
|
||||
void IncludeCompletion::Rescan() {
|
||||
if (is_scanning)
|
||||
|
@ -412,6 +412,8 @@ clang::VisiterResult FindTypeVisitor(clang::Cursor cursor,
|
||||
case CXCursor_TemplateRef:
|
||||
*result = cursor;
|
||||
return clang::VisiterResult::Break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return clang::VisiterResult::Recurse;
|
||||
@ -485,7 +487,7 @@ clang::VisiterResult VisitDeclForTypeUsageVisitor(
|
||||
}
|
||||
|
||||
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
|
||||
// up visiting method definition bodies/etc. Instead, we only recurse for
|
||||
@ -501,6 +503,9 @@ clang::VisiterResult VisitDeclForTypeUsageVisitor(
|
||||
case CXCursor_CXXStaticCastExpr:
|
||||
case CXCursor_CXXReinterpretCastExpr:
|
||||
return clang::VisiterResult::Recurse;
|
||||
|
||||
default:
|
||||
return clang::VisiterResult::Continue;
|
||||
}
|
||||
|
||||
return clang::VisiterResult::Continue;
|
||||
@ -684,7 +689,7 @@ clang::VisiterResult AddDeclInitializerUsagesVisitor(clang::Cursor cursor,
|
||||
*/
|
||||
|
||||
switch (cursor.get_kind()) {
|
||||
case CXCursor_DeclRefExpr:
|
||||
case CXCursor_DeclRefExpr: {
|
||||
if (cursor.get_referenced().get_kind() != CXCursor_VarDecl)
|
||||
break;
|
||||
|
||||
@ -712,6 +717,10 @@ clang::VisiterResult AddDeclInitializerUsagesVisitor(clang::Cursor cursor,
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
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) {
|
||||
switch (cursor.get_kind()) {
|
||||
case CXCursor_MacroDefinition:
|
||||
case CXCursor_MacroExpansion:
|
||||
case CXCursor_MacroExpansion: {
|
||||
// Resolve location, find IndexFile instance.
|
||||
CXSourceRange cx_source_range = clang_Cursor_getSpellingNameRange(cursor.cx_cursor, 0, 0);
|
||||
CXSourceLocation start = clang_getRangeStart(cx_source_range);
|
||||
@ -771,6 +780,9 @@ clang::VisiterResult VisitMacroDefinitionAndExpansions(clang::Cursor cursor, cla
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return clang::VisiterResult::Continue;
|
||||
}
|
||||
@ -1052,6 +1064,8 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
||||
// AddInterestingUsageToType(db, arg_type,
|
||||
// FindLocationOfTypeSpecifier(arg));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1222,6 +1236,9 @@ bool IsFunctionCallContext(CXCursorKind kind) {
|
||||
// TODO: we need to test lambdas
|
||||
case CXCursor_LambdaExpr:
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -44,6 +44,8 @@ Type Type::strip_qualifiers() const {
|
||||
case CXType_LValueReference:
|
||||
case CXType_Pointer:
|
||||
return clang_getPointeeType(cx_type);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return cx_type;
|
||||
|
@ -326,6 +326,8 @@ std::string clang::ToString(CXCursorKind kind) {
|
||||
// case CXCursor_FirstExtraDecl: return "FirstExtraDecl";
|
||||
case CXCursor_LastExtraDecl:
|
||||
return "LastExtraDecl";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
case SymbolKind::Invalid:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user