NFC: Fix trivial typos in comments

This commit is contained in:
Kazuaki Ishizaki 2020-01-04 10:28:41 -05:00 committed by Aaron Ballman
parent ca8b20ca3b
commit b7ecf1c1c3
68 changed files with 80 additions and 80 deletions

View File

@ -207,7 +207,7 @@ bool mergeAndDeduplicate(const TUReplacements &TUs, const TUDiagnostics &TUDs,
// FIXME: This will report conflicts by pair using a file+offset format // FIXME: This will report conflicts by pair using a file+offset format
// which is not so much human readable. // which is not so much human readable.
// A first improvement could be to translate offset to line+col. For // A first improvement could be to translate offset to line+col. For
// this and without loosing error message some modifications arround // this and without loosing error message some modifications around
// `tooling::ReplacementError` are need (access to // `tooling::ReplacementError` are need (access to
// `getReplacementErrString`). // `getReplacementErrString`).
// A better strategy could be to add a pretty printer methods for // A better strategy could be to add a pretty printer methods for

View File

@ -61,7 +61,7 @@ private:
// or block to be read. // or block to be read.
Cursor skipUntilRecordOrBlock(unsigned &BlockOrRecordID); Cursor skipUntilRecordOrBlock(unsigned &BlockOrRecordID);
// Helper function to set up the approriate type of Info. // Helper function to set up the appropriate type of Info.
llvm::Expected<std::unique_ptr<Info>> readBlockToInfo(unsigned ID); llvm::Expected<std::unique_ptr<Info>> readBlockToInfo(unsigned ID);
llvm::BitstreamCursor &Stream; llvm::BitstreamCursor &Stream;

View File

@ -135,7 +135,7 @@ struct Reference {
bool mergeable(const Reference &Other); bool mergeable(const Reference &Other);
void merge(Reference &&I); void merge(Reference &&I);
SymbolID USR = SymbolID(); // Unique identifer for referenced decl SymbolID USR = SymbolID(); // Unique identifier for referenced decl
SmallString<16> Name; // Name of type (possibly unresolved). SmallString<16> Name; // Name of type (possibly unresolved).
InfoType RefType = InfoType::IT_default; // Indicates the type of this InfoType RefType = InfoType::IT_default; // Indicates the type of this
// Reference (namespace, record, // Reference (namespace, record,

View File

@ -32,7 +32,7 @@ populateParentNamespaces(llvm::SmallVector<Reference, 4> &Namespaces,
// A function to extract the appropriate relative path for a given info's // A function to extract the appropriate relative path for a given info's
// documentation. The path returned is a composite of the parent namespaces. // documentation. The path returned is a composite of the parent namespaces.
// //
// Example: Given the below, the diretory path for class C info will be // Example: Given the below, the directory path for class C info will be
// <root>/A/B // <root>/A/B
// //
// namespace A { // namespace A {

View File

@ -6,7 +6,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// This tool for generating C and C++ documenation from source code // This tool for generating C and C++ documentation from source code
// and comments. Generally, it runs a LibTooling FrontendAction on source files, // and comments. Generally, it runs a LibTooling FrontendAction on source files,
// mapping each declaration in those files to its USR and serializing relevant // mapping each declaration in those files to its USR and serializing relevant
// information into LLVM bitcode. It then runs a pass over the collected // information into LLVM bitcode. It then runs a pass over the collected

View File

@ -26,7 +26,7 @@ std::string createQualifiedNameForReplacement(
llvm::StringRef RawSymbolName, llvm::StringRef RawSymbolName,
llvm::StringRef SymbolScopedQualifiersName, llvm::StringRef SymbolScopedQualifiersName,
const find_all_symbols::SymbolInfo &MatchedSymbol) { const find_all_symbols::SymbolInfo &MatchedSymbol) {
// No need to add missing qualifiers if SymbolIndentifer has a global scope // No need to add missing qualifiers if SymbolIdentifier has a global scope
// operator "::". // operator "::".
if (RawSymbolName.startswith("::")) if (RawSymbolName.startswith("::"))
return RawSymbolName; return RawSymbolName;

View File

@ -110,7 +110,7 @@ buffer as only argument."
nil) nil)
(defun clang-include-fixer--make-process (callback args) (defun clang-include-fixer--make-process (callback args)
"Start a new clang-incude-fixer process using `make-process'. "Start a new clang-include-fixer process using `make-process'.
CALLBACK is called after the process finishes successfully; it is CALLBACK is called after the process finishes successfully; it is
called with a single argument, the buffer where standard output called with a single argument, the buffer where standard output
has been inserted. ARGS is a list of additional command line has been inserted. ARGS is a list of additional command line
@ -129,7 +129,7 @@ arguments. Return the new process object."
:stderr stderr))) :stderr stderr)))
(defun clang-include-fixer--start-process (callback args) (defun clang-include-fixer--start-process (callback args)
"Start a new clang-incude-fixer process using `start-file-process'. "Start a new clang-include-fixer process using `start-file-process'.
CALLBACK is called after the process finishes successfully; it is CALLBACK is called after the process finishes successfully; it is
called with a single argument, the buffer where standard output called with a single argument, the buffer where standard output
has been inserted. ARGS is a list of additional command line has been inserted. ARGS is a list of additional command line

View File

@ -1,4 +1,4 @@
//===-- ClangMove.cpp - move defintion to new file --------------*- C++ -*-===// //===-- ClangMove.cpp - move definition to new file -------------*- C++ -*-===//
// //
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information. // See https://llvm.org/LICENSE.txt for license information.

View File

@ -65,7 +65,7 @@ void FasterStrsplitDelimiterCheck::registerMatchers(MatchFinder *Finder) {
expr(ignoringParenCasts(stringLiteral(lengthIsOne()).bind("Literal"))); expr(ignoringParenCasts(stringLiteral(lengthIsOne()).bind("Literal")));
// Binds to a string_view (either absl or std) that was passed by value and // Binds to a string_view (either absl or std) that was passed by value and
// contructed from string literal. // constructed from string literal.
auto StringViewArg = ignoringElidableConstructorCall(ignoringImpCasts( auto StringViewArg = ignoringElidableConstructorCall(ignoringImpCasts(
cxxConstructExpr(hasType(recordDecl(hasName("::absl::string_view"))), cxxConstructExpr(hasType(recordDecl(hasName("::absl::string_view"))),
hasArgument(0, ignoringParenImpCasts(SingleChar))))); hasArgument(0, ignoringParenImpCasts(SingleChar)))));

View File

@ -168,7 +168,7 @@ void TimeSubtractionCheck::check(const MatchFinder::MatchResult &Result) {
!InsideMacroDefinition(Result, MaybeCallArg->getSourceRange())) { !InsideMacroDefinition(Result, MaybeCallArg->getSourceRange())) {
// Handle the case where the matched expression is inside a call which // Handle the case where the matched expression is inside a call which
// converts it from the inverse to a Duration. In this case, we replace // converts it from the inverse to a Duration. In this case, we replace
// the outer with just the subtraction expresison, which gives the right // the outer with just the subtraction expression, which gives the right
// type and scale, taking care again about parenthesis. // type and scale, taking care again about parenthesis.
bool NeedParens = parensRequired(Result, MaybeCallArg); bool NeedParens = parensRequired(Result, MaybeCallArg);

View File

@ -63,7 +63,7 @@ void ForwardDeclarationNamespaceCheck::check(
const auto *Decl = Result.Nodes.getNodeAs<FriendDecl>("friend_decl"); const auto *Decl = Result.Nodes.getNodeAs<FriendDecl>("friend_decl");
assert(Decl && "Decl is neither record_decl nor friend decl!"); assert(Decl && "Decl is neither record_decl nor friend decl!");
// Classes used in friend delarations are not marked referenced in AST, // Classes used in friend declarations are not marked referenced in AST,
// so we need to check classes used in friend declarations manually to // so we need to check classes used in friend declarations manually to
// reduce the rate of false positive. // reduce the rate of false positive.
// For example, in // For example, in

View File

@ -27,7 +27,7 @@ AST_MATCHER(StringLiteral, containsNul) {
void StringLiteralWithEmbeddedNulCheck::registerMatchers(MatchFinder *Finder) { void StringLiteralWithEmbeddedNulCheck::registerMatchers(MatchFinder *Finder) {
// Match a string that contains embedded NUL character. Extra-checks are // Match a string that contains embedded NUL character. Extra-checks are
// applied in |check| to find incorectly escaped characters. // applied in |check| to find incorrectly escaped characters.
Finder->addMatcher(stringLiteral(containsNul()).bind("strlit"), this); Finder->addMatcher(stringLiteral(containsNul()).bind("strlit"), this);
// The remaining checks only apply to C++. // The remaining checks only apply to C++.

View File

@ -31,7 +31,7 @@ AST_MATCHER(CXXRecordDecl, hasDefaultConstructor) {
} }
// Iterate over all the fields in a record type, both direct and indirect (e.g. // Iterate over all the fields in a record type, both direct and indirect (e.g.
// if the record contains an anonmyous struct). // if the record contains an anonymous struct).
template <typename T, typename Func> template <typename T, typename Func>
void forEachField(const RecordDecl &Record, const T &Fields, Func &&Fn) { void forEachField(const RecordDecl &Record, const T &Fields, Func &&Fn) {
for (const FieldDecl *F : Fields) { for (const FieldDecl *F : Fields) {
@ -424,7 +424,7 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
} }
// Collect all fields in order, both direct fields and indirect fields from // Collect all fields in order, both direct fields and indirect fields from
// anonmyous record types. // anonymous record types.
SmallVector<const FieldDecl *, 16> OrderedFields; SmallVector<const FieldDecl *, 16> OrderedFields;
forEachField(ClassDecl, ClassDecl.fields(), forEachField(ClassDecl, ClassDecl.fields(),
[&](const FieldDecl *F) { OrderedFields.push_back(F); }); [&](const FieldDecl *F) { OrderedFields.push_back(F); });

View File

@ -45,7 +45,7 @@ void SlicingCheck::registerMatchers(MatchFinder *Finder) {
const auto IsWithinDerivedCtor = const auto IsWithinDerivedCtor =
hasParent(cxxConstructorDecl(ofClass(equalsBoundNode("DerivedDecl")))); hasParent(cxxConstructorDecl(ofClass(equalsBoundNode("DerivedDecl"))));
// Assignement slicing: "a = b;" and "a = std::move(b);" variants. // Assignment slicing: "a = b;" and "a = std::move(b);" variants.
const auto SlicesObjectInAssignment = const auto SlicesObjectInAssignment =
callExpr(callee(cxxMethodDecl(anyOf(isCopyAssignmentOperator(), callExpr(callee(cxxMethodDecl(anyOf(isCopyAssignmentOperator(),
isMoveAssignmentOperator()), isMoveAssignmentOperator()),

View File

@ -61,7 +61,7 @@ void GlobalNamesInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
if (const auto *UsingDirective = dyn_cast<UsingDirectiveDecl>(D)) { if (const auto *UsingDirective = dyn_cast<UsingDirectiveDecl>(D)) {
if (UsingDirective->getNominatedNamespace()->isAnonymousNamespace()) { if (UsingDirective->getNominatedNamespace()->isAnonymousNamespace()) {
// Anynoumous namespaces inject a using directive into the AST to import // Anonymous namespaces inject a using directive into the AST to import
// the names into the containing namespace. // the names into the containing namespace.
// We should not have them in headers, but there is another warning for // We should not have them in headers, but there is another warning for
// that. // that.

View File

@ -24,7 +24,7 @@ namespace runtime {
/// Finds uses of `short`, `long` and `long long` and suggest replacing them /// Finds uses of `short`, `long` and `long long` and suggest replacing them
/// with `u?intXX(_t)?`. /// with `u?intXX(_t)?`.
/// ///
/// Correspondig cpplint.py check: 'runtime/int'. /// Corresponding cpplint.py check: 'runtime/int'.
class IntegerTypesCheck : public ClangTidyCheck { class IntegerTypesCheck : public ClangTidyCheck {
public: public:
IntegerTypesCheck(StringRef Name, ClangTidyContext *Context); IntegerTypesCheck(StringRef Name, ClangTidyContext *Context);

View File

@ -43,7 +43,7 @@ namespace tidy {
namespace modernize { namespace modernize {
void AvoidCArraysCheck::registerMatchers(MatchFinder *Finder) { void AvoidCArraysCheck::registerMatchers(MatchFinder *Finder) {
// std::array<> is avaliable since C++11. // std::array<> is available since C++11.
if (!getLangOpts().CPlusPlus11) if (!getLangOpts().CPlusPlus11)
return; return;

View File

@ -376,7 +376,7 @@ bool MakeSmartPtrCheck::replaceNew(DiagnosticBuilder &Diag,
// struct S { S(std::initializer_list<int>); }; // struct S { S(std::initializer_list<int>); };
// struct S2 { S2(S, int); }; // struct S2 { S2(S, int); };
// smart_ptr<S>(new S{1, 2, 3}); // C++11 direct list-initialization // smart_ptr<S>(new S{1, 2, 3}); // C++11 direct list-initialization
// smart_ptr<S>(new S{}); // use initializer-list consturctor // smart_ptr<S>(new S{}); // use initializer-list constructor
// smart_ptr<S2>()new S2{ {1,2}, 3 }; // have a list-initialized arg // smart_ptr<S2>()new S2{ {1,2}, 3 }; // have a list-initialized arg
// The above cases have to be replaced with: // The above cases have to be replaced with:
// std::make_smart_ptr<S>(std::initializer_list<int>({1, 2, 3})); // std::make_smart_ptr<S>(std::initializer_list<int>({1, 2, 3}));

View File

@ -359,7 +359,7 @@ void UseAutoCheck::replaceIterators(const DeclStmt *D, ASTContext *Context) {
} }
if (const auto *NestedConstruct = dyn_cast<CXXConstructExpr>(E)) { if (const auto *NestedConstruct = dyn_cast<CXXConstructExpr>(E)) {
// If we ran into an implicit conversion contructor, can't convert. // If we ran into an implicit conversion constructor, can't convert.
// //
// FIXME: The following only checks if the constructor can be used // FIXME: The following only checks if the constructor can be used
// implicitly, not if it actually was. Cases where the converting // implicitly, not if it actually was. Cases where the converting

View File

@ -33,7 +33,7 @@ AST_MATCHER(Type, sugaredNullptrType) {
/// Create a matcher that finds implicit casts as well as the head of a /// Create a matcher that finds implicit casts as well as the head of a
/// sequence of zero or more nested explicit casts that have an implicit cast /// sequence of zero or more nested explicit casts that have an implicit cast
/// to null within. /// to null within.
/// Finding sequences of explict casts is necessary so that an entire sequence /// Finding sequences of explicit casts is necessary so that an entire sequence
/// can be replaced instead of just the inner-most implicit cast. /// can be replaced instead of just the inner-most implicit cast.
StatementMatcher makeCastSequenceMatcher() { StatementMatcher makeCastSequenceMatcher() {
StatementMatcher ImplicitCastToNull = implicitCastExpr( StatementMatcher ImplicitCastToNull = implicitCastExpr(

View File

@ -19,7 +19,7 @@ namespace performance {
/// ///
/// Associative containers implements some of the algorithms as methods which /// Associative containers implements some of the algorithms as methods which
/// should be preferred to the algorithms in the algorithm header. The methods /// should be preferred to the algorithms in the algorithm header. The methods
/// can take advanatage of the order of the elements. /// can take advantage of the order of the elements.
class InefficientAlgorithmCheck : public ClangTidyCheck { class InefficientAlgorithmCheck : public ClangTidyCheck {
public: public:
InefficientAlgorithmCheck(StringRef Name, ClangTidyContext *Context) InefficientAlgorithmCheck(StringRef Name, ClangTidyContext *Context)

View File

@ -165,7 +165,7 @@ void InefficientVectorOperationCheck::registerMatchers(MatchFinder *Finder) {
// A method's name starts with "add_" might not mean it's an add field // A method's name starts with "add_" might not mean it's an add field
// call; it could be the getter for a proto field of which the name starts // call; it could be the getter for a proto field of which the name starts
// with "add_". So we exlude const methods. // with "add_". So we exclude const methods.
const auto AddFieldMethodDecl = const auto AddFieldMethodDecl =
cxxMethodDecl(matchesName("::add_"), unless(isConst())); cxxMethodDecl(matchesName("::add_"), unless(isConst()));
AddMatcher(ProtoDecl, ProtoVarDeclName, ProtoVarDeclStmtName, AddMatcher(ProtoDecl, ProtoVarDeclName, ProtoVarDeclStmtName,

View File

@ -84,7 +84,7 @@ public:
}; };
/// Holds an identifier name check failure, tracking the kind of the /// Holds an identifier name check failure, tracking the kind of the
/// identifer, its possible fixup and the starting locations of all the /// identifier, its possible fixup and the starting locations of all the
/// identifier usages. /// identifier usages.
struct NamingCheckFailure { struct NamingCheckFailure {
std::string KindName; std::string KindName;

View File

@ -73,7 +73,7 @@ bool checkIfFixItHintIsApplicable(
if (!ParameterSourceDeclaration->isThisDeclarationADefinition()) if (!ParameterSourceDeclaration->isThisDeclarationADefinition())
return false; return false;
// Assumption: if parameter is not referenced in function defintion body, it // Assumption: if parameter is not referenced in function definition body, it
// may indicate that it's outdated, so don't touch it. // may indicate that it's outdated, so don't touch it.
if (!SourceParam->isReferenced()) if (!SourceParam->isReferenced())
return false; return false;

View File

@ -24,7 +24,7 @@ namespace utils {
class ExceptionAnalyzer { class ExceptionAnalyzer {
public: public:
enum class State : std::int8_t { enum class State : std::int8_t {
Throwing = 0, ///< The function can definitly throw given an AST. Throwing = 0, ///< The function can definitely throw given an AST.
NotThrowing = 1, ///< This function can not throw, given an AST. NotThrowing = 1, ///< This function can not throw, given an AST.
Unknown = 2, ///< This can happen for extern functions without available Unknown = 2, ///< This can happen for extern functions without available
///< definition. ///< definition.

View File

@ -38,7 +38,7 @@ NamespaceAliaser::createAlias(ASTContext &Context, const Stmt &Statement,
return None; return None;
// FIXME: Doesn't consider the order of declarations. // FIXME: Doesn't consider the order of declarations.
// If we accidentially pick an alias defined later in the function, // If we accidentally pick an alias defined later in the function,
// the output won't compile. // the output won't compile.
// FIXME: Also doesn't consider file or class-scope aliases. // FIXME: Also doesn't consider file or class-scope aliases.

View File

@ -79,7 +79,7 @@ llvm::Optional<SymbolID> getSymbolID(const llvm::StringRef MacroName,
const SourceManager &SM); const SourceManager &SM);
/// Returns a QualType as string. The result doesn't contain unwritten scopes /// Returns a QualType as string. The result doesn't contain unwritten scopes
/// like annoymous/inline namespace. /// like anonymous/inline namespace.
std::string printType(const QualType QT, const DeclContext &CurContext); std::string printType(const QualType QT, const DeclContext &CurContext);
/// Indicates if \p D is a template instantiation implicitly generated by the /// Indicates if \p D is a template instantiation implicitly generated by the

View File

@ -212,7 +212,7 @@ private:
bool UseDirBasedCDB; // FIXME: make this a capability. bool UseDirBasedCDB; // FIXME: make this a capability.
llvm::Optional<Path> CompileCommandsDir; // FIXME: merge with capability? llvm::Optional<Path> CompileCommandsDir; // FIXME: merge with capability?
std::unique_ptr<GlobalCompilationDatabase> BaseCDB; std::unique_ptr<GlobalCompilationDatabase> BaseCDB;
// CDB is BaseCDB plus any comands overridden via LSP extensions. // CDB is BaseCDB plus any commands overridden via LSP extensions.
llvm::Optional<OverlayCDB> CDB; llvm::Optional<OverlayCDB> CDB;
ClangdServer::Options ClangdServerOpts; ClangdServer::Options ClangdServerOpts;
llvm::Optional<OffsetEncoding> NegotiatedOffsetEncoding; llvm::Optional<OffsetEncoding> NegotiatedOffsetEncoding;

View File

@ -1510,7 +1510,7 @@ private:
} }
// Merges Sema and Index results where possible, to form CompletionCandidates. // Merges Sema and Index results where possible, to form CompletionCandidates.
// \p Identifiers is raw idenfiers that can also be completion candidates. // \p Identifiers is raw identifiers that can also be completion candidates.
// Identifiers are not merged with results from index or sema. // Identifiers are not merged with results from index or sema.
// Groups overloads if desired, to form CompletionCandidate::Bundles. The // Groups overloads if desired, to form CompletionCandidate::Bundles. The
// bundles are scored and top results are returned, best to worst. // bundles are scored and top results are returned, best to worst.

View File

@ -83,7 +83,7 @@ private:
public: public:
/// Same as Context::empty(), please use Context::empty() instead. /// Same as Context::empty(), please use Context::empty() instead.
/// Constructor is defined to workaround a bug in MSVC's version of STL. /// Constructor is defined to workaround a bug in MSVC's version of STL.
/// (arguments of std::future<> must be default-construcitble in MSVC). /// (arguments of std::future<> must be default-constructible in MSVC).
Context() = default; Context() = default;
/// Copy operations for this class are deleted, use an explicit clone() method /// Copy operations for this class are deleted, use an explicit clone() method

View File

@ -485,7 +485,7 @@ llvm::SmallVector<ReferenceLoc, 2> refInDecl(const Decl *D) {
} }
void VisitUsingDecl(const UsingDecl *D) { void VisitUsingDecl(const UsingDecl *D) {
// "using ns::identifer;" is a non-declaration reference. // "using ns::identifier;" is a non-declaration reference.
Refs.push_back( Refs.push_back(
ReferenceLoc{D->getQualifierLoc(), D->getLocation(), /*IsDecl=*/false, ReferenceLoc{D->getQualifierLoc(), D->getLocation(), /*IsDecl=*/false,
explicitReferenceTargets(DynTypedNode::create(*D), explicitReferenceTargets(DynTypedNode::create(*D),

View File

@ -295,7 +295,7 @@ llvm::Optional<std::string> printExprValue(const Expr *E,
llvm::Optional<std::string> printExprValue(const SelectionTree::Node *N, llvm::Optional<std::string> printExprValue(const SelectionTree::Node *N,
const ASTContext &Ctx) { const ASTContext &Ctx) {
for (; N; N = N->Parent) { for (; N; N = N->Parent) {
// Try to evaluate the first evaluable enclosing expression. // Try to evaluate the first evaluatable enclosing expression.
if (const Expr *E = N->ASTNode.get<Expr>()) { if (const Expr *E = N->ASTNode.get<Expr>()) {
if (auto Val = printExprValue(E, Ctx)) if (auto Val = printExprValue(E, Ctx))
return Val; return Val;

View File

@ -95,7 +95,7 @@ std::vector<Fix> IncludeFixer::fix(DiagnosticsEngine::Level DiagLevel,
case diag::err_no_member: // Could be no member in namespace. case diag::err_no_member: // Could be no member in namespace.
case diag::err_no_member_suggest: case diag::err_no_member_suggest:
if (LastUnresolvedName) { if (LastUnresolvedName) {
// Try to fix unresolved name caused by missing declaraion. // Try to fix unresolved name caused by missing declaration.
// E.g. // E.g.
// clang::SourceManager SM; // clang::SourceManager SM;
// ~~~~~~~~~~~~~ // ~~~~~~~~~~~~~
@ -161,7 +161,7 @@ std::vector<Fix> IncludeFixer::fixesForSymbols(const SymbolSlab &Syms) const {
}; };
std::vector<Fix> Fixes; std::vector<Fix> Fixes;
// Deduplicate fixes by include headers. This doesn't distiguish symbols in // Deduplicate fixes by include headers. This doesn't distinguish symbols in
// different scopes from the same header, but this case should be rare and is // different scopes from the same header, but this case should be rare and is
// thus ignored. // thus ignored.
llvm::StringSet<> InsertedHeaders; llvm::StringSet<> InsertedHeaders;

View File

@ -88,7 +88,7 @@ public:
const std::vector<Diag> &getDiagnostics() const; const std::vector<Diag> &getDiagnostics() const;
/// Returns the esitmated size of the AST and the accessory structures, in /// Returns the estimated size of the AST and the accessory structures, in
/// bytes. Does not include the size of the preamble. /// bytes. Does not include the size of the preamble.
std::size_t getUsedBytes() const; std::size_t getUsedBytes() const;
const IncludeStructure &getIncludeStructure() const; const IncludeStructure &getIncludeStructure() const;

View File

@ -681,7 +681,7 @@ llvm::json::Value toJSON(const Diagnostic &);
/// A LSP-specific comparator used to find diagnostic in a container like /// A LSP-specific comparator used to find diagnostic in a container like
/// std:map. /// std:map.
/// We only use the required fields of Diagnostic to do the comparsion to avoid /// We only use the required fields of Diagnostic to do the comparison to avoid
/// any regression issues from LSP clients (e.g. VScode), see /// any regression issues from LSP clients (e.g. VScode), see
/// https://git.io/vbr29 /// https://git.io/vbr29
struct LSPDiagnosticCompare { struct LSPDiagnosticCompare {

View File

@ -83,7 +83,7 @@ std::vector<SemanticHighlightingInformation>
toSemanticHighlightingInformation(llvm::ArrayRef<LineHighlightings> Tokens); toSemanticHighlightingInformation(llvm::ArrayRef<LineHighlightings> Tokens);
/// Return a line-by-line diff between two highlightings. /// Return a line-by-line diff between two highlightings.
/// - if the tokens on a line are the same in both hightlightings, this line is /// - if the tokens on a line are the same in both highlightings, this line is
/// omitted. /// omitted.
/// - if a line exists in New but not in Old, the tokens on this line are /// - if a line exists in New but not in Old, the tokens on this line are
/// emitted. /// emitted.

View File

@ -39,7 +39,7 @@ struct InputsAndAST {
struct InputsAndPreamble { struct InputsAndPreamble {
llvm::StringRef Contents; llvm::StringRef Contents;
const tooling::CompileCommand &Command; const tooling::CompileCommand &Command;
// This can be nullptr if no preamble is availble. // This can be nullptr if no preamble is available.
const PreambleData *Preamble; const PreambleData *Preamble;
}; };

View File

@ -27,7 +27,7 @@ namespace clangd {
namespace trace { namespace trace {
/// A consumer of trace events. The events are produced by Spans and trace::log. /// A consumer of trace events. The events are produced by Spans and trace::log.
/// Implmentations of this interface must be thread-safe. /// Implementations of this interface must be thread-safe.
class EventTracer { class EventTracer {
public: public:
virtual ~EventTracer() = default; virtual ~EventTracer() = default;

View File

@ -94,7 +94,7 @@ export function activate(context: vscode.ExtensionContext) {
{ scheme: 'file', language: 'objective-cpp'} { scheme: 'file', language: 'objective-cpp'}
], ],
synchronize: !syncFileEvents ? undefined : { synchronize: !syncFileEvents ? undefined : {
// FIXME: send sync file events when clangd provides implemenatations. // FIXME: send sync file events when clangd provides implementations.
}, },
initializationOptions: { clangdFileStatus: true }, initializationOptions: { clangdFileStatus: true },
// Do not switch to output window when clangd returns output // Do not switch to output window when clangd returns output

View File

@ -1,4 +1,4 @@
//===-- CanonicalIncludes.h - remap #inclue headers--------------*- C++ -*-===// //===-- CanonicalIncludes.h - remap #include headers-------------*- C++ -*-===//
// //
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information. // See https://llvm.org/LICENSE.txt for license information.

View File

@ -103,7 +103,7 @@ struct Symbol {
/// this header. This number is only meaningful if aggregated in an index. /// this header. This number is only meaningful if aggregated in an index.
unsigned References = 0; unsigned References = 0;
}; };
/// One Symbol can potentially be incuded via different headers. /// One Symbol can potentially be included via different headers.
/// - If we haven't seen a definition, this covers all declarations. /// - If we haven't seen a definition, this covers all declarations.
/// - If we have seen a definition, this covers declarations visible from /// - If we have seen a definition, this covers declarations visible from
/// any definition. /// any definition.
@ -115,7 +115,7 @@ struct Symbol {
/// Whether or not this symbol is meant to be used for the code completion. /// Whether or not this symbol is meant to be used for the code completion.
/// See also isIndexedForCodeCompletion(). /// See also isIndexedForCodeCompletion().
/// Note that we don't store completion information (signature, snippet, /// Note that we don't store completion information (signature, snippet,
/// type, inclues) if the symbol is not indexed for code completion. /// type, includes) if the symbol is not indexed for code completion.
IndexedForCodeCompletion = 1 << 0, IndexedForCodeCompletion = 1 << 0,
/// Indicates if the symbol is deprecated. /// Indicates if the symbol is deprecated.
Deprecated = 1 << 1, Deprecated = 1 << 1,

View File

@ -667,7 +667,7 @@ size_t renameRangeAdjustmentCost(ArrayRef<Range> Indexed, ArrayRef<Range> Lexed,
Indexed[I].start.character - Lexed[MappedIndex[I]].start.character; Indexed[I].start.character - Lexed[MappedIndex[I]].start.character;
int Line = Indexed[I].start.line; int Line = Indexed[I].start.line;
if (Line != LastLine) if (Line != LastLine)
LastDColumn = 0; // colmun offsets don't carry cross lines. LastDColumn = 0; // column offsets don't carry cross lines.
Cost += abs(DLine - LastDLine) + abs(DColumn - LastDColumn); Cost += abs(DLine - LastDLine) + abs(DColumn - LastDColumn);
std::tie(LastLine, LastDLine, LastDColumn) = std::tie(Line, DLine, DColumn); std::tie(LastLine, LastDLine, LastDColumn) = std::tie(Line, DLine, DColumn);
} }

View File

@ -96,7 +96,7 @@ const FunctionDecl *getSelectedFunction(const SelectionTree::Node *SelNode) {
} }
// Checks the decls mentioned in Source are visible in the context of Target. // Checks the decls mentioned in Source are visible in the context of Target.
// Achives that by checking declaraions occur before target location in // Achieves that by checking declarations occur before target location in
// translation unit or declared in the same class. // translation unit or declared in the same class.
bool checkDeclsAreVisible(const llvm::DenseSet<const Decl *> &DeclRefs, bool checkDeclsAreVisible(const llvm::DenseSet<const Decl *> &DeclRefs,
const FunctionDecl *Target, const SourceManager &SM) { const FunctionDecl *Target, const SourceManager &SM) {

View File

@ -676,7 +676,7 @@ TEST(CompletionTest, IncludeInsertionPreprocessorIntegrationTests) {
Symbol Sym = cls("ns::X"); Symbol Sym = cls("ns::X");
Sym.CanonicalDeclaration.FileURI = BarURI.c_str(); Sym.CanonicalDeclaration.FileURI = BarURI.c_str();
Sym.IncludeHeaders.emplace_back(BarURI, 1); Sym.IncludeHeaders.emplace_back(BarURI, 1);
// Shoten include path based on search dirctory and insert. // Shoten include path based on search directory and insert.
auto Results = completions(Server, auto Results = completions(Server,
R"cpp( R"cpp(
int main() { ns::^ } int main() { ns::^ }
@ -719,7 +719,7 @@ TEST(CompletionTest, NoIncludeInsertionWhenDeclFoundInFile) {
SymY.CanonicalDeclaration.FileURI = BarURI.c_str(); SymY.CanonicalDeclaration.FileURI = BarURI.c_str();
SymX.IncludeHeaders.emplace_back("<bar>", 1); SymX.IncludeHeaders.emplace_back("<bar>", 1);
SymY.IncludeHeaders.emplace_back("<bar>", 1); SymY.IncludeHeaders.emplace_back("<bar>", 1);
// Shoten include path based on search dirctory and insert. // Shoten include path based on search directory and insert.
auto Results = completions(Server, auto Results = completions(Server,
R"cpp( R"cpp(
namespace ns { namespace ns {

View File

@ -1411,7 +1411,7 @@ TEST(Hover, All) {
)cpp", )cpp",
[](HoverInfo &HI) { HI.Name = "int"; }}, [](HoverInfo &HI) { HI.Name = "int"; }},
{ {
R"cpp(// More compilcated structured types. R"cpp(// More complicated structured types.
int bar(); int bar();
^[[auto]] (*foo)() = bar; ^[[auto]] (*foo)() = bar;
)cpp", )cpp",

View File

@ -30,7 +30,7 @@ using testing::IsEmpty;
using testing::UnorderedElementsAre; using testing::UnorderedElementsAre;
using testing::UnorderedElementsAreArray; using testing::UnorderedElementsAreArray;
// Covnert a Range to a Ref. // Convert a Range to a Ref.
Ref refWithRange(const clangd::Range &Range, const std::string &URI) { Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
Ref Result; Ref Result;
Result.Kind = RefKind::Reference; Result.Kind = RefKind::Reference;
@ -460,14 +460,14 @@ TEST(RenameTest, Renameable) {
)cpp", )cpp",
"used outside main file", HeaderFile, Index}, "used outside main file", HeaderFile, Index},
{R"cpp(// disallow -- symbol in annonymous namespace in header is not indexable. {R"cpp(// disallow -- symbol in anonymous namespace in header is not indexable.
namespace { namespace {
class Unin^dexable {}; class Unin^dexable {};
} }
)cpp", )cpp",
"not eligible for indexing", HeaderFile, Index}, "not eligible for indexing", HeaderFile, Index},
{R"cpp(// allow -- symbol in annonymous namespace in non-header file is indexable. {R"cpp(// allow -- symbol in anonymous namespace in non-header file is indexable.
namespace { namespace {
class [[F^oo]] {}; class [[F^oo]] {};
} }

View File

@ -305,7 +305,7 @@ TEST(SymbolInfoTests, All) {
{CreateExpectedSymbolDetails("bar", "foo", {CreateExpectedSymbolDetails("bar", "foo",
"c:TestTU.cpp@50@F@foo#I#@bar")}}, "c:TestTU.cpp@50@F@foo#I#@bar")}},
{ {
R"cpp( // Type inferrence with auto keyword R"cpp( // Type inference with auto keyword
struct foo {}; struct foo {};
foo getfoo() { return foo{}; } foo getfoo() { return foo{}; }
void f() { void f() {

View File

@ -56,7 +56,7 @@ template <typename T> struct CaptureProxy {
private: private:
llvm::Optional<T> *Target; llvm::Optional<T> *Target;
// Using shared_ptr to workaround compilation errors with MSVC. // Using shared_ptr to workaround compilation errors with MSVC.
// MSVC only allows default-construcitble and copyable objects as future<> // MSVC only allows default-constructible and copyable objects as future<>
// arguments. // arguments.
std::promise<std::shared_ptr<T>> Promise; std::promise<std::shared_ptr<T>> Promise;
std::future<std::shared_ptr<T>> Future; std::future<std::shared_ptr<T>> Future;

View File

@ -176,7 +176,7 @@ TEST_F(TUSchedulerTests, MissingFiles) {
TEST_F(TUSchedulerTests, WantDiagnostics) { TEST_F(TUSchedulerTests, WantDiagnostics) {
std::atomic<int> CallbackCount(0); std::atomic<int> CallbackCount(0);
{ {
// To avoid a racy test, don't allow tasks to actualy run on the worker // To avoid a racy test, don't allow tasks to actually run on the worker
// thread until we've scheduled them all. // thread until we've scheduled them all.
Notification Ready; Notification Ready;
TUScheduler S( TUScheduler S(

View File

@ -270,7 +270,7 @@ TEST_F(ExtractVariableTest, Test) {
a = [[a + 1]]; a = [[a + 1]];
// lambda // lambda
auto lamb = [&[[a]], &[[b]]](int r = [[1]]) {return 1;} auto lamb = [&[[a]], &[[b]]](int r = [[1]]) {return 1;}
// assigment // assignment
xyz([[a = 5]]); xyz([[a = 5]]);
xyz([[a *= 5]]); xyz([[a *= 5]]);
// Variable DeclRefExpr // Variable DeclRefExpr

View File

@ -50,7 +50,7 @@ template <class... ChildMatchers>
return Field(&TypeHierarchyItem::children, return Field(&TypeHierarchyItem::children,
HasValue(UnorderedElementsAre(ChildrenM...))); HasValue(UnorderedElementsAre(ChildrenM...)));
} }
// Note: "not resolved" is differnt from "resolved but empty"! // Note: "not resolved" is different from "resolved but empty"!
MATCHER(ParentsNotResolved, "") { return !arg.parents; } MATCHER(ParentsNotResolved, "") { return !arg.parents; }
MATCHER(ChildrenNotResolved, "") { return !arg.children; } MATCHER(ChildrenNotResolved, "") { return !arg.children; }

View File

@ -187,7 +187,7 @@ TEST(LocateSymbol, WithIndex) {
EXPECT_THAT(LocateWithIndex(Test), EXPECT_THAT(LocateWithIndex(Test),
ElementsAre(Sym("Foo", Test.range(), SymbolHeader.range("foo")))); ElementsAre(Sym("Foo", Test.range(), SymbolHeader.range("foo"))));
Test = Annotations(R"cpp(// defintion in AST. Test = Annotations(R"cpp(// definition in AST.
class [[Forward]] {}; class [[Forward]] {};
F^orward create(); F^orward create();
)cpp"); )cpp");

View File

@ -57,7 +57,7 @@ the code. For example:
Here the check reports that the ``'a'`` and ``'A'`` branches are identical Here the check reports that the ``'a'`` and ``'A'`` branches are identical
(and that the ``'b'`` and ``'B'`` branches are also identical), but does not (and that the ``'b'`` and ``'B'`` branches are also identical), but does not
report that the ``default:`` branch is also idenical to the first two branches. report that the ``default:`` branch is also identical to the first two branches.
If this is indeed the correct behavior, then it could be implemented as: If this is indeed the correct behavior, then it could be implemented as:
.. code-block:: c++ .. code-block:: c++

View File

@ -5,7 +5,7 @@ cert-mem57-cpp
This check flags uses of default ``operator new`` where the type has extended This check flags uses of default ``operator new`` where the type has extended
alignment (an alignment greater than the fundamental alignment). (The default alignment (an alignment greater than the fundamental alignment). (The default
``operator new`` is guaranteed to provide the correct alignmment if the ``operator new`` is guaranteed to provide the correct alignment if the
requested alignment is less or equal to the fundamental alignment). requested alignment is less or equal to the fundamental alignment).
Only cases are detected (by design) where the ``operator new`` is not Only cases are detected (by design) where the ``operator new`` is not
user-defined and is not a placement new (the reason is that in these cases we user-defined and is not a placement new (the reason is that in these cases we

View File

@ -1,4 +1,4 @@
.. title:: clang-tidy - hicpp-undelegated-construtor .. title:: clang-tidy - hicpp-undelegated-constructor
.. meta:: .. meta::
:http-equiv=refresh: 5;URL=bugprone-undelegated-constructor.html :http-equiv=refresh: 5;URL=bugprone-undelegated-constructor.html

View File

@ -9,7 +9,7 @@ This check will try to enforce coding guidelines on the identifiers naming. It
supports one of the following casing types and tries to convert from one to supports one of the following casing types and tries to convert from one to
another if a mismatch is detected another if a mismatch is detected
Casing types inclde: Casing types include:
- ``lower_case``, - ``lower_case``,
- ``UPPER_CASE``, - ``UPPER_CASE``,

View File

@ -20,7 +20,7 @@
// map. // map.
// //
// Modularize takes as input either one or more module maps (by default, // Modularize takes as input either one or more module maps (by default,
// "module.modulemap") or one or more text files contatining lists of headers // "module.modulemap") or one or more text files containing lists of headers
// to check. // to check.
// //
// In the case of a module map, the module map must be well-formed in // In the case of a module map, the module map must be well-formed in

View File

@ -54,7 +54,7 @@
// To check for '#include' directives nested inside 'Extern "C/C++" {}' // To check for '#include' directives nested inside 'Extern "C/C++" {}'
// or 'namespace {}' blocks, we keep track of the '#include' directives // or 'namespace {}' blocks, we keep track of the '#include' directives
// while running the preprocessor, and later during a walk of the AST // while running the preprocessor, and later during a walk of the AST
// we call a function to check for any '#include' directies inside // we call a function to check for any '#include' directives inside
// an 'Extern "C/C++" {}' or 'namespace {}' block, given its source // an 'Extern "C/C++" {}' or 'namespace {}' block, given its source
// range. // range.
// //
@ -1271,7 +1271,7 @@ private:
// PreprocessorTracker functions. // PreprocessorTracker functions.
// PreprocessorTracker desctructor. // PreprocessorTracker destructor.
PreprocessorTracker::~PreprocessorTracker() {} PreprocessorTracker::~PreprocessorTracker() {}
// Create instance of PreprocessorTracker. // Create instance of PreprocessorTracker.

View File

@ -221,7 +221,7 @@ void PPCallbacksTracker::PragmaMessage(SourceLocation Loc,
appendArgument("Str", Str); appendArgument("Str", Str);
} }
// Callback invoked when a #pragma gcc dianostic push directive // Callback invoked when a #pragma gcc diagnostic push directive
// is read. // is read.
void PPCallbacksTracker::PragmaDiagnosticPush(SourceLocation Loc, void PPCallbacksTracker::PragmaDiagnosticPush(SourceLocation Loc,
llvm::StringRef Namespace) { llvm::StringRef Namespace) {
@ -230,7 +230,7 @@ void PPCallbacksTracker::PragmaDiagnosticPush(SourceLocation Loc,
appendArgument("Namespace", Namespace); appendArgument("Namespace", Namespace);
} }
// Callback invoked when a #pragma gcc dianostic pop directive // Callback invoked when a #pragma gcc diagnostic pop directive
// is read. // is read.
void PPCallbacksTracker::PragmaDiagnosticPop(SourceLocation Loc, void PPCallbacksTracker::PragmaDiagnosticPop(SourceLocation Loc,
llvm::StringRef Namespace) { llvm::StringRef Namespace) {
@ -239,7 +239,7 @@ void PPCallbacksTracker::PragmaDiagnosticPop(SourceLocation Loc,
appendArgument("Namespace", Namespace); appendArgument("Namespace", Namespace);
} }
// Callback invoked when a #pragma gcc dianostic directive is read. // Callback invoked when a #pragma gcc diagnostic directive is read.
void PPCallbacksTracker::PragmaDiagnostic(SourceLocation Loc, void PPCallbacksTracker::PragmaDiagnostic(SourceLocation Loc,
llvm::StringRef Namespace, llvm::StringRef Namespace,
diag::Severity Mapping, diag::Severity Mapping,

View File

@ -54,6 +54,6 @@ void arbitrary_call() {
// we dont want every function to raise the warning even if malloc is in the name // we dont want every function to raise the warning even if malloc is in the name
malloced_array(); // OK(2) malloced_array(); // OK(2)
// completly unrelated function call to malloc // completely unrelated function call to malloc
newed_array(); // OK(3) newed_array(); // OK(3)
} }

View File

@ -37,6 +37,6 @@ void arbitrary_call() {
// we dont want every function to raise the warning even if malloc is in the name // we dont want every function to raise the warning even if malloc is in the name
malloced_array(); // OK(2) malloced_array(); // OK(2)
// completly unrelated function call to malloc // completely unrelated function call to malloc
newed_array(); // OK(3) newed_array(); // OK(3)
} }

View File

@ -29,7 +29,7 @@ private:
} // namespace std } // namespace std
// All of the following codesnippets should be valid with appropriate 'owner<>' anaylsis, // All of the following codesnippets should be valid with appropriate 'owner<>' analysis,
// but currently the type information of 'gsl::owner<>' gets lost in typededuction. // but currently the type information of 'gsl::owner<>' gets lost in typededuction.
int main() { int main() {
std::vector<gsl::owner<int *>> OwnerStdVector(100, nullptr); std::vector<gsl::owner<int *>> OwnerStdVector(100, nullptr);

View File

@ -451,7 +451,7 @@ void initialization(int T, Base b) {
// CHECK-FIXES: FI = std::make_unique<int[]>(5); // CHECK-FIXES: FI = std::make_unique<int[]>(5);
// The check doesn't give warnings and fixes for cases where the original new // The check doesn't give warnings and fixes for cases where the original new
// expresion doesn't do any initialization. // expression doesn't do any initialization.
FI.reset(new int[5]); FI.reset(new int[5]);
FI.reset(new int[Num]); FI.reset(new int[Num]);
FI.reset(new int[Num2]); FI.reset(new int[Num2]);

View File

@ -304,8 +304,8 @@ void test_const_pointers_abiguous() {
// CHECK-FIXES: const_ambiguous_function((int*)nullptr); // CHECK-FIXES: const_ambiguous_function((int*)nullptr);
} }
// Test where the implicit cast to null is surrounded by another implict cast // Test where the implicit cast to null is surrounded by another implicit cast
// with possible explict casts in-between. // with possible explicit casts in-between.
void test_const_pointers() { void test_const_pointers() {
const int *const_p1 = 0; const int *const_p1 = 0;
// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use nullptr // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use nullptr

View File

@ -9,7 +9,7 @@
// not raise performance-unnecessary-value-param. // not raise performance-unnecessary-value-param.
void foo(id object) { } void foo(id object) { }
// Same for explcitly non-ARC-managed Objective-C objects. // Same for explicitly non-ARC-managed Objective-C objects.
void bar(__unsafe_unretained id object) { } void bar(__unsafe_unretained id object) { }
// Same for Objective-c classes. // Same for Objective-c classes.

View File

@ -9,7 +9,7 @@
// not raise performance-unnecessary-value-param. // not raise performance-unnecessary-value-param.
void foo(id object) { } void foo(id object) { }
// Same for explcitly non-ARC-managed Objective-C objects. // Same for explicitly non-ARC-managed Objective-C objects.
void bar(__unsafe_unretained id object) { } void bar(__unsafe_unretained id object) { }
// Same for Objective-c classes. // Same for Objective-c classes.

View File

@ -10,7 +10,7 @@
// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \ // RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
// RUN: value: 0}]}" -- -fms-compatibility -DEXTERNINLINE // RUN: value: 0}]}" -- -fms-compatibility -DEXTERNINLINE
// //
// With -fno-ms-compatiblity, DEXTERNINLINE causes additional output. // With -fno-ms-compatibility, DEXTERNINLINE causes additional output.
// (The leading ',' means "default checks in addition to NOMSCOMPAT checks.) // (The leading ',' means "default checks in addition to NOMSCOMPAT checks.)
// RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \ // RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \
// RUN: %s readability-redundant-declaration %t -- \ // RUN: %s readability-redundant-declaration %t -- \

View File

@ -198,8 +198,8 @@ TEST_F(FindAllSymbolsTest, ExternCSymbols) {
TEST_F(FindAllSymbolsTest, CXXRecordSymbols) { TEST_F(FindAllSymbolsTest, CXXRecordSymbols) {
static const char Header[] = R"( static const char Header[] = R"(
struct Glob {}; struct Glob {};
struct A; // Not a defintion, ignored. struct A; // Not a definition, ignored.
class NOP; // Not a defintion, ignored class NOP; // Not a definition, ignored
namespace na { namespace na {
struct A { struct A {
struct AAAA {}; struct AAAA {};