diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp --- a/clang-tools-extra/clangd/AST.cpp +++ b/clang-tools-extra/clangd/AST.cpp @@ -377,7 +377,7 @@ // Loc of "auto" in operator auto() if (CurLoc.isInvalid() && dyn_cast(D)) CurLoc = D->getTypeSourceInfo()->getTypeLoc().getBeginLoc(); - // Loc of "auto" in function with traling return type (c++11). + // Loc of "auto" in function with trailing return type (c++11). if (CurLoc.isInvalid()) CurLoc = D->getSourceRange().getBegin(); if (CurLoc != SearchedLocation) diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp --- a/clang-tools-extra/clangd/ClangdServer.cpp +++ b/clang-tools-extra/clangd/ClangdServer.cpp @@ -466,7 +466,7 @@ void ClangdServer::switchSourceHeader( PathRef Path, Callback> CB) { - // We want to return the result as fast as possible, stragety is: + // We want to return the result as fast as possible, strategy is: // 1) use the file-only heuristic, it requires some IO but it is much // faster than building AST, but it only works when .h/.cc files are in // the same directory. diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -395,7 +395,7 @@ std::string ReturnType; }; - // If all BundledEntrys have the same value for a property, return it. + // If all BundledEntries have the same value for a property, return it. template const std::string *onlyValue() const { auto B = Bundled.begin(), E = Bundled.end(); @@ -499,7 +499,7 @@ llvm_unreachable("unknown CodeCompletionResult kind"); } -// Scopes of the paritial identifier we're trying to complete. +// Scopes of the partial identifier we're trying to complete. // It is used when we query the index for more completion results. struct SpecifiedScope { // The scopes we should look in, determined by Sema. @@ -874,7 +874,7 @@ // Function Template. // - High score is better. // - Shorter signature is better. - // - Alphebatically smaller is better. + // - Alphabetically smaller is better. if (L.Quality.NumberOfParameters != R.Quality.NumberOfParameters) return L.Quality.NumberOfParameters < R.Quality.NumberOfParameters; if (L.Quality.NumberOfOptionalParameters != @@ -1510,7 +1510,7 @@ } // Merges Sema and Index results where possible, to form CompletionCandidates. - // \p Identifiers is raw idenfiers that can also be completion condidates. + // \p Identifiers is raw idenfiers that can also be completion candidates. // Identifiers are not merged with results from index or sema. // Groups overloads if desired, to form CompletionCandidate::Bundles. The // bundles are scored and top results are returned, best to worst. diff --git a/clang-tools-extra/clangd/Diagnostics.h b/clang-tools-extra/clangd/Diagnostics.h --- a/clang-tools-extra/clangd/Diagnostics.h +++ b/clang-tools-extra/clangd/Diagnostics.h @@ -53,7 +53,7 @@ struct DiagBase { std::string Message; // Intended to be used only in error messages. - // May be relative, absolute or even artifically constructed. + // May be relative, absolute or even artificially constructed. std::string File; // Absolute path to containing file, if available. llvm::Optional AbsFile; diff --git a/clang-tools-extra/clangd/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp --- a/clang-tools-extra/clangd/Diagnostics.cpp +++ b/clang-tools-extra/clangd/Diagnostics.cpp @@ -232,7 +232,7 @@ } /// Returns a message sent to LSP for the main diagnostic in \p D. -/// This message may include notes, if they're not emited in some other way. +/// This message may include notes, if they're not emitted in some other way. /// Example output: /// /// no matching function for call to 'foo' diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp --- a/clang-tools-extra/clangd/FindTarget.cpp +++ b/clang-tools-extra/clangd/FindTarget.cpp @@ -649,10 +649,10 @@ return {*V.Ref}; } -class ExplicitReferenceColletor - : public RecursiveASTVisitor { +class ExplicitReferenceCollector + : public RecursiveASTVisitor { public: - ExplicitReferenceColletor(llvm::function_ref Out) + ExplicitReferenceCollector(llvm::function_ref Out) : Out(Out) { assert(Out); } @@ -798,16 +798,16 @@ void findExplicitReferences(const Stmt *S, llvm::function_ref Out) { assert(S); - ExplicitReferenceColletor(Out).TraverseStmt(const_cast(S)); + ExplicitReferenceCollector(Out).TraverseStmt(const_cast(S)); } void findExplicitReferences(const Decl *D, llvm::function_ref Out) { assert(D); - ExplicitReferenceColletor(Out).TraverseDecl(const_cast(D)); + ExplicitReferenceCollector(Out).TraverseDecl(const_cast(D)); } void findExplicitReferences(const ASTContext &AST, llvm::function_ref Out) { - ExplicitReferenceColletor(Out).TraverseAST(const_cast(AST)); + ExplicitReferenceCollector(Out).TraverseAST(const_cast(AST)); } llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, DeclRelation R) { diff --git a/clang-tools-extra/clangd/FormattedString.cpp b/clang-tools-extra/clangd/FormattedString.cpp --- a/clang-tools-extra/clangd/FormattedString.cpp +++ b/clang-tools-extra/clangd/FormattedString.cpp @@ -28,7 +28,7 @@ /// Escape a markdown text block. Ensures the punctuation will not introduce /// any of the markdown constructs. std::string renderText(llvm::StringRef Input) { - // Escaping ASCII punctiation ensures we can't start a markdown construct. + // Escaping ASCII punctuation ensures we can't start a markdown construct. constexpr llvm::StringLiteral Punctuation = R"txt(!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~)txt"; @@ -93,7 +93,7 @@ return std::string(/*Repeat=*/std::max(3u, MaxBackticks + 1), '`'); } -// Trims the input and concatanates whitespace blocks into a single ` `. +// Trims the input and concatenates whitespace blocks into a single ` `. std::string canonicalizeSpaces(std::string Input) { // Goes over the string and preserves only a single ` ` for any whitespace // chunks, the rest is moved to the end of the string and dropped in the end. @@ -102,7 +102,7 @@ llvm::SplitString(Input, Words); if (Words.empty()) return ""; - // Go over each word and and add it to the string. + // Go over each word and add it to the string. for (llvm::StringRef Word : Words) { llvm::for_each(Word, [&WritePtr](const char C) { *WritePtr++ = C; }); // Separate from next block. diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/clangd/TUScheduler.cpp @@ -480,7 +480,7 @@ { std::lock_guard Lock(PublishMu); - // No need to rebuild the AST if we won't send the diagnotics. However, + // No need to rebuild the AST if we won't send the diagnostics. However, // note that we don't prevent preamble rebuilds. if (!CanPublishResults) return; diff --git a/clang-tools-extra/clangd/Transport.h b/clang-tools-extra/clangd/Transport.h --- a/clang-tools-extra/clangd/Transport.h +++ b/clang-tools-extra/clangd/Transport.h @@ -55,7 +55,7 @@ }; // Called by Clangd to receive messages from the client. // The transport should in turn invoke the handler to process messages. - // If handler returns false, the transport should immedately exit the loop. + // If handler returns false, the transport should immediately exit the loop. // (This is used to implement the `exit` notification). // Otherwise, it returns an error when the transport becomes unusable. virtual llvm::Error loop(MessageHandler &) = 0; diff --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp --- a/clang-tools-extra/clangd/XRefs.cpp +++ b/clang-tools-extra/clangd/XRefs.cpp @@ -120,7 +120,7 @@ const SymbolLocation &IdxLoc, std::string &Scratch) { // Also use a dummy symbol for the index location so that other fields (e.g. - // definition) are not factored into the preferrence. + // definition) are not factored into the preference. Symbol ASTSym, IdxSym; ASTSym.ID = IdxSym.ID = SymbolID("dummy_id"); ASTSym.CanonicalDeclaration = toIndexLocation(ASTLoc, Scratch); @@ -353,10 +353,10 @@ } bool - handleDeclOccurence(const Decl *D, index::SymbolRoleSet Roles, - llvm::ArrayRef Relations, - SourceLocation Loc, - index::IndexDataConsumer::ASTNodeInfo ASTNode) override { + handleDeclOccurrence(const Decl *D, index::SymbolRoleSet Roles, + llvm::ArrayRef Relations, + SourceLocation Loc, + index::IndexDataConsumer::ASTNodeInfo ASTNode) override { assert(D->isCanonicalDecl() && "expect D to be a canonical declaration"); const SourceManager &SM = AST.getSourceManager(); Loc = SM.getFileLoc(Loc); diff --git a/clang-tools-extra/clangd/index/FileIndex.h b/clang-tools-extra/clangd/index/FileIndex.h --- a/clang-tools-extra/clangd/index/FileIndex.h +++ b/clang-tools-extra/clangd/index/FileIndex.h @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // // FileIndex implements SymbolIndex for symbols from a set of files. Symbols are -// maintained at source-file granuality (e.g. with ASTs), and files can be +// maintained at source-file granularity (e.g. with ASTs), and files can be // updated dynamically. // //===----------------------------------------------------------------------===// diff --git a/clang-tools-extra/clangd/index/SymbolCollector.h b/clang-tools-extra/clangd/index/SymbolCollector.h --- a/clang-tools-extra/clangd/index/SymbolCollector.h +++ b/clang-tools-extra/clangd/index/SymbolCollector.h @@ -99,14 +99,14 @@ } bool - handleDeclOccurence(const Decl *D, index::SymbolRoleSet Roles, - ArrayRef Relations, - SourceLocation Loc, - index::IndexDataConsumer::ASTNodeInfo ASTNode) override; - - bool handleMacroOccurence(const IdentifierInfo *Name, const MacroInfo *MI, - index::SymbolRoleSet Roles, - SourceLocation Loc) override; + handleDeclOccurrence(const Decl *D, index::SymbolRoleSet Roles, + ArrayRef Relations, + SourceLocation Loc, + index::IndexDataConsumer::ASTNodeInfo ASTNode) override; + + bool handleMacroOccurrence(const IdentifierInfo *Name, const MacroInfo *MI, + index::SymbolRoleSet Roles, + SourceLocation Loc) override; SymbolSlab takeSymbols() { return std::move(Symbols).build(); } RefSlab takeRefs() { return std::move(Refs).build(); } diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -245,14 +245,14 @@ } // Always return true to continue indexing. -bool SymbolCollector::handleDeclOccurence( +bool SymbolCollector::handleDeclOccurrence( const Decl *D, index::SymbolRoleSet Roles, llvm::ArrayRef Relations, SourceLocation Loc, index::IndexDataConsumer::ASTNodeInfo ASTNode) { assert(ASTCtx && PP.get() && "ASTContext and Preprocessor must be set."); assert(CompletionAllocator && CompletionTUInfo); assert(ASTNode.OrigD); - // Indexing API puts cannonical decl into D, which might not have a valid + // Indexing API puts canonical decl into D, which might not have a valid // source location for implicit/built-in decls. Fallback to original decl in // such cases. if (D->getLocation().isInvalid()) @@ -346,10 +346,10 @@ return true; } -bool SymbolCollector::handleMacroOccurence(const IdentifierInfo *Name, - const MacroInfo *MI, - index::SymbolRoleSet Roles, - SourceLocation Loc) { +bool SymbolCollector::handleMacroOccurrence(const IdentifierInfo *Name, + const MacroInfo *MI, + index::SymbolRoleSet Roles, + SourceLocation Loc) { assert(PP.get()); const auto &SM = PP->getSourceManager(); @@ -524,9 +524,8 @@ auto FileURI = toURI(SM, FileEntry->getName(), Opts); Found = URICache.insert({FID, FileURI}).first; } else { - // Ignore cases where we can not find a corresponding file entry - // for the loc, thoses are not interesting, e.g. symbols formed - // via macro concatenation. + // Ignore cases where we can not find a corresponding file entry for + // given location, e.g. symbols formed via macro concatenation. return None; } } diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp --- a/clang-tools-extra/clangd/refactor/Rename.cpp +++ b/clang-tools-extra/clangd/refactor/Rename.cpp @@ -364,7 +364,7 @@ std::move(FileAndOccurrences.second), RenameDecl.getASTContext().getLangOpts()); if (!RenameRanges) { - // Our heuristice fails to adjust rename ranges to the current state of + // Our heuristics fails to adjust rename ranges to the current state of // the file, it is most likely the index is stale, so we give up the // entire rename. return llvm::make_error( @@ -387,7 +387,7 @@ return Results; } -// A simple edit is eithor changing line or column, but not both. +// A simple edit is either changing line or column, but not both. bool impliesSimpleEdit(const Position &LHS, const Position &RHS) { return LHS.line == RHS.line || LHS.character == RHS.character; } diff --git a/clang/include/clang/Index/IndexDataConsumer.h b/clang/include/clang/Index/IndexDataConsumer.h --- a/clang/include/clang/Index/IndexDataConsumer.h +++ b/clang/include/clang/Index/IndexDataConsumer.h @@ -39,16 +39,16 @@ virtual void setPreprocessor(std::shared_ptr PP) {} /// \returns true to continue indexing, or false to abort. - virtual bool handleDeclOccurence(const Decl *D, SymbolRoleSet Roles, - ArrayRef Relations, - SourceLocation Loc, ASTNodeInfo ASTNode) { + virtual bool handleDeclOccurrence(const Decl *D, SymbolRoleSet Roles, + ArrayRef Relations, + SourceLocation Loc, ASTNodeInfo ASTNode) { return true; } /// \returns true to continue indexing, or false to abort. - virtual bool handleMacroOccurence(const IdentifierInfo *Name, - const MacroInfo *MI, SymbolRoleSet Roles, - SourceLocation Loc) { + virtual bool handleMacroOccurrence(const IdentifierInfo *Name, + const MacroInfo *MI, SymbolRoleSet Roles, + SourceLocation Loc) { return true; } @@ -57,9 +57,9 @@ /// This will be called for each module reference in an import decl. /// For "@import MyMod.SubMod", there will be a call for 'MyMod' with the /// 'reference' role, and a call for 'SubMod' with the 'declaration' role. - virtual bool handleModuleOccurence(const ImportDecl *ImportD, - const Module *Mod, SymbolRoleSet Roles, - SourceLocation Loc) { + virtual bool handleModuleOccurrence(const ImportDecl *ImportD, + const Module *Mod, SymbolRoleSet Roles, + SourceLocation Loc) { return true; } diff --git a/clang/lib/Index/IndexingAction.cpp b/clang/lib/Index/IndexingAction.cpp --- a/clang/lib/Index/IndexingAction.cpp +++ b/clang/lib/Index/IndexingAction.cpp @@ -151,7 +151,7 @@ IndexDataConsumer &DataConsumer) { for (const auto &M : PP.macros()) if (MacroDirective *MD = M.second.getLatest()) - DataConsumer.handleMacroOccurence( + DataConsumer.handleMacroOccurrence( M.first, MD->getMacroInfo(), static_cast(index::SymbolRole::Definition), MD->getLocation()); diff --git a/clang/lib/Index/IndexingContext.cpp b/clang/lib/Index/IndexingContext.cpp --- a/clang/lib/Index/IndexingContext.cpp +++ b/clang/lib/Index/IndexingContext.cpp @@ -99,9 +99,8 @@ return; reportModuleReferences(Mod->Parent, IdLocs.drop_back(), ImportD, DataConsumer); - DataConsumer.handleModuleOccurence(ImportD, Mod, - (SymbolRoleSet)SymbolRole::Reference, - IdLocs.back()); + DataConsumer.handleModuleOccurrence( + ImportD, Mod, (SymbolRoleSet)SymbolRole::Reference, IdLocs.back()); } bool IndexingContext::importedModule(const ImportDecl *ImportD) { @@ -145,7 +144,7 @@ if (ImportD->isImplicit()) Roles |= (unsigned)SymbolRole::Implicit; - return DataConsumer.handleModuleOccurence(ImportD, Mod, Roles, Loc); + return DataConsumer.handleModuleOccurrence(ImportD, Mod, Roles, Loc); } bool IndexingContext::isTemplateImplicitInstantiation(const Decl *D) { @@ -443,26 +442,26 @@ } IndexDataConsumer::ASTNodeInfo Node{OrigE, OrigD, Parent, ContainerDC}; - return DataConsumer.handleDeclOccurence(D, Roles, FinalRelations, Loc, Node); + return DataConsumer.handleDeclOccurrence(D, Roles, FinalRelations, Loc, Node); } void IndexingContext::handleMacroDefined(const IdentifierInfo &Name, SourceLocation Loc, const MacroInfo &MI) { SymbolRoleSet Roles = (unsigned)SymbolRole::Definition; - DataConsumer.handleMacroOccurence(&Name, &MI, Roles, Loc); + DataConsumer.handleMacroOccurrence(&Name, &MI, Roles, Loc); } void IndexingContext::handleMacroUndefined(const IdentifierInfo &Name, SourceLocation Loc, const MacroInfo &MI) { SymbolRoleSet Roles = (unsigned)SymbolRole::Undefinition; - DataConsumer.handleMacroOccurence(&Name, &MI, Roles, Loc); + DataConsumer.handleMacroOccurrence(&Name, &MI, Roles, Loc); } void IndexingContext::handleMacroReference(const IdentifierInfo &Name, SourceLocation Loc, const MacroInfo &MI) { SymbolRoleSet Roles = (unsigned)SymbolRole::Reference; - DataConsumer.handleMacroOccurence(&Name, &MI, Roles, Loc); + DataConsumer.handleMacroOccurrence(&Name, &MI, Roles, Loc); } diff --git a/clang/tools/c-index-test/core_main.cpp b/clang/tools/c-index-test/core_main.cpp --- a/clang/tools/c-index-test/core_main.cpp +++ b/clang/tools/c-index-test/core_main.cpp @@ -94,9 +94,9 @@ this->PP = std::move(PP); } - bool handleDeclOccurence(const Decl *D, SymbolRoleSet Roles, - ArrayRef Relations, - SourceLocation Loc, ASTNodeInfo ASTNode) override { + bool handleDeclOccurrence(const Decl *D, SymbolRoleSet Roles, + ArrayRef Relations, + SourceLocation Loc, ASTNodeInfo ASTNode) override { ASTContext &Ctx = D->getASTContext(); SourceManager &SM = Ctx.getSourceManager(); @@ -132,9 +132,9 @@ return true; } - bool handleModuleOccurence(const ImportDecl *ImportD, - const clang::Module *Mod, - SymbolRoleSet Roles, SourceLocation Loc) override { + bool handleModuleOccurrence(const ImportDecl *ImportD, + const clang::Module *Mod, SymbolRoleSet Roles, + SourceLocation Loc) override { ASTContext &Ctx = ImportD->getASTContext(); SourceManager &SM = Ctx.getSourceManager(); @@ -156,8 +156,8 @@ return true; } - bool handleMacroOccurence(const IdentifierInfo *Name, const MacroInfo *MI, - SymbolRoleSet Roles, SourceLocation Loc) override { + bool handleMacroOccurrence(const IdentifierInfo *Name, const MacroInfo *MI, + SymbolRoleSet Roles, SourceLocation Loc) override { assert(PP); SourceManager &SM = PP->getSourceManager(); diff --git a/clang/tools/libclang/CXIndexDataConsumer.h b/clang/tools/libclang/CXIndexDataConsumer.h --- a/clang/tools/libclang/CXIndexDataConsumer.h +++ b/clang/tools/libclang/CXIndexDataConsumer.h @@ -431,13 +431,13 @@ static bool isTemplateImplicitInstantiation(const Decl *D); private: - bool handleDeclOccurence(const Decl *D, index::SymbolRoleSet Roles, - ArrayRef Relations, - SourceLocation Loc, ASTNodeInfo ASTNode) override; + bool handleDeclOccurrence(const Decl *D, index::SymbolRoleSet Roles, + ArrayRef Relations, + SourceLocation Loc, ASTNodeInfo ASTNode) override; - bool handleModuleOccurence(const ImportDecl *ImportD, const Module *Mod, - index::SymbolRoleSet Roles, - SourceLocation Loc) override; + bool handleModuleOccurrence(const ImportDecl *ImportD, const Module *Mod, + index::SymbolRoleSet Roles, + SourceLocation Loc) override; void finish() override; diff --git a/clang/tools/libclang/CXIndexDataConsumer.cpp b/clang/tools/libclang/CXIndexDataConsumer.cpp --- a/clang/tools/libclang/CXIndexDataConsumer.cpp +++ b/clang/tools/libclang/CXIndexDataConsumer.cpp @@ -154,7 +154,7 @@ } } -bool CXIndexDataConsumer::handleDeclOccurence( +bool CXIndexDataConsumer::handleDeclOccurrence( const Decl *D, SymbolRoleSet Roles, ArrayRef Relations, SourceLocation Loc, ASTNodeInfo ASTNode) { Loc = getASTContext().getSourceManager().getFileLoc(Loc); @@ -220,10 +220,10 @@ return !shouldAbort(); } -bool CXIndexDataConsumer::handleModuleOccurence(const ImportDecl *ImportD, - const Module *Mod, - SymbolRoleSet Roles, - SourceLocation Loc) { +bool CXIndexDataConsumer::handleModuleOccurrence(const ImportDecl *ImportD, + const Module *Mod, + SymbolRoleSet Roles, + SourceLocation Loc) { if (Roles & (SymbolRoleSet)SymbolRole::Declaration) IndexingDeclVisitor(*this, SourceLocation(), nullptr).Visit(ImportD); return !shouldAbort(); diff --git a/clang/unittests/Index/IndexTests.cpp b/clang/unittests/Index/IndexTests.cpp --- a/clang/unittests/Index/IndexTests.cpp +++ b/clang/unittests/Index/IndexTests.cpp @@ -74,9 +74,9 @@ IndexDataConsumer::initialize(Ctx); } - bool handleDeclOccurence(const Decl *D, SymbolRoleSet Roles, - ArrayRef, SourceLocation Loc, - ASTNodeInfo) override { + bool handleDeclOccurrence(const Decl *D, SymbolRoleSet Roles, + ArrayRef, SourceLocation Loc, + ASTNodeInfo) override { const auto *ND = llvm::dyn_cast(D); if (!ND) return true; @@ -91,8 +91,8 @@ return true; } - bool handleMacroOccurence(const IdentifierInfo *Name, const MacroInfo *MI, - SymbolRoleSet Roles, SourceLocation Loc) override { + bool handleMacroOccurrence(const IdentifierInfo *Name, const MacroInfo *MI, + SymbolRoleSet Roles, SourceLocation Loc) override { TestSymbol S; S.SymInfo = getSymbolInfoForMacro(*MI); S.QName = Name->getName();