From d8b9acc790a64e401549b51ba9defe340e58c9d4 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 2 Mar 2018 09:56:44 -0800 Subject: [PATCH] [waf] Remove -Werror and reorder some libclang labels --- src/clang_indexer.cc | 56 +++++++++++++++++++++++++++----------------- src/command_line.cc | 6 ++--- wscript | 2 +- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/clang_indexer.cc b/src/clang_indexer.cc index 958db0f6..1564e112 100644 --- a/src/clang_indexer.cc +++ b/src/clang_indexer.cc @@ -83,9 +83,6 @@ Role GetRole(const CXIdxEntityRefInfo* ref_info, Role role) { SymbolKind GetSymbolKind(CXCursorKind kind) { switch (kind) { - default: - return SymbolKind::Invalid; - case CXCursor_FunctionDecl: case CXCursor_CXXMethod: case CXCursor_Constructor: @@ -94,71 +91,86 @@ SymbolKind GetSymbolKind(CXCursorKind kind) { case CXCursor_FunctionTemplate: case CXCursor_OverloadedDeclRef: case CXCursor_LambdaExpr: + case CXCursor_ObjCInstanceMethodDecl: + case CXCursor_ObjCClassMethodDecl: return SymbolKind::Func; - case CXCursor_Namespace: - case CXCursor_EnumDecl: - case CXCursor_UnionDecl: case CXCursor_StructDecl: + case CXCursor_UnionDecl: case CXCursor_ClassDecl: + case CXCursor_EnumDecl: + case CXCursor_ObjCInterfaceDecl: + case CXCursor_ObjCCategoryDecl: + case CXCursor_ObjCImplementationDecl: + case CXCursor_Namespace: return SymbolKind::Type; + + default: + return SymbolKind::Invalid; } } // Inverse of libclang/CXIndexDataConsumer.cpp getEntityKindFromSymbolKind lsSymbolKind GetSymbolKind(CXIdxEntityKind kind) { switch (kind) { - default: + case CXIdxEntity_Unexposed: return lsSymbolKind::Unknown; - - case CXIdxEntity_Enum: - return lsSymbolKind::Enum; - case CXIdxEntity_Struct: - case CXIdxEntity_Union: - return lsSymbolKind::Struct; - case CXIdxEntity_CXXTypeAlias: case CXIdxEntity_Typedef: return lsSymbolKind::TypeAlias; - case CXIdxEntity_Function: return lsSymbolKind::Function; case CXIdxEntity_Variable: // Can also be Parameter return lsSymbolKind::Variable; case CXIdxEntity_Field: - case CXIdxEntity_ObjCIvar: return lsSymbolKind::Field; case CXIdxEntity_EnumConstant: return lsSymbolKind::EnumMember; - case CXIdxEntity_CXXClass: + case CXIdxEntity_ObjCClass: return lsSymbolKind::Class; - case CXIdxEntity_CXXInterface: case CXIdxEntity_ObjCProtocol: return lsSymbolKind::Interface; case CXIdxEntity_ObjCCategory: return lsSymbolKind::Interface; - case CXIdxEntity_CXXInstanceMethod: + case CXIdxEntity_ObjCInstanceMethod: return lsSymbolKind::Method; case CXIdxEntity_ObjCClassMethod: return lsSymbolKind::StaticMethod; - case CXIdxEntity_CXXStaticMethod: - return lsSymbolKind::StaticMethod; case CXIdxEntity_ObjCProperty: return lsSymbolKind::Property; - case CXIdxEntity_CXXStaticVariable: + case CXIdxEntity_ObjCIvar: return lsSymbolKind::Field; + + case CXIdxEntity_Enum: + return lsSymbolKind::Enum; + case CXIdxEntity_Struct: + case CXIdxEntity_Union: + return lsSymbolKind::Struct; + + case CXIdxEntity_CXXClass: + return lsSymbolKind::Class; case CXIdxEntity_CXXNamespace: return lsSymbolKind::Namespace; case CXIdxEntity_CXXNamespaceAlias: return lsSymbolKind::Namespace; + case CXIdxEntity_CXXStaticVariable: + return lsSymbolKind::Field; + case CXIdxEntity_CXXStaticMethod: + return lsSymbolKind::StaticMethod; + case CXIdxEntity_CXXInstanceMethod: + return lsSymbolKind::Method; case CXIdxEntity_CXXConstructor: return lsSymbolKind::Constructor; case CXIdxEntity_CXXDestructor: return lsSymbolKind::Method; case CXIdxEntity_CXXConversionFunction: return lsSymbolKind::Constructor; + case CXIdxEntity_CXXTypeAlias: + return lsSymbolKind::TypeAlias; + case CXIdxEntity_CXXInterface: + return lsSymbolKind::Struct; } } diff --git a/src/command_line.cc b/src/command_line.cc index 020e8836..1611cb0d 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -324,10 +324,8 @@ void LaunchStdinLoop(Config* config, queue->for_querydb.PushBack(std::move(message)); break; - default: { - LOG_S(ERROR) << "Unhandled IPC message " << IpcIdToString(method_id); - exit(1); - } + case IpcId::Unknown: + break; } // If the message was to exit then querydb will take care of the actual diff --git a/wscript b/wscript index 6b3a5dfc..748097c1 100644 --- a/wscript +++ b/wscript @@ -166,7 +166,7 @@ def configure(ctx): if ctx.env.CXXFLAGS: cxxflags = ctx.env.CXXFLAGS else: - cxxflags = ['-g', '-Wall', '-Wno-sign-compare', '-Werror'] + cxxflags = ['-g', '-Wall', '-Wno-sign-compare'] if ctx.env.CXX_NAME == 'gcc': cxxflags.append('-Wno-return-type') # Otherwise (void)write(...) => -Werror=unused-result