kuhnel updated this revision to Diff 403538. kuhnel added a comment. Herald added a subscriber: aheejin.
Re-created the patch as there were too many changes in the repo. Excluding gtest Matchers from naming checks as gtest convention does not match LLVM convention. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115634/new/ https://reviews.llvm.org/D115634 Files: .clang-tidy clang-tools-extra/clangd/ClangdLSPServer.cpp clang-tools-extra/clangd/SourceCode.cpp clang-tools-extra/clangd/TUScheduler.cpp clang-tools-extra/clangd/XRefs.cpp clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp clang-tools-extra/clangd/index/YAMLSerialization.cpp clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp clang-tools-extra/clangd/unittests/CallHierarchyTests.cpp clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp clang-tools-extra/clangd/unittests/FileIndexTests.cpp clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp clang-tools-extra/clangd/unittests/HeadersTests.cpp clang-tools-extra/clangd/unittests/IndexActionTests.cpp clang-tools-extra/clangd/unittests/JSONTransportTests.cpp clang-tools-extra/clangd/unittests/QualityTests.cpp clang-tools-extra/clangd/unittests/SerializationTests.cpp clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp clang-tools-extra/clangd/unittests/TestIndex.cpp clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp clang-tools-extra/clangd/unittests/XRefsTests.cpp clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp clang-tools-extra/clangd/unittests/support/TraceTests.cpp
Index: clang-tools-extra/clangd/unittests/support/TraceTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/support/TraceTests.cpp +++ clang-tools-extra/clangd/unittests/support/TraceTests.cpp @@ -39,7 +39,7 @@ // Checks that N is a Mapping (JS object) with the expected scalar properties. // The object must have all the Expected properties, but may have others. -bool VerifyObject(llvm::yaml::Node &N, +bool VerifyObject(llvm::yaml::Node &N, // NOLINT(readability-identifier-naming) std::map<std::string, std::string> Expected) { auto *M = llvm::dyn_cast<llvm::yaml::MappingNode>(&N); if (!M) { Index: clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp +++ clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp @@ -29,7 +29,7 @@ int Counter(0); /* GUARDED_BY(Mutex) */ { AsyncTaskRunner Tasks; - auto scheduleIncrements = [&]() { + auto ScheduleIncrements = [&]() { for (int TaskI = 0; TaskI < TasksCnt; ++TaskI) { Tasks.runAsync("task", [&Counter, &Mutex, IncrementsPerTask]() { for (int Increment = 0; Increment < IncrementsPerTask; ++Increment) { @@ -44,7 +44,7 @@ // Make sure runAsync is not running tasks synchronously on the same // thread by locking the Mutex used for increments. std::lock_guard<std::mutex> Lock(Mutex); - scheduleIncrements(); + ScheduleIncrements(); } Tasks.wait(); @@ -56,7 +56,7 @@ { std::lock_guard<std::mutex> Lock(Mutex); Counter = 0; - scheduleIncrements(); + ScheduleIncrements(); } } // Check that destructor has waited for tasks to finish. Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/XRefsTests.cpp +++ clang-tools-extra/clangd/unittests/XRefsTests.cpp @@ -60,6 +60,7 @@ // Extracts ranges from an annotated example, and constructs a matcher for a // highlight set. Ranges should be named $read/$write as appropriate. Matcher<const std::vector<DocumentHighlight> &> +// NOLINTNEXTLINE(readability-identifier-naming) HighlightsFrom(const Annotations &Test) { std::vector<DocumentHighlight> Expected; auto Add = [&](const Range &R, DocumentHighlightKind K) { Index: clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp +++ clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp @@ -39,11 +39,13 @@ MATCHER_P(WithKind, Kind, "") { return arg.kind == Kind; } MATCHER_P(SelectionRangeIs, R, "") { return arg.selectionRange == R; } template <class... ParentMatchers> +// NOLINTNEXTLINE(readability-identifier-naming) ::testing::Matcher<TypeHierarchyItem> Parents(ParentMatchers... ParentsM) { return Field(&TypeHierarchyItem::parents, HasValue(UnorderedElementsAre(ParentsM...))); } template <class... ChildMatchers> +// NOLINTNEXTLINE(readability-identifier-naming) ::testing::Matcher<TypeHierarchyItem> Children(ChildMatchers... ChildrenM) { return Field(&TypeHierarchyItem::children, HasValue(UnorderedElementsAre(ChildrenM...))); Index: clang-tools-extra/clangd/unittests/TestIndex.cpp =================================================================== --- clang-tools-extra/clangd/unittests/TestIndex.cpp +++ clang-tools-extra/clangd/unittests/TestIndex.cpp @@ -86,8 +86,8 @@ SymbolSlab generateNumSymbols(int Begin, int End) { std::vector<std::string> Names; - for (int i = Begin; i <= End; i++) - Names.push_back(std::to_string(i)); + for (int I = Begin; I <= End; I++) + Names.push_back(std::to_string(I)); return generateSymbols(Names); } Index: clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp +++ clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp @@ -26,10 +26,10 @@ using ::testing::UnorderedElementsAreArray; -auto CreateExpectedSymbolDetails = [](const std::string &name, - const std::string &container, +auto CreateExpectedSymbolDetails = [](const std::string &Name, + const std::string &Container, const std::string &USR) { - return SymbolDetails{name, container, USR, SymbolID(USR)}; + return SymbolDetails{Name, Container, USR, SymbolID(USR)}; }; TEST(SymbolInfoTests, All) { Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp +++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp @@ -101,6 +101,7 @@ return arg == Relation{Subject.ID, RelationKind::OverriddenBy, Object.ID}; } ::testing::Matcher<const std::vector<Ref> &> +// NOLINTNEXTLINE(readability-identifier-naming) HaveRanges(const std::vector<Range> Ranges) { return ::testing::UnorderedPointwise(RefRange(), Ranges); } Index: clang-tools-extra/clangd/unittests/SerializationTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/SerializationTests.cpp +++ clang-tools-extra/clangd/unittests/SerializationTests.cpp @@ -194,12 +194,15 @@ EXPECT_EQ(IGNDeserialized.Flags, IncludeGraphNode::SourceFlag(1)); } +// NOLINTNEXTLINE(readability-identifier-naming) std::vector<std::string> YAMLFromSymbols(const SymbolSlab &Slab) { std::vector<std::string> Result; for (const auto &Sym : Slab) Result.push_back(toYAML(Sym)); return Result; } + +// NOLINTNEXTLINE(readability-identifier-naming) std::vector<std::string> YAMLFromRefs(const RefSlab &Slab) { std::vector<std::string> Result; for (const auto &Refs : Slab) @@ -207,6 +210,7 @@ return Result; } +// NOLINTNEXTLINE(readability-identifier-naming) std::vector<std::string> YAMLFromRelations(const RelationSlab &Slab) { std::vector<std::string> Result; for (const auto &Rel : Slab) Index: clang-tools-extra/clangd/unittests/QualityTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/QualityTests.cpp +++ clang-tools-extra/clangd/unittests/QualityTests.cpp @@ -139,7 +139,7 @@ EXPECT_FLOAT_EQ(Relevance.SemaFileProximityScore, 1.0f) << "Current file and header"; - auto constructShadowDeclCompletionResult = [&](const std::string DeclName) { + auto ConstructShadowDeclCompletionResult = [&](const std::string DeclName) { auto *Shadow = *dyn_cast<UsingDecl>(&findDecl(AST, [&](const NamedDecl &ND) { if (const UsingDecl *Using = dyn_cast<UsingDecl>(&ND)) @@ -154,10 +154,10 @@ }; Relevance = {}; - Relevance.merge(constructShadowDeclCompletionResult("Bar")); + Relevance.merge(ConstructShadowDeclCompletionResult("Bar")); EXPECT_FLOAT_EQ(Relevance.SemaFileProximityScore, 1.0f) << "Using declaration in main file"; - Relevance.merge(constructShadowDeclCompletionResult("FLAGS_FOO")); + Relevance.merge(ConstructShadowDeclCompletionResult("FLAGS_FOO")); EXPECT_FLOAT_EQ(Relevance.SemaFileProximityScore, 1.0f) << "Using declaration in main file"; Index: clang-tools-extra/clangd/unittests/JSONTransportTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/JSONTransportTests.cpp +++ clang-tools-extra/clangd/unittests/JSONTransportTests.cpp @@ -40,7 +40,7 @@ std::string input() const { return InBuf; } std::string output() { return Out.str(); } - std::string input_mirror() { return Mirror.str(); } + std::string inputMirror() { return Mirror.str(); } }; // Echo is a simple server running on a transport: @@ -129,7 +129,7 @@ "Content-Length: 77\r\n\r\n" R"({"error":{"code":88,"message":"trouble at mill"},"id":"wxyz","jsonrpc":"2.0"})"; EXPECT_EQ(output(), WantOutput); - EXPECT_EQ(trim(input_mirror()), trim(input())); + EXPECT_EQ(trim(inputMirror()), trim(input())); } // Runs an Echo session using the "delimited" input and pretty-printed output @@ -185,7 +185,7 @@ "jsonrpc": "2.0" })"; EXPECT_EQ(output(), WantOutput); - EXPECT_EQ(trim(input_mirror()), trim(input())); + EXPECT_EQ(trim(inputMirror()), trim(input())); } // IO errors such as EOF ane reported. @@ -199,7 +199,7 @@ EXPECT_EQ(trim(E.log()), "Notification call: 1234"); EXPECT_TRUE(bool(Err)); // Ran into EOF with no handler signalling done. consumeError(std::move(Err)); - EXPECT_EQ(trim(input_mirror()), trim(input())); + EXPECT_EQ(trim(inputMirror()), trim(input())); } #endif Index: clang-tools-extra/clangd/unittests/IndexActionTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/IndexActionTests.cpp +++ clang-tools-extra/clangd/unittests/IndexActionTests.cpp @@ -40,6 +40,7 @@ } ::testing::Matcher<const IncludeGraphNode &> +// NOLINTNEXTLINE(readability-identifier-naming) IncludesAre(const std::vector<std::string> &Includes) { return ::testing::Field(&IncludeGraphNode::DirectIncludes, UnorderedPointwise(HasSameURI(), Includes)); Index: clang-tools-extra/clangd/unittests/HeadersTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/HeadersTests.cpp +++ clang-tools-extra/clangd/unittests/HeadersTests.cpp @@ -445,20 +445,20 @@ )cpp"); auto AST = TU.build(); - auto &vector_nonstd = findDecl(AST, "vector"); - auto *vec = + auto &VectorNonstd = findDecl(AST, "vector"); + auto *Vec = cast<VarDecl>(findDecl(AST, "vec")).getType()->getAsCXXRecordDecl(); - auto *nest = + auto *Nest = cast<VarDecl>(findDecl(AST, "nest")).getType()->getAsCXXRecordDecl(); - auto *sec = + auto *Sec = cast<VarDecl>(findDecl(AST, "sec")).getType()->getAsCXXRecordDecl(); - stdlib::Recognizer recognizer; + stdlib::Recognizer Recognizer; - EXPECT_EQ(recognizer(&vector_nonstd), llvm::None); - EXPECT_EQ(recognizer(vec), stdlib::Symbol::named("std::", "vector")); - EXPECT_EQ(recognizer(nest), stdlib::Symbol::named("std::", "vector")); - EXPECT_EQ(recognizer(sec), llvm::None); + EXPECT_EQ(Recognizer(&VectorNonstd), llvm::None); + EXPECT_EQ(Recognizer(Vec), stdlib::Symbol::named("std::", "vector")); + EXPECT_EQ(Recognizer(Nest), stdlib::Symbol::named("std::", "vector")); + EXPECT_EQ(Recognizer(Sec), llvm::None); } } // namespace Index: clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp +++ clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp @@ -41,6 +41,7 @@ // GMock helpers for matching DocumentSymbol. MATCHER_P(SymNameRange, Range, "") { return arg.selectionRange == Range; } template <class... ChildMatchers> +// NOLINTNEXTLINE(readability-identifier-naming) ::testing::Matcher<DocumentSymbol> Children(ChildMatchers... ChildrenM) { return Field(&DocumentSymbol::children, UnorderedElementsAre(ChildrenM...)); } Index: clang-tools-extra/clangd/unittests/FileIndexTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/FileIndexTests.cpp +++ clang-tools-extra/clangd/unittests/FileIndexTests.cpp @@ -67,6 +67,7 @@ namespace clangd { namespace { ::testing::Matcher<const RefSlab &> +// NOLINTNEXTLINE(readability-identifier-naming) RefsAre(std::vector<::testing::Matcher<Ref>> Matchers) { return ElementsAre(::testing::Pair(_, UnorderedElementsAreArray(Matchers))); } @@ -80,8 +81,8 @@ std::unique_ptr<SymbolSlab> numSlab(int Begin, int End) { SymbolSlab::Builder Slab; - for (int i = Begin; i <= End; i++) - Slab.insert(symbol(std::to_string(i))); + for (int I = Begin; I <= End; I++) + Slab.insert(symbol(std::to_string(I))); return std::make_unique<SymbolSlab>(std::move(Slab).build()); } Index: clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp =================================================================== --- clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp +++ clang-tools-extra/clangd/unittests/ExpectedTypeTest.cpp @@ -41,7 +41,7 @@ /// An overload for convenience. llvm::Optional<OpaqueType> fromCompletionResult(const NamedDecl *D) { return OpaqueType::fromCompletionResult( - ASTCtx(), CodeCompletionResult(D, CCP_Declaration)); + astCtx(), CodeCompletionResult(D, CCP_Declaration)); } /// A set of DeclNames whose type match each other computed by @@ -49,6 +49,7 @@ using EquivClass = std::set<std::string>; Matcher<std::map<std::string, EquivClass>> + // NOLINTNEXTLINE(readability-identifier-naming) ClassesAre(llvm::ArrayRef<EquivClass> Classes) { using MapEntry = std::map<std::string, EquivClass>::value_type; @@ -65,13 +66,13 @@ buildEquivClasses(llvm::ArrayRef<llvm::StringRef> DeclNames) { std::map<std::string, EquivClass> Classes; for (llvm::StringRef Name : DeclNames) { - auto Type = OpaqueType::fromType(ASTCtx(), typeOf(Name)); + auto Type = OpaqueType::fromType(astCtx(), typeOf(Name)); Classes[std::string(Type->raw())].insert(std::string(Name)); } return Classes; } - ASTContext &ASTCtx() { return AST->getASTContext(); } + ASTContext &astCtx() { return AST->getASTContext(); } private: // Set after calling build(). @@ -140,10 +141,10 @@ int* int_ptr; )cpp"); - OpaqueType IntTy = *OpaqueType::fromType(ASTCtx(), typeOf("int_")); + OpaqueType IntTy = *OpaqueType::fromType(astCtx(), typeOf("int_")); EXPECT_EQ(fromCompletionResult(decl("returns_int")), IntTy); - OpaqueType IntPtrTy = *OpaqueType::fromType(ASTCtx(), typeOf("int_ptr")); + OpaqueType IntPtrTy = *OpaqueType::fromType(astCtx(), typeOf("int_ptr")); EXPECT_EQ(fromCompletionResult(decl("returns_ptr")), IntPtrTy); } @@ -162,7 +163,7 @@ int* int_ptr_; )cpp"); - auto IntPtrTy = *OpaqueType::fromType(ASTCtx(), typeOf("int_ptr_")); + auto IntPtrTy = *OpaqueType::fromType(astCtx(), typeOf("int_ptr_")); EXPECT_EQ(fromCompletionResult(decl("returns_not_dependent")), IntPtrTy); EXPECT_EQ(fromCompletionResult(decl("returns_dependent")), llvm::None); Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp +++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp @@ -44,27 +44,32 @@ using ::testing::UnorderedElementsAre; using testing::UnorderedElementsAreArray; +// NOLINTNEXTLINE(readability-identifier-naming) ::testing::Matcher<const Diag &> WithFix(::testing::Matcher<Fix> FixMatcher) { return Field(&Diag::Fixes, ElementsAre(FixMatcher)); } +// NOLINTNEXTLINE(readability-identifier-naming) ::testing::Matcher<const Diag &> WithFix(::testing::Matcher<Fix> FixMatcher1, ::testing::Matcher<Fix> FixMatcher2) { return Field(&Diag::Fixes, UnorderedElementsAre(FixMatcher1, FixMatcher2)); } ::testing::Matcher<const Diag &> +// NOLINTNEXTLINE(readability-identifier-naming) WithNote(::testing::Matcher<Note> NoteMatcher) { return Field(&Diag::Notes, ElementsAre(NoteMatcher)); } ::testing::Matcher<const Diag &> +// NOLINTNEXTLINE(readability-identifier-naming) WithNote(::testing::Matcher<Note> NoteMatcher1, ::testing::Matcher<Note> NoteMatcher2) { return Field(&Diag::Notes, UnorderedElementsAre(NoteMatcher1, NoteMatcher2)); } ::testing::Matcher<const Diag &> +// NOLINTNEXTLINE(readability-identifier-naming) WithTag(::testing::Matcher<DiagnosticTag> TagMatcher) { return Field(&Diag::Tags, Contains(TagMatcher)); } @@ -114,10 +119,10 @@ } // Helper function to make tests shorter. -Position pos(int line, int character) { +Position pos(int Line, int Character) { Position Res; - Res.line = line; - Res.character = character; + Res.line = Line; + Res.character = Character; return Res; } Index: clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp +++ clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp @@ -22,6 +22,7 @@ namespace clang { namespace clangd { namespace config { +// NOLINTNEXTLINE(readability-identifier-naming) template <typename T> void PrintTo(const Located<T> &V, std::ostream *OS) { *OS << ::testing::PrintToString(*V); } Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -84,9 +84,11 @@ MATCHER_P(Signature, S, "") { return arg.Signature == S; } // Shorthand for Contains(Named(Name)). +// NOLINTNEXTLINE(readability-identifier-naming) Matcher<const std::vector<CodeCompletion> &> Has(std::string Name) { return Contains(Named(std::move(Name))); } +// NOLINTNEXTLINE(readability-identifier-naming) Matcher<const std::vector<CodeCompletion> &> Has(std::string Name, CompletionItemKind K) { return Contains(AllOf(Named(std::move(Name)), Kind(K))); @@ -1230,6 +1232,7 @@ /// \p AnnotatedLabel is a signature label with ranges marking parameters, e.g. /// foo([[int p1]], [[double p2]]) -> void +// NOLINTNEXTLINE(readability-identifier-naming) Matcher<SignatureInformation> Sig(llvm::StringRef AnnotatedLabel) { llvm::Annotations A(AnnotatedLabel); std::string Label = std::string(A.code()); Index: clang-tools-extra/clangd/unittests/CallHierarchyTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/CallHierarchyTests.cpp +++ clang-tools-extra/clangd/unittests/CallHierarchyTests.cpp @@ -56,10 +56,12 @@ MATCHER_P(WithSelectionRange, R, "") { return arg.selectionRange == R; } template <class ItemMatcher> +// NOLINTNEXTLINE(readability-identifier-naming) ::testing::Matcher<CallHierarchyIncomingCall> From(ItemMatcher M) { return Field(&CallHierarchyIncomingCall::from, M); } template <class... RangeMatchers> +// NOLINTNEXTLINE(readability-identifier-naming) ::testing::Matcher<CallHierarchyIncomingCall> FromRanges(RangeMatchers... M) { return Field(&CallHierarchyIncomingCall::fromRanges, UnorderedElementsAre(M...)); Index: clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp +++ clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp @@ -36,6 +36,7 @@ MATCHER(Defined, "") { return !StringRef(arg.Definition.FileURI).empty(); } MATCHER_P(FileURI, F, "") { return StringRef(arg.Location.FileURI) == F; } ::testing::Matcher<const RefSlab &> +// NOLINTNEXTLINE(readability-identifier-naming) RefsAre(std::vector<::testing::Matcher<Ref>> Matchers) { return ElementsAre(::testing::Pair(_, UnorderedElementsAreArray(Matchers))); } @@ -270,7 +271,6 @@ void f_b(); class A_CC {}; )cpp"; - std::string A_CC = ""; FS.Files[testPath("root/A.cc")] = R"cpp( #include "A.h" void g() { (void)common; } @@ -344,8 +344,8 @@ void f_b(); class A_CC {}; )cpp"; - std::string A_CC = "#include \"A.h\"\nvoid g() { (void)common; }"; - FS.Files[testPath("root/A.cc")] = A_CC; + FS.Files[testPath("root/A.cc")] = + "#include \"A.h\"\nvoid g() { (void)common; }"; llvm::StringMap<std::string> Storage; size_t CacheHits = 0; Index: clang-tools-extra/clangd/index/YAMLSerialization.cpp =================================================================== --- clang-tools-extra/clangd/index/YAMLSerialization.cpp +++ clang-tools-extra/clangd/index/YAMLSerialization.cpp @@ -161,19 +161,19 @@ }; template <> struct MappingTraits<SymbolInfo> { - static void mapping(IO &io, SymbolInfo &SymInfo) { + static void mapping(IO &Io, SymbolInfo &SymInfo) { // FIXME: expose other fields? - io.mapRequired("Kind", SymInfo.Kind); - io.mapRequired("Lang", SymInfo.Lang); + Io.mapRequired("Kind", SymInfo.Kind); + Io.mapRequired("Lang", SymInfo.Lang); } }; template <> struct MappingTraits<clang::clangd::Symbol::IncludeHeaderWithReferences> { - static void mapping(IO &io, + static void mapping(IO &Io, clang::clangd::Symbol::IncludeHeaderWithReferences &Inc) { - io.mapRequired("Header", Inc.IncludeHeader); - io.mapRequired("References", Inc.References); + Io.mapRequired("Header", Inc.IncludeHeader); + Io.mapRequired("References", Inc.References); } }; Index: clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp =================================================================== --- clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp +++ clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp @@ -19,12 +19,12 @@ using namespace clang::clangd; -extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { - if (size == 0) +extern "C" int LLVMFuzzerTestOneInput(uint8_t *Data, size_t Size) { + if (Size == 0) return 0; // fmemopen isn't portable, but I think we only run the fuzzer on Linux. - std::FILE *In = fmemopen(data, size, "r"); + std::FILE *In = fmemopen(Data, Size, "r"); auto Transport = newJSONTransport(In, llvm::nulls(), /*InMirror=*/nullptr, /*Pretty=*/false, /*Style=*/JSONStreamStyle::Delimited); Index: clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp =================================================================== --- clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp +++ clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp @@ -73,29 +73,29 @@ return Requests; } -static void MemQueries(benchmark::State &State) { +static void memQueries(benchmark::State &State) { const auto Mem = buildMem(); const auto Requests = extractQueriesFromLogs(); for (auto _ : State) for (const auto &Request : Requests) Mem->fuzzyFind(Request, [](const Symbol &S) {}); } -BENCHMARK(MemQueries); +BENCHMARK(memQueries); -static void DexQueries(benchmark::State &State) { +static void dexQueries(benchmark::State &State) { const auto Dex = buildDex(); const auto Requests = extractQueriesFromLogs(); for (auto _ : State) for (const auto &Request : Requests) Dex->fuzzyFind(Request, [](const Symbol &S) {}); } -BENCHMARK(DexQueries); +BENCHMARK(dexQueries); -static void DexBuild(benchmark::State &State) { +static void dexBuild(benchmark::State &State) { for (auto _ : State) buildDex(); } -BENCHMARK(DexBuild); +BENCHMARK(dexBuild); } // namespace } // namespace clangd Index: clang-tools-extra/clangd/XRefs.cpp =================================================================== --- clang-tools-extra/clangd/XRefs.cpp +++ clang-tools-extra/clangd/XRefs.cpp @@ -1861,7 +1861,7 @@ QualType VisitCXXThrowExpr(const CXXThrowExpr *S) { return S->getSubExpr()->getType(); } - QualType VisitCoyieldStmt(const CoyieldExpr *S) { + QualType visitCoyieldStmt(const CoyieldExpr *S) { return type(S->getOperand()); } // Treat a designated initializer like a reference to the field. Index: clang-tools-extra/clangd/TUScheduler.cpp =================================================================== --- clang-tools-extra/clangd/TUScheduler.cpp +++ clang-tools-extra/clangd/TUScheduler.cpp @@ -100,10 +100,10 @@ class ASTWorker; } // namespace -static clang::clangd::Key<std::string> kFileBeingProcessed; +static clang::clangd::Key<std::string> KFileBeingProcessed; llvm::Optional<llvm::StringRef> TUScheduler::getFileBeingProcessedInContext() { - if (auto *File = Context::current().get(kFileBeingProcessed)) + if (auto *File = Context::current().get(KFileBeingProcessed)) return llvm::StringRef(*File); return None; } @@ -1228,7 +1228,7 @@ } // Allow this request to be cancelled if invalidated. - Context Ctx = Context::current().derive(kFileBeingProcessed, FileName); + Context Ctx = Context::current().derive(KFileBeingProcessed, FileName); Canceler Invalidate = nullptr; if (Invalidation) { WithContext WC(std::move(Ctx)); @@ -1656,7 +1656,7 @@ auto Task = [Worker, Consistency, Name = Name.str(), File = File.str(), Contents = It->second->Contents, Command = Worker->getCurrentCompileCommand(), - Ctx = Context::current().derive(kFileBeingProcessed, + Ctx = Context::current().derive(KFileBeingProcessed, std::string(File)), Action = std::move(Action), this]() mutable { ThreadCrashReporter ScopedReporter([&Name, &Contents, &Command]() { Index: clang-tools-extra/clangd/SourceCode.cpp =================================================================== --- clang-tools-extra/clangd/SourceCode.cpp +++ clang-tools-extra/clangd/SourceCode.cpp @@ -1177,10 +1177,10 @@ return false; auto FID = SM.getFileID(Loc); // All proto generated headers should start with this line. - static const char *PROTO_HEADER_COMMENT = + static const char *ProtoHeaderComment = "// Generated by the protocol buffer compiler. DO NOT EDIT!"; // Double check that this is an actual protobuf header. - return SM.getBufferData(FID).startswith(PROTO_HEADER_COMMENT); + return SM.getBufferData(FID).startswith(ProtoHeaderComment); } namespace { Index: clang-tools-extra/clangd/ClangdLSPServer.cpp =================================================================== --- clang-tools-extra/clangd/ClangdLSPServer.cpp +++ clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -71,8 +71,8 @@ return llvm::None; } -const llvm::StringLiteral APPLY_FIX_COMMAND = "clangd.applyFix"; -const llvm::StringLiteral APPLY_TWEAK_COMMAND = "clangd.applyTweak"; +const llvm::StringLiteral ApplyFixCommand = "clangd.applyFix"; +const llvm::StringLiteral ApplyTweakCommand = "clangd.applyTweak"; /// Transforms a tweak into a code action that would apply it if executed. /// EXPECTS: T.prepare() was called and returned true. @@ -88,7 +88,7 @@ // directly. CA.command.emplace(); CA.command->title = T.Title; - CA.command->command = std::string(APPLY_TWEAK_COMMAND); + CA.command->command = std::string(ApplyTweakCommand); TweakArgs Args; Args.file = File; Args.tweakID = T.ID; @@ -950,7 +950,7 @@ if (Action.command) { Cmd = *Action.command; } else if (Action.edit) { - Cmd.command = std::string(APPLY_FIX_COMMAND); + Cmd.command = std::string(ApplyFixCommand); Cmd.argument = *Action.edit; } else { return None; @@ -1495,8 +1495,8 @@ Bind.method("$/memoryUsage", this, &ClangdLSPServer::onMemoryUsage); if (Opts.FoldingRanges) Bind.method("textDocument/foldingRange", this, &ClangdLSPServer::onFoldingRange); - Bind.command(APPLY_FIX_COMMAND, this, &ClangdLSPServer::onCommandApplyEdit); - Bind.command(APPLY_TWEAK_COMMAND, this, &ClangdLSPServer::onCommandApplyTweak); + Bind.command(ApplyFixCommand, this, &ClangdLSPServer::onCommandApplyEdit); + Bind.command(ApplyTweakCommand, this, &ClangdLSPServer::onCommandApplyTweak); ApplyWorkspaceEdit = Bind.outgoingMethod("workspace/applyEdit"); PublishDiagnostics = Bind.outgoingNotification("textDocument/publishDiagnostics"); Index: .clang-tidy =================================================================== --- .clang-tidy +++ .clang-tidy @@ -6,6 +6,10 @@ value: CamelCase - key: readability-identifier-naming.FunctionCase value: camelBack + # Exclude from scanning as this is an exported symbol used for fuzzing + # throughout the code base. + - key: readability-identifier-naming.FunctionIgnoredRegexp + value: "LLVMFuzzerTestOneInput" - key: readability-identifier-naming.MemberCase value: CamelCase - key: readability-identifier-naming.ParameterCase
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits