clang format, indent pp directives

This commit is contained in:
Ludovic Jozeau 2020-07-20 12:45:51 +02:00
parent cb08df44aa
commit 8bd9cf07ff
9 changed files with 55 additions and 54 deletions

View File

@ -1 +1,2 @@
BasedOnStyle: LLVM BasedOnStyle: LLVM
IndentPPDirectives: AfterHash

View File

@ -119,7 +119,7 @@ buildCompilerInvocation(const std::string &main, std::vector<const char *> args,
const driver::JobList &jobs = comp->getJobs(); const driver::JobList &jobs = comp->getJobs();
bool offload_compilation = false; bool offload_compilation = false;
if (jobs.size() > 1) { if (jobs.size() > 1) {
for (auto &a : comp->getActions()){ for (auto &a : comp->getActions()) {
// On MacOSX real actions may end up being wrapped in BindArchAction // On MacOSX real actions may end up being wrapped in BindArchAction
if (isa<driver::BindArchAction>(a)) if (isa<driver::BindArchAction>(a))
a = *a->input_begin(); a = *a->input_begin();

View File

@ -687,7 +687,7 @@ public:
IndexDataConsumer(IndexParam &param) : param(param) {} IndexDataConsumer(IndexParam &param) : param(param) {}
void initialize(ASTContext &ctx) override { this->ctx = param.ctx = &ctx; } void initialize(ASTContext &ctx) override { this->ctx = param.ctx = &ctx; }
#if LLVM_VERSION_MAJOR < 10 // llvmorg-10-init-12036-g3b9715cb219 #if LLVM_VERSION_MAJOR < 10 // llvmorg-10-init-12036-g3b9715cb219
# define handleDeclOccurrence handleDeclOccurence # define handleDeclOccurrence handleDeclOccurence
#endif #endif
bool handleDeclOccurrence(const Decl *d, index::SymbolRoleSet roles, bool handleDeclOccurrence(const Decl *d, index::SymbolRoleSet roles,
ArrayRef<index::SymbolRelation> relations, ArrayRef<index::SymbolRelation> relations,
@ -885,10 +885,10 @@ public:
Usr usr1 = getUsr(d1, &info1); Usr usr1 = getUsr(d1, &info1);
IndexType &type1 = db->toType(usr1); IndexType &type1 = db->toType(usr1);
SourceLocation sl1 = d1->getLocation(); SourceLocation sl1 = d1->getLocation();
type1.def.spell = { type1.def.spell = {Use{{fromTokenRange(sm, lang, {sl1, sl1}),
Use{{fromTokenRange(sm, lang, {sl1, sl1}), Role::Definition}, Role::Definition},
lid}, lid},
fromTokenRange(sm, lang, sr1)}; fromTokenRange(sm, lang, sr1)};
type1.def.detailed_name = intern(info1->short_name); type1.def.detailed_name = intern(info1->short_name);
type1.def.short_name_size = int16_t(info1->short_name.size()); type1.def.short_name_size = int16_t(info1->short_name.size());
type1.def.kind = SymbolKind::TypeParameter; type1.def.kind = SymbolKind::TypeParameter;
@ -1208,7 +1208,7 @@ class IndexDiags : public DiagnosticConsumer {
public: public:
llvm::SmallString<64> message; llvm::SmallString<64> message;
void HandleDiagnostic(DiagnosticsEngine::Level level, void HandleDiagnostic(DiagnosticsEngine::Level level,
const clang::Diagnostic &info) override { const clang::Diagnostic &info) override {
DiagnosticConsumer::HandleDiagnostic(level, info); DiagnosticConsumer::HandleDiagnostic(level, info);
if (message.empty()) if (message.empty())
info.FormatDiagnostic(message); info.FormatDiagnostic(message);

View File

@ -27,7 +27,7 @@
#include <shared_mutex> #include <shared_mutex>
#include <thread> #include <thread>
#ifndef _WIN32 #ifndef _WIN32
#include <unistd.h> # include <unistd.h>
#endif #endif
using namespace llvm; using namespace llvm;
namespace chrono = std::chrono; namespace chrono = std::chrono;

View File

@ -2,38 +2,38 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
#if defined(__unix__) || defined(__APPLE__) #if defined(__unix__) || defined(__APPLE__)
#include "platform.hh" # include "platform.hh"
#include "utils.hh" # include "utils.hh"
#include <assert.h> # include <assert.h>
#include <limits.h> # include <limits.h>
#include <stdio.h> # include <stdio.h>
#include <stdlib.h> # include <stdlib.h>
#include <string.h> # include <string.h>
#include <time.h> # include <time.h>
#include <dirent.h> # include <dirent.h>
#include <errno.h> # include <errno.h>
#include <fcntl.h> # include <fcntl.h>
#include <pthread.h> # include <pthread.h>
#include <signal.h> # include <signal.h>
#include <sys/resource.h> # include <sys/resource.h>
#include <sys/stat.h> # include <sys/stat.h>
#include <sys/types.h> // required for stat.h # include <sys/types.h> // required for stat.h
#include <sys/wait.h> # include <sys/wait.h>
#include <unistd.h> # include <unistd.h>
#ifdef __GLIBC__ # ifdef __GLIBC__
#include <malloc.h> # include <malloc.h>
#endif # endif
#include <llvm/ADT/SmallString.h> # include <llvm/ADT/SmallString.h>
#include <llvm/Support/Path.h> # include <llvm/Support/Path.h>
#include <atomic> # include <atomic>
#include <condition_variable> # include <condition_variable>
#include <mutex> # include <mutex>
#include <string> # include <string>
namespace ccls { namespace ccls {
namespace pipeline { namespace pipeline {
@ -47,9 +47,9 @@ std::string normalizePath(llvm::StringRef path) {
} }
void freeUnusedMemory() { void freeUnusedMemory() {
#ifdef __GLIBC__ # ifdef __GLIBC__
malloc_trim(4 * 1024 * 1024); malloc_trim(4 * 1024 * 1024);
#endif # endif
} }
void traceMe() { void traceMe() {

View File

@ -2,21 +2,21 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
#if defined(_WIN32) #if defined(_WIN32)
#include "platform.hh" # include "platform.hh"
#include "utils.hh" # include "utils.hh"
#include <Windows.h> # include <Windows.h>
#include <direct.h> # include <direct.h>
#include <fcntl.h> # include <fcntl.h>
#include <io.h> # include <io.h>
#include <sys/stat.h> # include <sys/stat.h>
#include <sys/types.h> # include <sys/types.h>
#include <algorithm> # include <algorithm>
#include <string> # include <string>
#include <thread> # include <thread>
namespace ccls { namespace ccls {
std::string normalizePath(llvm::StringRef path) { std::string normalizePath(llvm::StringRef path) {

View File

@ -25,9 +25,9 @@
#include <rapidjson/writer.h> #include <rapidjson/writer.h>
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> # include <Windows.h>
#else #else
#include <unistd.h> # include <unistd.h>
#endif #endif
#include <array> #include <array>

View File

@ -47,12 +47,12 @@ struct ProxyFileSystem : FileSystem {
std::error_code setCurrentWorkingDirectory(const Twine &Path) override { std::error_code setCurrentWorkingDirectory(const Twine &Path) override {
return FS->setCurrentWorkingDirectory(Path); return FS->setCurrentWorkingDirectory(Path);
} }
#if LLVM_VERSION_MAJOR == 7 # if LLVM_VERSION_MAJOR == 7
std::error_code getRealPath(const Twine &Path, std::error_code getRealPath(const Twine &Path,
SmallVectorImpl<char> &Output) const override { SmallVectorImpl<char> &Output) const override {
return FS->getRealPath(Path, Output); return FS->getRealPath(Path, Output);
} }
#endif # endif
FileSystem &getUnderlyingFS() { return *FS; } FileSystem &getUnderlyingFS() { return *FS; }
IntrusiveRefCntPtr<FileSystem> FS; IntrusiveRefCntPtr<FileSystem> FS;
}; };

View File

@ -25,8 +25,8 @@
// The 'diff' utility is available and we can use dprintf(3). // The 'diff' utility is available and we can use dprintf(3).
#if _POSIX_C_SOURCE >= 200809L #if _POSIX_C_SOURCE >= 200809L
#include <sys/wait.h> # include <sys/wait.h>
#include <unistd.h> # include <unistd.h>
#endif #endif
using namespace llvm; using namespace llvm;