mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-26 23:21:11 +00:00
Remove \brief commands from doxygen comments.
Summary: We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done [This is analogous to LLVM r331272 and CFE r331834] Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66578 llvm-svn: 369643
This commit is contained in:
parent
c6744055ad
commit
282dc72c8b
@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file provides the interface for deduplicating, detecting
|
||||
/// This file provides the interface for deduplicating, detecting
|
||||
/// conflicts in, and applying collections of Replacements.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -31,21 +31,21 @@ class Rewriter;
|
||||
|
||||
namespace replace {
|
||||
|
||||
/// \brief Collection of TranslationUnitReplacements.
|
||||
/// Collection of TranslationUnitReplacements.
|
||||
typedef std::vector<clang::tooling::TranslationUnitReplacements> TUReplacements;
|
||||
|
||||
/// \brief Collection of TranslationUnitReplacement files.
|
||||
/// Collection of TranslationUnitReplacement files.
|
||||
typedef std::vector<std::string> TUReplacementFiles;
|
||||
|
||||
/// \brief Collection of TranslationUniDiagnostics.
|
||||
/// Collection of TranslationUniDiagnostics.
|
||||
typedef std::vector<clang::tooling::TranslationUnitDiagnostics> TUDiagnostics;
|
||||
|
||||
/// \brief Map mapping file name to a set of AtomicChange targeting that file.
|
||||
/// Map mapping file name to a set of AtomicChange targeting that file.
|
||||
typedef llvm::DenseMap<const clang::FileEntry *,
|
||||
std::vector<tooling::AtomicChange>>
|
||||
FileToChangesMap;
|
||||
|
||||
/// \brief Recursively descends through a directory structure rooted at \p
|
||||
/// Recursively descends through a directory structure rooted at \p
|
||||
/// Directory and attempts to deserialize *.yaml files as
|
||||
/// TranslationUnitReplacements. All docs that successfully deserialize are
|
||||
/// added to \p TUs.
|
||||
@ -70,7 +70,7 @@ std::error_code collectReplacementsFromDirectory(
|
||||
const llvm::StringRef Directory, TUDiagnostics &TUs,
|
||||
TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics);
|
||||
|
||||
/// \brief Deduplicate, check for conflicts, and extract all Replacements stored
|
||||
/// Deduplicate, check for conflicts, and extract all Replacements stored
|
||||
/// in \c TUs. Conflicting replacements are skipped.
|
||||
///
|
||||
/// \post For all (key,value) in FileChanges, value[i].getOffset() <=
|
||||
@ -90,7 +90,7 @@ bool mergeAndDeduplicate(const TUReplacements &TUs, const TUDiagnostics &TUDs,
|
||||
FileToChangesMap &FileChanges,
|
||||
clang::SourceManager &SM);
|
||||
|
||||
/// \brief Apply \c AtomicChange on File and rewrite it.
|
||||
/// Apply \c AtomicChange on File and rewrite it.
|
||||
///
|
||||
/// \param[in] File Path of the file where to apply AtomicChange.
|
||||
/// \param[in] Changes to apply.
|
||||
@ -104,7 +104,7 @@ applyChanges(StringRef File, const std::vector<tooling::AtomicChange> &Changes,
|
||||
const tooling::ApplyChangesSpec &Spec,
|
||||
DiagnosticsEngine &Diagnostics);
|
||||
|
||||
/// \brief Delete the replacement files.
|
||||
/// Delete the replacement files.
|
||||
///
|
||||
/// \param[in] Files Replacement files to delete.
|
||||
/// \param[in] Diagnostics DiagnosticsEngine used for error output.
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file provides the implementation for deduplicating, detecting
|
||||
/// This file provides the implementation for deduplicating, detecting
|
||||
/// conflicts in, and applying collections of Replacements.
|
||||
///
|
||||
/// FIXME: Use Diagnostics for output instead of llvm::errs().
|
||||
@ -124,7 +124,7 @@ std::error_code collectReplacementsFromDirectory(
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
/// \brief Extract replacements from collected TranslationUnitReplacements and
|
||||
/// Extract replacements from collected TranslationUnitReplacements and
|
||||
/// TranslationUnitDiagnostics and group them per file. Identical replacements
|
||||
/// from diagnostics are deduplicated.
|
||||
///
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file provides the main function for the
|
||||
/// This file provides the main function for the
|
||||
/// clang-apply-replacements tool.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -254,7 +254,7 @@ unsigned ClangDocBitcodeWriter::AbbreviationMap::get(RecordId RID) const {
|
||||
|
||||
// Validation and Overview Blocks
|
||||
|
||||
/// \brief Emits the magic number header to check that its the right format,
|
||||
/// Emits the magic number header to check that its the right format,
|
||||
/// in this case, 'DOCS'.
|
||||
void ClangDocBitcodeWriter::emitHeader() {
|
||||
for (char C : BitCodeConstants::Signature)
|
||||
@ -266,7 +266,7 @@ void ClangDocBitcodeWriter::emitVersionBlock() {
|
||||
emitRecord(VersionNumber, VERSION);
|
||||
}
|
||||
|
||||
/// \brief Emits a block ID and the block name to the BLOCKINFO block.
|
||||
/// Emits a block ID and the block name to the BLOCKINFO block.
|
||||
void ClangDocBitcodeWriter::emitBlockID(BlockId BID) {
|
||||
const auto &BlockIdName = BlockIdNameMap[BID];
|
||||
assert(BlockIdName.data() && BlockIdName.size() && "Unknown BlockId.");
|
||||
@ -279,7 +279,7 @@ void ClangDocBitcodeWriter::emitBlockID(BlockId BID) {
|
||||
BlockIdName.bytes_end()));
|
||||
}
|
||||
|
||||
/// \brief Emits a record name to the BLOCKINFO block.
|
||||
/// Emits a record name to the BLOCKINFO block.
|
||||
void ClangDocBitcodeWriter::emitRecordID(RecordId ID) {
|
||||
assert(RecordIdNameMap[ID] && "Unknown RecordId.");
|
||||
prepRecordData(ID);
|
||||
|
@ -17,31 +17,31 @@
|
||||
namespace clang {
|
||||
namespace include_fixer {
|
||||
|
||||
/// \brief A context for a file being processed. It includes all query
|
||||
/// A context for a file being processed. It includes all query
|
||||
/// information, e.g. symbols being queried in database, all header candidates.
|
||||
class IncludeFixerContext {
|
||||
public:
|
||||
struct HeaderInfo {
|
||||
/// \brief The header where QualifiedName comes from.
|
||||
/// The header where QualifiedName comes from.
|
||||
std::string Header;
|
||||
/// \brief A symbol name with completed namespace qualifiers which will
|
||||
/// A symbol name with completed namespace qualifiers which will
|
||||
/// replace the original symbol.
|
||||
std::string QualifiedName;
|
||||
};
|
||||
|
||||
struct QuerySymbolInfo {
|
||||
/// \brief The raw symbol name being queried in database. This name might
|
||||
/// The raw symbol name being queried in database. This name might
|
||||
/// miss some namespace qualifiers, and will be replaced by a fully
|
||||
/// qualified one.
|
||||
std::string RawIdentifier;
|
||||
|
||||
/// \brief The qualifiers of the scope in which SymbolIdentifier lookup
|
||||
/// The qualifiers of the scope in which SymbolIdentifier lookup
|
||||
/// occurs. It is represented as a sequence of names and scope resolution
|
||||
/// operatiors ::, ending with a scope resolution operator (e.g. a::b::).
|
||||
/// Empty if SymbolIdentifier is not in a specific scope.
|
||||
std::string ScopedQualifiers;
|
||||
|
||||
/// \brief The replacement range of RawIdentifier.
|
||||
/// The replacement range of RawIdentifier.
|
||||
tooling::Range Range;
|
||||
};
|
||||
|
||||
@ -50,23 +50,23 @@ public:
|
||||
std::vector<QuerySymbolInfo> QuerySymbols,
|
||||
std::vector<find_all_symbols::SymbolInfo> Symbols);
|
||||
|
||||
/// \brief Get symbol name.
|
||||
/// Get symbol name.
|
||||
llvm::StringRef getSymbolIdentifier() const {
|
||||
return QuerySymbolInfos.front().RawIdentifier;
|
||||
}
|
||||
|
||||
/// \brief Get replacement range of the symbol.
|
||||
/// Get replacement range of the symbol.
|
||||
tooling::Range getSymbolRange() const {
|
||||
return QuerySymbolInfos.front().Range;
|
||||
}
|
||||
|
||||
/// \brief Get the file path to the file being processed.
|
||||
/// Get the file path to the file being processed.
|
||||
StringRef getFilePath() const { return FilePath; }
|
||||
|
||||
/// \brief Get header information.
|
||||
/// Get header information.
|
||||
const std::vector<HeaderInfo> &getHeaderInfos() const { return HeaderInfos; }
|
||||
|
||||
/// \brief Get information of symbols being querid.
|
||||
/// Get information of symbols being querid.
|
||||
const std::vector<QuerySymbolInfo> &getQuerySymbolInfos() const {
|
||||
return QuerySymbolInfos;
|
||||
}
|
||||
@ -74,17 +74,17 @@ public:
|
||||
private:
|
||||
friend struct llvm::yaml::MappingTraits<IncludeFixerContext>;
|
||||
|
||||
/// \brief The file path to the file being processed.
|
||||
/// The file path to the file being processed.
|
||||
std::string FilePath;
|
||||
|
||||
/// \brief All instances of an unidentified symbol being queried.
|
||||
/// All instances of an unidentified symbol being queried.
|
||||
std::vector<QuerySymbolInfo> QuerySymbolInfos;
|
||||
|
||||
/// \brief The symbol candidates which match SymbolIdentifier. The symbols are
|
||||
/// The symbol candidates which match SymbolIdentifier. The symbols are
|
||||
/// sorted in a descending order based on the popularity info in SymbolInfo.
|
||||
std::vector<find_all_symbols::SymbolInfo> MatchedSymbols;
|
||||
|
||||
/// \brief The header information.
|
||||
/// The header information.
|
||||
std::vector<HeaderInfo> HeaderInfos;
|
||||
};
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace find_all_symbols {
|
||||
|
||||
class HeaderMapCollector;
|
||||
|
||||
/// \brief A preprocessor that collects all macro symbols.
|
||||
/// A preprocessor that collects all macro symbols.
|
||||
/// The contexts of a macro will be ignored since they are not available during
|
||||
/// preprocessing period.
|
||||
class FindAllMacros : public clang::PPCallbacks {
|
||||
|
@ -19,7 +19,7 @@ namespace find_all_symbols {
|
||||
|
||||
class HeaderMapCollector;
|
||||
|
||||
/// \brief FindAllSymbols collects all classes, free standing functions and
|
||||
/// FindAllSymbols collects all classes, free standing functions and
|
||||
/// global variables with some extra information such as the path of the header
|
||||
/// file, the namespaces they are contained in, the type of variables and the
|
||||
/// parameter types of functions.
|
||||
|
@ -17,7 +17,7 @@
|
||||
namespace clang {
|
||||
namespace find_all_symbols {
|
||||
|
||||
/// \brief HeaderMappCollector collects all remapping header files. This maps
|
||||
/// HeaderMappCollector collects all remapping header files. This maps
|
||||
/// complete header names or header name regex patterns to header names.
|
||||
class HeaderMapCollector {
|
||||
public:
|
||||
|
@ -17,7 +17,7 @@
|
||||
namespace clang {
|
||||
namespace find_all_symbols {
|
||||
|
||||
/// \brief This calculates the include path for \p Loc.
|
||||
/// This calculates the include path for \p Loc.
|
||||
///
|
||||
/// \param SM SourceManager.
|
||||
/// \param Loc A SourceLocation.
|
||||
|
@ -18,7 +18,7 @@ namespace find_all_symbols {
|
||||
|
||||
class HeaderMapCollector;
|
||||
|
||||
/// \brief PragmaCommentHandler parses pragma comment on include files to
|
||||
/// PragmaCommentHandler parses pragma comment on include files to
|
||||
/// determine when we should include a different header from the header that
|
||||
/// directly defines a symbol.
|
||||
///
|
||||
|
@ -19,14 +19,14 @@
|
||||
|
||||
namespace clang {
|
||||
namespace find_all_symbols {
|
||||
/// \brief Describes a named symbol from a header.
|
||||
/// Describes a named symbol from a header.
|
||||
/// Symbols with the same qualified name and type (e.g. function overloads)
|
||||
/// that appear in the same header are represented by a single SymbolInfo.
|
||||
///
|
||||
/// TODO: keep track of instances, e.g. overload locations and signatures.
|
||||
class SymbolInfo {
|
||||
public:
|
||||
/// \brief The SymbolInfo Type.
|
||||
/// The SymbolInfo Type.
|
||||
enum class SymbolKind {
|
||||
Function,
|
||||
Class,
|
||||
@ -38,17 +38,17 @@ public:
|
||||
Unknown,
|
||||
};
|
||||
|
||||
/// \brief The Context Type.
|
||||
/// The Context Type.
|
||||
enum class ContextType {
|
||||
Namespace, // Symbols declared in a namespace.
|
||||
Record, // Symbols declared in a class.
|
||||
EnumDecl, // Enum constants declared in a enum declaration.
|
||||
};
|
||||
|
||||
/// \brief A pair of <ContextType, ContextName>.
|
||||
/// A pair of <ContextType, ContextName>.
|
||||
typedef std::pair<ContextType, std::string> Context;
|
||||
|
||||
// \brief Signals are signals gathered by observing how a symbol is used.
|
||||
// Signals are signals gathered by observing how a symbol is used.
|
||||
// These are used to rank results.
|
||||
struct Signals {
|
||||
Signals() {}
|
||||
@ -76,19 +76,19 @@ public:
|
||||
|
||||
void SetFilePath(llvm::StringRef Path) { FilePath = Path; }
|
||||
|
||||
/// \brief Get symbol name.
|
||||
/// Get symbol name.
|
||||
llvm::StringRef getName() const { return Name; }
|
||||
|
||||
/// \brief Get the fully-qualified symbol name.
|
||||
/// Get the fully-qualified symbol name.
|
||||
std::string getQualifiedName() const;
|
||||
|
||||
/// \brief Get symbol type.
|
||||
/// Get symbol type.
|
||||
SymbolKind getSymbolKind() const { return Type; }
|
||||
|
||||
/// \brief Get a relative file path where symbol comes from.
|
||||
/// Get a relative file path where symbol comes from.
|
||||
llvm::StringRef getFilePath() const { return FilePath; }
|
||||
|
||||
/// \brief Get symbol contexts.
|
||||
/// Get symbol contexts.
|
||||
const std::vector<SymbolInfo::Context> &getContexts() const {
|
||||
return Contexts;
|
||||
}
|
||||
@ -100,17 +100,17 @@ public:
|
||||
private:
|
||||
friend struct llvm::yaml::MappingTraits<struct SymbolAndSignals>;
|
||||
|
||||
/// \brief Identifier name.
|
||||
/// Identifier name.
|
||||
std::string Name;
|
||||
|
||||
/// \brief Symbol type.
|
||||
/// Symbol type.
|
||||
SymbolKind Type;
|
||||
|
||||
/// \brief The file path where the symbol comes from. It's a relative file
|
||||
/// The file path where the symbol comes from. It's a relative file
|
||||
/// path based on the build directory.
|
||||
std::string FilePath;
|
||||
|
||||
/// \brief Contains information about symbol contexts. Context information is
|
||||
/// Contains information about symbol contexts. Context information is
|
||||
/// stored from the inner-most level to outer-most level.
|
||||
///
|
||||
/// For example, if a symbol 'x' is declared as:
|
||||
@ -129,11 +129,11 @@ struct SymbolAndSignals {
|
||||
bool operator==(const SymbolAndSignals& RHS) const;
|
||||
};
|
||||
|
||||
/// \brief Write SymbolInfos to a stream (YAML format).
|
||||
/// Write SymbolInfos to a stream (YAML format).
|
||||
bool WriteSymbolInfosToStream(llvm::raw_ostream &OS,
|
||||
const SymbolInfo::SignalMap &Symbols);
|
||||
|
||||
/// \brief Read SymbolInfos from a YAML document.
|
||||
/// Read SymbolInfos from a YAML document.
|
||||
std::vector<SymbolAndSignals> ReadSymbolInfosFromYAML(llvm::StringRef Yaml);
|
||||
|
||||
} // namespace find_all_symbols
|
||||
|
@ -14,7 +14,7 @@
|
||||
namespace clang {
|
||||
namespace find_all_symbols {
|
||||
|
||||
/// \brief An interface for classes that collect symbols.
|
||||
/// An interface for classes that collect symbols.
|
||||
class SymbolReporter {
|
||||
public:
|
||||
virtual ~SymbolReporter() = default;
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
|
||||
QueryRef endQuery(QueryRef Q);
|
||||
|
||||
/// \brief Parse [\p Begin,\p End).
|
||||
/// Parse [\p Begin,\p End).
|
||||
///
|
||||
/// \return A reference to the parsed query object, which may be an
|
||||
/// \c InvalidQuery if a parse error occurs.
|
||||
|
@ -30,7 +30,7 @@ namespace reorder_fields {
|
||||
using namespace clang::ast_matchers;
|
||||
using llvm::SmallSetVector;
|
||||
|
||||
/// \brief Finds the definition of a record by name.
|
||||
/// Finds the definition of a record by name.
|
||||
///
|
||||
/// \returns nullptr if the name is ambiguous or not found.
|
||||
static const RecordDecl *findDefinition(StringRef RecordName,
|
||||
@ -50,7 +50,7 @@ static const RecordDecl *findDefinition(StringRef RecordName,
|
||||
return selectFirst<RecordDecl>("recordDecl", Results);
|
||||
}
|
||||
|
||||
/// \brief Calculates the new order of fields.
|
||||
/// Calculates the new order of fields.
|
||||
///
|
||||
/// \returns empty vector if the list of fields doesn't match the definition.
|
||||
static SmallVector<unsigned, 4>
|
||||
@ -79,7 +79,7 @@ getNewFieldsOrder(const RecordDecl *Definition,
|
||||
}
|
||||
|
||||
// FIXME: error-handling
|
||||
/// \brief Replaces one range of source code by another.
|
||||
/// Replaces one range of source code by another.
|
||||
static void
|
||||
addReplacement(SourceRange Old, SourceRange New, const ASTContext &Context,
|
||||
std::map<std::string, tooling::Replacements> &Replacements) {
|
||||
@ -92,7 +92,7 @@ addReplacement(SourceRange Old, SourceRange New, const ASTContext &Context,
|
||||
consumeError(Replacements[R.getFilePath()].add(R));
|
||||
}
|
||||
|
||||
/// \brief Find all member fields used in the given init-list initializer expr
|
||||
/// Find all member fields used in the given init-list initializer expr
|
||||
/// that belong to the same record
|
||||
///
|
||||
/// \returns a set of field declarations, empty if none were present
|
||||
@ -114,7 +114,7 @@ findMembersUsedInInitExpr(const CXXCtorInitializer *Initializer,
|
||||
return Results;
|
||||
}
|
||||
|
||||
/// \brief Reorders fields in the definition of a struct/class.
|
||||
/// Reorders fields in the definition of a struct/class.
|
||||
///
|
||||
/// At the moment reodering of fields with
|
||||
/// different accesses (public/protected/private) is not supported.
|
||||
@ -150,7 +150,7 @@ static bool reorderFieldsInDefinition(
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Reorders initializers in a C++ struct/class constructor.
|
||||
/// Reorders initializers in a C++ struct/class constructor.
|
||||
///
|
||||
/// A constructor can have initializers for an arbitrary subset of the class's
|
||||
/// fields. Thus, we need to ensure that we reorder just the initializers that
|
||||
@ -215,7 +215,7 @@ static void reorderFieldsInConstructor(
|
||||
Replacements);
|
||||
}
|
||||
|
||||
/// \brief Reorders initializers in the brace initialization of an aggregate.
|
||||
/// Reorders initializers in the brace initialization of an aggregate.
|
||||
///
|
||||
/// At the moment partial initialization is not supported.
|
||||
/// \returns true on success
|
||||
|
@ -33,14 +33,14 @@ public:
|
||||
ClangTidyContext &Context,
|
||||
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS = nullptr);
|
||||
|
||||
/// \brief Returns an ASTConsumer that runs the specified clang-tidy checks.
|
||||
/// Returns an ASTConsumer that runs the specified clang-tidy checks.
|
||||
std::unique_ptr<clang::ASTConsumer>
|
||||
CreateASTConsumer(clang::CompilerInstance &Compiler, StringRef File);
|
||||
|
||||
/// \brief Get the list of enabled checks.
|
||||
/// Get the list of enabled checks.
|
||||
std::vector<std::string> getCheckNames();
|
||||
|
||||
/// \brief Get the union of options from all checks.
|
||||
/// Get the union of options from all checks.
|
||||
ClangTidyOptions::OptionMap getCheckOptions();
|
||||
|
||||
private:
|
||||
@ -49,12 +49,12 @@ private:
|
||||
std::unique_ptr<ClangTidyCheckFactories> CheckFactories;
|
||||
};
|
||||
|
||||
/// \brief Fills the list of check names that are enabled when the provided
|
||||
/// Fills the list of check names that are enabled when the provided
|
||||
/// filters are applied.
|
||||
std::vector<std::string> getCheckNames(const ClangTidyOptions &Options,
|
||||
bool AllowEnablingAnalyzerAlphaCheckers);
|
||||
|
||||
/// \brief Returns the effective check-specific options.
|
||||
/// Returns the effective check-specific options.
|
||||
///
|
||||
/// The method configures ClangTidy with the specified \p Options and collects
|
||||
/// effective options from all created checks. The returned set of options
|
||||
@ -64,7 +64,7 @@ ClangTidyOptions::OptionMap
|
||||
getCheckOptions(const ClangTidyOptions &Options,
|
||||
bool AllowEnablingAnalyzerAlphaCheckers);
|
||||
|
||||
/// \brief Run a set of clang-tidy checks on a set of files.
|
||||
/// Run a set of clang-tidy checks on a set of files.
|
||||
///
|
||||
/// \param EnableCheckProfile If provided, it enables check profile collection
|
||||
/// in MatchFinder, and will contain the result of the profile.
|
||||
@ -82,7 +82,7 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
|
||||
// FIXME: This interface will need to be significantly extended to be useful.
|
||||
// FIXME: Implement confidence levels for displaying/fixing errors.
|
||||
//
|
||||
/// \brief Displays the found \p Errors to the users. If \p Fix is true, \p
|
||||
/// Displays the found \p Errors to the users. If \p Fix is true, \p
|
||||
/// Errors containing fixes are automatically applied and reformatted. If no
|
||||
/// clang-format configuration file is found, the given \P FormatStyle is used.
|
||||
void handleErrors(llvm::ArrayRef<ClangTidyError> Errors,
|
||||
@ -90,7 +90,7 @@ void handleErrors(llvm::ArrayRef<ClangTidyError> Errors,
|
||||
unsigned &WarningsAsErrorsCount,
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS);
|
||||
|
||||
/// \brief Serializes replacements into YAML and writes them to the specified
|
||||
/// Serializes replacements into YAML and writes them to the specified
|
||||
/// output stream.
|
||||
void exportReplacements(StringRef MainFilePath,
|
||||
const std::vector<ClangTidyError> &Errors,
|
||||
|
@ -25,7 +25,7 @@ class CompilerInstance;
|
||||
|
||||
namespace tidy {
|
||||
|
||||
/// \brief Base class for all clang-tidy checks.
|
||||
/// Base class for all clang-tidy checks.
|
||||
///
|
||||
/// To implement a ``ClangTidyCheck``, write a subclass and override some of the
|
||||
/// base class's methods. E.g. to implement a check that validates namespace
|
||||
@ -46,14 +46,14 @@ namespace tidy {
|
||||
/// useful/necessary.
|
||||
class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
|
||||
public:
|
||||
/// \brief Initializes the check with \p CheckName and \p Context.
|
||||
/// Initializes the check with \p CheckName and \p Context.
|
||||
///
|
||||
/// Derived classes must implement the constructor with this signature or
|
||||
/// delegate it. If a check needs to read options, it can do this in the
|
||||
/// constructor using the Options.get() methods below.
|
||||
ClangTidyCheck(StringRef CheckName, ClangTidyContext *Context);
|
||||
|
||||
/// \brief Override this to register ``PPCallbacks`` in the preprocessor.
|
||||
/// Override this to register ``PPCallbacks`` in the preprocessor.
|
||||
///
|
||||
/// This should be used for clang-tidy checks that analyze preprocessor-
|
||||
/// dependent properties, e.g. include directives and macro definitions.
|
||||
@ -71,7 +71,7 @@ public:
|
||||
virtual void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
|
||||
Preprocessor *ModuleExpanderPP) {}
|
||||
|
||||
/// \brief Override this to register AST matchers with \p Finder.
|
||||
/// Override this to register AST matchers with \p Finder.
|
||||
///
|
||||
/// This should be used by clang-tidy checks that analyze code properties that
|
||||
/// dependent on AST knowledge.
|
||||
@ -85,40 +85,40 @@ public:
|
||||
/// matches occur in the order of the AST traversal.
|
||||
virtual void registerMatchers(ast_matchers::MatchFinder *Finder) {}
|
||||
|
||||
/// \brief ``ClangTidyChecks`` that register ASTMatchers should do the actual
|
||||
/// ``ClangTidyChecks`` that register ASTMatchers should do the actual
|
||||
/// work in here.
|
||||
virtual void check(const ast_matchers::MatchFinder::MatchResult &Result) {}
|
||||
|
||||
/// \brief Add a diagnostic with the check's name.
|
||||
/// Add a diagnostic with the check's name.
|
||||
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description,
|
||||
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
|
||||
|
||||
/// \brief Should store all options supported by this check with their
|
||||
/// Should store all options supported by this check with their
|
||||
/// current values or default values for options that haven't been overridden.
|
||||
///
|
||||
/// The check should use ``Options.store()`` to store each option it supports
|
||||
/// whether it has the default value or it has been overridden.
|
||||
virtual void storeOptions(ClangTidyOptions::OptionMap &Options) {}
|
||||
|
||||
/// \brief Provides access to the ``ClangTidyCheck`` options via check-local
|
||||
/// Provides access to the ``ClangTidyCheck`` options via check-local
|
||||
/// names.
|
||||
///
|
||||
/// Methods of this class prepend ``CheckName + "."`` to translate check-local
|
||||
/// option names to global option names.
|
||||
class OptionsView {
|
||||
public:
|
||||
/// \brief Initializes the instance using \p CheckName + "." as a prefix.
|
||||
/// Initializes the instance using \p CheckName + "." as a prefix.
|
||||
OptionsView(StringRef CheckName,
|
||||
const ClangTidyOptions::OptionMap &CheckOptions);
|
||||
|
||||
/// \brief Read a named option from the ``Context``.
|
||||
/// Read a named option from the ``Context``.
|
||||
///
|
||||
/// Reads the option with the check-local name \p LocalName from the
|
||||
/// ``CheckOptions``. If the corresponding key is not present, returns
|
||||
/// \p Default.
|
||||
std::string get(StringRef LocalName, StringRef Default) const;
|
||||
|
||||
/// \brief Read a named option from the ``Context``.
|
||||
/// Read a named option from the ``Context``.
|
||||
///
|
||||
/// Reads the option with the check-local name \p LocalName from local or
|
||||
/// global ``CheckOptions``. Gets local option first. If local is not
|
||||
@ -126,7 +126,7 @@ public:
|
||||
/// present either, returns Default.
|
||||
std::string getLocalOrGlobal(StringRef LocalName, StringRef Default) const;
|
||||
|
||||
/// \brief Read a named option from the ``Context`` and parse it as an
|
||||
/// Read a named option from the ``Context`` and parse it as an
|
||||
/// integral type ``T``.
|
||||
///
|
||||
/// Reads the option with the check-local name \p LocalName from the
|
||||
@ -142,7 +142,7 @@ public:
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// \brief Read a named option from the ``Context`` and parse it as an
|
||||
/// Read a named option from the ``Context`` and parse it as an
|
||||
/// integral type ``T``.
|
||||
///
|
||||
/// Reads the option with the check-local name \p LocalName from local or
|
||||
@ -159,12 +159,12 @@ public:
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// \brief Stores an option with the check-local name \p LocalName with
|
||||
/// Stores an option with the check-local name \p LocalName with
|
||||
/// string value \p Value to \p Options.
|
||||
void store(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
|
||||
StringRef Value) const;
|
||||
|
||||
/// \brief Stores an option with the check-local name \p LocalName with
|
||||
/// Stores an option with the check-local name \p LocalName with
|
||||
/// ``int64_t`` value \p Value to \p Options.
|
||||
void store(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
|
||||
int64_t Value) const;
|
||||
@ -182,9 +182,9 @@ private:
|
||||
|
||||
protected:
|
||||
OptionsView Options;
|
||||
/// \brief Returns the main file name of the current translation unit.
|
||||
/// Returns the main file name of the current translation unit.
|
||||
StringRef getCurrentMainFile() const { return Context->getCurrentFile(); }
|
||||
/// \brief Returns the language options from the context.
|
||||
/// Returns the language options from the context.
|
||||
const LangOptions &getLangOpts() const { return Context->getLangOpts(); }
|
||||
};
|
||||
|
||||
|
@ -33,7 +33,7 @@ class CompilationDatabase;
|
||||
|
||||
namespace tidy {
|
||||
|
||||
/// \brief A detected error complete with information to display diagnostic and
|
||||
/// A detected error complete with information to display diagnostic and
|
||||
/// automatic fix.
|
||||
///
|
||||
/// This is used as an intermediate format to transport Diagnostics without a
|
||||
@ -47,16 +47,16 @@ struct ClangTidyError : tooling::Diagnostic {
|
||||
bool IsWarningAsError;
|
||||
};
|
||||
|
||||
/// \brief Read-only set of strings represented as a list of positive and
|
||||
/// Read-only set of strings represented as a list of positive and
|
||||
/// negative globs. Positive globs add all matched strings to the set, negative
|
||||
/// globs remove them in the order of appearance in the list.
|
||||
class GlobList {
|
||||
public:
|
||||
/// \brief \p GlobList is a comma-separated list of globs (only '*'
|
||||
/// \p GlobList is a comma-separated list of globs (only '*'
|
||||
/// metacharacter is supported) with optional '-' prefix to denote exclusion.
|
||||
GlobList(StringRef Globs);
|
||||
|
||||
/// \brief Returns \c true if the pattern matches \p S. The result is the last
|
||||
/// Returns \c true if the pattern matches \p S. The result is the last
|
||||
/// matching glob's Positive flag.
|
||||
bool contains(StringRef S) { return contains(S, false); }
|
||||
|
||||
@ -68,7 +68,7 @@ private:
|
||||
std::unique_ptr<GlobList> NextGlob;
|
||||
};
|
||||
|
||||
/// \brief Contains displayed and ignored diagnostic counters for a ClangTidy
|
||||
/// Contains displayed and ignored diagnostic counters for a ClangTidy
|
||||
/// run.
|
||||
struct ClangTidyStats {
|
||||
ClangTidyStats()
|
||||
@ -87,7 +87,7 @@ struct ClangTidyStats {
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Every \c ClangTidyCheck reports errors through a \c DiagnosticsEngine
|
||||
/// Every \c ClangTidyCheck reports errors through a \c DiagnosticsEngine
|
||||
/// provided by this context.
|
||||
///
|
||||
/// A \c ClangTidyCheck always has access to the active context to report
|
||||
@ -98,7 +98,7 @@ struct ClangTidyStats {
|
||||
/// \endcode
|
||||
class ClangTidyContext {
|
||||
public:
|
||||
/// \brief Initializes \c ClangTidyContext instance.
|
||||
/// Initializes \c ClangTidyContext instance.
|
||||
ClangTidyContext(std::unique_ptr<ClangTidyOptionsProvider> OptionsProvider,
|
||||
bool AllowEnablingAnalyzerAlphaCheckers = false);
|
||||
/// Sets the DiagnosticsEngine that diag() will emit diagnostics to.
|
||||
@ -110,7 +110,7 @@ public:
|
||||
|
||||
~ClangTidyContext();
|
||||
|
||||
/// \brief Report any errors detected using this method.
|
||||
/// Report any errors detected using this method.
|
||||
///
|
||||
/// This is still under heavy development and will likely change towards using
|
||||
/// tablegen'd diagnostic IDs.
|
||||
@ -119,72 +119,72 @@ public:
|
||||
StringRef Message,
|
||||
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
|
||||
|
||||
/// \brief Sets the \c SourceManager of the used \c DiagnosticsEngine.
|
||||
/// Sets the \c SourceManager of the used \c DiagnosticsEngine.
|
||||
///
|
||||
/// This is called from the \c ClangTidyCheck base class.
|
||||
void setSourceManager(SourceManager *SourceMgr);
|
||||
|
||||
/// \brief Should be called when starting to process new translation unit.
|
||||
/// Should be called when starting to process new translation unit.
|
||||
void setCurrentFile(StringRef File);
|
||||
|
||||
/// \brief Returns the main file name of the current translation unit.
|
||||
/// Returns the main file name of the current translation unit.
|
||||
StringRef getCurrentFile() const { return CurrentFile; }
|
||||
|
||||
/// \brief Sets ASTContext for the current translation unit.
|
||||
/// Sets ASTContext for the current translation unit.
|
||||
void setASTContext(ASTContext *Context);
|
||||
|
||||
/// \brief Gets the language options from the AST context.
|
||||
/// Gets the language options from the AST context.
|
||||
const LangOptions &getLangOpts() const { return LangOpts; }
|
||||
|
||||
/// \brief Returns the name of the clang-tidy check which produced this
|
||||
/// Returns the name of the clang-tidy check which produced this
|
||||
/// diagnostic ID.
|
||||
std::string getCheckName(unsigned DiagnosticID) const;
|
||||
|
||||
/// \brief Returns \c true if the check is enabled for the \c CurrentFile.
|
||||
/// Returns \c true if the check is enabled for the \c CurrentFile.
|
||||
///
|
||||
/// The \c CurrentFile can be changed using \c setCurrentFile.
|
||||
bool isCheckEnabled(StringRef CheckName) const;
|
||||
|
||||
/// \brief Returns \c true if the check should be upgraded to error for the
|
||||
/// Returns \c true if the check should be upgraded to error for the
|
||||
/// \c CurrentFile.
|
||||
bool treatAsError(StringRef CheckName) const;
|
||||
|
||||
/// \brief Returns global options.
|
||||
/// Returns global options.
|
||||
const ClangTidyGlobalOptions &getGlobalOptions() const;
|
||||
|
||||
/// \brief Returns options for \c CurrentFile.
|
||||
/// Returns options for \c CurrentFile.
|
||||
///
|
||||
/// The \c CurrentFile can be changed using \c setCurrentFile.
|
||||
const ClangTidyOptions &getOptions() const;
|
||||
|
||||
/// \brief Returns options for \c File. Does not change or depend on
|
||||
/// Returns options for \c File. Does not change or depend on
|
||||
/// \c CurrentFile.
|
||||
ClangTidyOptions getOptionsForFile(StringRef File) const;
|
||||
|
||||
/// \brief Returns \c ClangTidyStats containing issued and ignored diagnostic
|
||||
/// Returns \c ClangTidyStats containing issued and ignored diagnostic
|
||||
/// counters.
|
||||
const ClangTidyStats &getStats() const { return Stats; }
|
||||
|
||||
/// \brief Control profile collection in clang-tidy.
|
||||
/// Control profile collection in clang-tidy.
|
||||
void setEnableProfiling(bool Profile);
|
||||
bool getEnableProfiling() const { return Profile; }
|
||||
|
||||
/// \brief Control storage of profile date.
|
||||
/// Control storage of profile date.
|
||||
void setProfileStoragePrefix(StringRef ProfilePrefix);
|
||||
llvm::Optional<ClangTidyProfiling::StorageParams>
|
||||
getProfileStorageParams() const;
|
||||
|
||||
/// \brief Should be called when starting to process new translation unit.
|
||||
/// Should be called when starting to process new translation unit.
|
||||
void setCurrentBuildDirectory(StringRef BuildDirectory) {
|
||||
CurrentBuildDirectory = BuildDirectory;
|
||||
}
|
||||
|
||||
/// \brief Returns build directory of the current translation unit.
|
||||
/// Returns build directory of the current translation unit.
|
||||
const std::string &getCurrentBuildDirectory() {
|
||||
return CurrentBuildDirectory;
|
||||
}
|
||||
|
||||
/// \brief If the experimental alpha checkers from the static analyzer can be
|
||||
/// If the experimental alpha checkers from the static analyzer can be
|
||||
/// enabled.
|
||||
bool canEnableAnalyzerAlphaCheckers() const {
|
||||
return AllowEnablingAnalyzerAlphaCheckers;
|
||||
@ -243,7 +243,7 @@ bool ShouldSuppressDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const Diagnostic &Info, ClangTidyContext &Context,
|
||||
bool CheckMacroExpansion = true);
|
||||
|
||||
/// \brief A diagnostic consumer that turns each \c Diagnostic into a
|
||||
/// A diagnostic consumer that turns each \c Diagnostic into a
|
||||
/// \c SourceManager-independent \c ClangTidyError.
|
||||
//
|
||||
// FIXME: If we move away from unit-tests, this can be moved to a private
|
||||
@ -267,11 +267,11 @@ private:
|
||||
void finalizeLastError();
|
||||
void removeIncompatibleErrors();
|
||||
|
||||
/// \brief Returns the \c HeaderFilter constructed for the options set in the
|
||||
/// Returns the \c HeaderFilter constructed for the options set in the
|
||||
/// context.
|
||||
llvm::Regex *getHeaderFilter();
|
||||
|
||||
/// \brief Updates \c LastErrorRelatesToUserCode and LastErrorPassesLineFilter
|
||||
/// Updates \c LastErrorRelatesToUserCode and LastErrorPassesLineFilter
|
||||
/// according to the diagnostic \p Location.
|
||||
void checkFilters(SourceLocation Location, const SourceManager &Sources);
|
||||
bool passesLineFilter(StringRef FileName, unsigned LineNumber) const;
|
||||
|
@ -19,7 +19,7 @@
|
||||
namespace clang {
|
||||
namespace tidy {
|
||||
|
||||
/// \brief A collection of \c ClangTidyCheckFactory instances.
|
||||
/// A collection of \c ClangTidyCheckFactory instances.
|
||||
///
|
||||
/// All clang-tidy modules register their check factories with an instance of
|
||||
/// this object.
|
||||
@ -29,12 +29,12 @@ public:
|
||||
ClangTidyContext *Context)>
|
||||
CheckFactory;
|
||||
|
||||
/// \brief Registers check \p Factory with name \p Name.
|
||||
/// Registers check \p Factory with name \p Name.
|
||||
///
|
||||
/// For all checks that have default constructors, use \c registerCheck.
|
||||
void registerCheckFactory(StringRef Name, CheckFactory Factory);
|
||||
|
||||
/// \brief Registers the \c CheckType with the name \p Name.
|
||||
/// Registers the \c CheckType with the name \p Name.
|
||||
///
|
||||
/// This method should be used for all \c ClangTidyChecks that don't require
|
||||
/// constructor parameters.
|
||||
@ -62,7 +62,7 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
/// \brief Create instances of all checks matching \p CheckRegexString and
|
||||
/// Create instances of all checks matching \p CheckRegexString and
|
||||
/// store them in \p Checks.
|
||||
///
|
||||
/// The caller takes ownership of the return \c ClangTidyChecks.
|
||||
@ -78,17 +78,17 @@ private:
|
||||
FactoryMap Factories;
|
||||
};
|
||||
|
||||
/// \brief A clang-tidy module groups a number of \c ClangTidyChecks and gives
|
||||
/// A clang-tidy module groups a number of \c ClangTidyChecks and gives
|
||||
/// them a prefixed name.
|
||||
class ClangTidyModule {
|
||||
public:
|
||||
virtual ~ClangTidyModule() {}
|
||||
|
||||
/// \brief Implement this function in order to register all \c CheckFactories
|
||||
/// Implement this function in order to register all \c CheckFactories
|
||||
/// belonging to this module.
|
||||
virtual void addCheckFactories(ClangTidyCheckFactories &CheckFactories) = 0;
|
||||
|
||||
/// \brief Gets default options for checks defined in this module.
|
||||
/// Gets default options for checks defined in this module.
|
||||
virtual ClangTidyOptions getModuleOptions();
|
||||
};
|
||||
|
||||
|
@ -316,7 +316,7 @@ FileOptionsProvider::tryReadConfigFile(StringRef Directory) {
|
||||
return llvm::None;
|
||||
}
|
||||
|
||||
/// \brief Parses -line-filter option and stores it to the \c Options.
|
||||
/// Parses -line-filter option and stores it to the \c Options.
|
||||
std::error_code parseLineFilter(StringRef LineFilter,
|
||||
clang::tidy::ClangTidyGlobalOptions &Options) {
|
||||
llvm::yaml::Input Input(LineFilter);
|
||||
|
@ -25,30 +25,30 @@
|
||||
namespace clang {
|
||||
namespace tidy {
|
||||
|
||||
/// \brief Contains a list of line ranges in a single file.
|
||||
/// Contains a list of line ranges in a single file.
|
||||
struct FileFilter {
|
||||
/// \brief File name.
|
||||
/// File name.
|
||||
std::string Name;
|
||||
|
||||
/// \brief LineRange is a pair<start, end> (inclusive).
|
||||
/// LineRange is a pair<start, end> (inclusive).
|
||||
typedef std::pair<unsigned, unsigned> LineRange;
|
||||
|
||||
/// \brief A list of line ranges in this file, for which we show warnings.
|
||||
/// A list of line ranges in this file, for which we show warnings.
|
||||
std::vector<LineRange> LineRanges;
|
||||
};
|
||||
|
||||
/// \brief Global options. These options are neither stored nor read from
|
||||
/// Global options. These options are neither stored nor read from
|
||||
/// configuration files.
|
||||
struct ClangTidyGlobalOptions {
|
||||
/// \brief Output warnings from certain line ranges of certain files only.
|
||||
/// Output warnings from certain line ranges of certain files only.
|
||||
/// If empty, no warnings will be filtered.
|
||||
std::vector<FileFilter> LineFilter;
|
||||
};
|
||||
|
||||
/// \brief Contains options for clang-tidy. These options may be read from
|
||||
/// Contains options for clang-tidy. These options may be read from
|
||||
/// configuration files, and may be different for different translation units.
|
||||
struct ClangTidyOptions {
|
||||
/// \brief These options are used for all settings that haven't been
|
||||
/// These options are used for all settings that haven't been
|
||||
/// overridden by the \c OptionsProvider.
|
||||
///
|
||||
/// Allow no checks and no headers by default. This method initializes
|
||||
@ -56,24 +56,24 @@ struct ClangTidyOptions {
|
||||
/// of each registered \c ClangTidyModule.
|
||||
static ClangTidyOptions getDefaults();
|
||||
|
||||
/// \brief Creates a new \c ClangTidyOptions instance combined from all fields
|
||||
/// Creates a new \c ClangTidyOptions instance combined from all fields
|
||||
/// of this instance overridden by the fields of \p Other that have a value.
|
||||
ClangTidyOptions mergeWith(const ClangTidyOptions &Other) const;
|
||||
|
||||
/// \brief Checks filter.
|
||||
/// Checks filter.
|
||||
llvm::Optional<std::string> Checks;
|
||||
|
||||
/// \brief WarningsAsErrors filter.
|
||||
/// WarningsAsErrors filter.
|
||||
llvm::Optional<std::string> WarningsAsErrors;
|
||||
|
||||
/// \brief Output warnings from headers matching this filter. Warnings from
|
||||
/// Output warnings from headers matching this filter. Warnings from
|
||||
/// main files will always be displayed.
|
||||
llvm::Optional<std::string> HeaderFilterRegex;
|
||||
|
||||
/// \brief Output warnings from system headers matching \c HeaderFilterRegex.
|
||||
/// Output warnings from system headers matching \c HeaderFilterRegex.
|
||||
llvm::Optional<bool> SystemHeaders;
|
||||
|
||||
/// \brief Format code around applied fixes with clang-format using this
|
||||
/// Format code around applied fixes with clang-format using this
|
||||
/// style.
|
||||
///
|
||||
/// Can be one of:
|
||||
@ -87,7 +87,7 @@ struct ClangTidyOptions {
|
||||
/// See clang-format documentation for more about configuring format style.
|
||||
llvm::Optional<std::string> FormatStyle;
|
||||
|
||||
/// \brief Specifies the name or e-mail of the user running clang-tidy.
|
||||
/// Specifies the name or e-mail of the user running clang-tidy.
|
||||
///
|
||||
/// This option is used, for example, to place the correct user name in TODO()
|
||||
/// comments in the relevant check.
|
||||
@ -96,19 +96,19 @@ struct ClangTidyOptions {
|
||||
typedef std::pair<std::string, std::string> StringPair;
|
||||
typedef std::map<std::string, std::string> OptionMap;
|
||||
|
||||
/// \brief Key-value mapping used to store check-specific options.
|
||||
/// Key-value mapping used to store check-specific options.
|
||||
OptionMap CheckOptions;
|
||||
|
||||
typedef std::vector<std::string> ArgList;
|
||||
|
||||
/// \brief Add extra compilation arguments to the end of the list.
|
||||
/// Add extra compilation arguments to the end of the list.
|
||||
llvm::Optional<ArgList> ExtraArgs;
|
||||
|
||||
/// \brief Add extra compilation arguments to the start of the list.
|
||||
/// Add extra compilation arguments to the start of the list.
|
||||
llvm::Optional<ArgList> ExtraArgsBefore;
|
||||
};
|
||||
|
||||
/// \brief Abstract interface for retrieving various ClangTidy options.
|
||||
/// Abstract interface for retrieving various ClangTidy options.
|
||||
class ClangTidyOptionsProvider {
|
||||
public:
|
||||
static const char OptionsSourceTypeDefaultBinary[];
|
||||
@ -117,10 +117,10 @@ public:
|
||||
|
||||
virtual ~ClangTidyOptionsProvider() {}
|
||||
|
||||
/// \brief Returns global options, which are independent of the file.
|
||||
/// Returns global options, which are independent of the file.
|
||||
virtual const ClangTidyGlobalOptions &getGlobalOptions() = 0;
|
||||
|
||||
/// \brief ClangTidyOptions and its source.
|
||||
/// ClangTidyOptions and its source.
|
||||
//
|
||||
/// clang-tidy has 3 types of the sources in order of increasing priority:
|
||||
/// * clang-tidy binary.
|
||||
@ -130,17 +130,17 @@ public:
|
||||
/// * '-checks' commandline option.
|
||||
typedef std::pair<ClangTidyOptions, std::string> OptionsSource;
|
||||
|
||||
/// \brief Returns an ordered vector of OptionsSources, in order of increasing
|
||||
/// Returns an ordered vector of OptionsSources, in order of increasing
|
||||
/// priority.
|
||||
virtual std::vector<OptionsSource>
|
||||
getRawOptions(llvm::StringRef FileName) = 0;
|
||||
|
||||
/// \brief Returns options applying to a specific translation unit with the
|
||||
/// Returns options applying to a specific translation unit with the
|
||||
/// specified \p FileName.
|
||||
ClangTidyOptions getOptions(llvm::StringRef FileName);
|
||||
};
|
||||
|
||||
/// \brief Implementation of the \c ClangTidyOptionsProvider interface, which
|
||||
/// Implementation of the \c ClangTidyOptionsProvider interface, which
|
||||
/// returns the same options for all files.
|
||||
class DefaultOptionsProvider : public ClangTidyOptionsProvider {
|
||||
public:
|
||||
@ -157,7 +157,7 @@ private:
|
||||
ClangTidyOptions DefaultOptions;
|
||||
};
|
||||
|
||||
/// \brief Implementation of ClangTidyOptions interface, which is used for
|
||||
/// Implementation of ClangTidyOptions interface, which is used for
|
||||
/// '-config' command-line option.
|
||||
class ConfigOptionsProvider : public DefaultOptionsProvider {
|
||||
public:
|
||||
@ -172,7 +172,7 @@ private:
|
||||
ClangTidyOptions OverrideOptions;
|
||||
};
|
||||
|
||||
/// \brief Implementation of the \c ClangTidyOptionsProvider interface, which
|
||||
/// Implementation of the \c ClangTidyOptionsProvider interface, which
|
||||
/// tries to find a configuration file in the closest parent directory of each
|
||||
/// source file.
|
||||
///
|
||||
@ -182,13 +182,13 @@ private:
|
||||
/// specified using the appropriate constructor.
|
||||
class FileOptionsProvider : public DefaultOptionsProvider {
|
||||
public:
|
||||
// \brief A pair of configuration file base name and a function parsing
|
||||
// A pair of configuration file base name and a function parsing
|
||||
// configuration from text in the corresponding format.
|
||||
typedef std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions>(
|
||||
llvm::StringRef)>>
|
||||
ConfigFileHandler;
|
||||
|
||||
/// \brief Configuration file handlers listed in the order of priority.
|
||||
/// Configuration file handlers listed in the order of priority.
|
||||
///
|
||||
/// Custom configuration file formats can be supported by constructing the
|
||||
/// list of handlers and passing it to the appropriate \c FileOptionsProvider
|
||||
@ -207,7 +207,7 @@ public:
|
||||
/// take precedence over ".clang-tidy" if both reside in the same directory.
|
||||
typedef std::vector<ConfigFileHandler> ConfigFileHandlers;
|
||||
|
||||
/// \brief Initializes the \c FileOptionsProvider instance.
|
||||
/// Initializes the \c FileOptionsProvider instance.
|
||||
///
|
||||
/// \param GlobalOptions are just stored and returned to the caller of
|
||||
/// \c getGlobalOptions.
|
||||
@ -223,7 +223,7 @@ public:
|
||||
const ClangTidyOptions &OverrideOptions,
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = nullptr);
|
||||
|
||||
/// \brief Initializes the \c FileOptionsProvider instance with a custom set
|
||||
/// Initializes the \c FileOptionsProvider instance with a custom set
|
||||
/// of configuration file handlers.
|
||||
///
|
||||
/// \param GlobalOptions are just stored and returned to the caller of
|
||||
@ -248,7 +248,7 @@ public:
|
||||
std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName) override;
|
||||
|
||||
protected:
|
||||
/// \brief Try to read configuration files from \p Directory using registered
|
||||
/// Try to read configuration files from \p Directory using registered
|
||||
/// \c ConfigHandlers.
|
||||
llvm::Optional<OptionsSource> tryReadConfigFile(llvm::StringRef Directory);
|
||||
|
||||
@ -258,15 +258,15 @@ protected:
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS;
|
||||
};
|
||||
|
||||
/// \brief Parses LineFilter from JSON and stores it to the \p Options.
|
||||
/// Parses LineFilter from JSON and stores it to the \p Options.
|
||||
std::error_code parseLineFilter(llvm::StringRef LineFilter,
|
||||
ClangTidyGlobalOptions &Options);
|
||||
|
||||
/// \brief Parses configuration from JSON and returns \c ClangTidyOptions or an
|
||||
/// Parses configuration from JSON and returns \c ClangTidyOptions or an
|
||||
/// error.
|
||||
llvm::ErrorOr<ClangTidyOptions> parseConfiguration(llvm::StringRef Config);
|
||||
|
||||
/// \brief Serializes configuration to a YAML-encoded string.
|
||||
/// Serializes configuration to a YAML-encoded string.
|
||||
std::string configurationAsText(const ClangTidyOptions &Options);
|
||||
|
||||
} // end namespace tidy
|
||||
|
@ -22,7 +22,7 @@ class ModuleFile;
|
||||
|
||||
namespace tooling {
|
||||
|
||||
/// \brief Handles PPCallbacks and re-runs preprocessing of the whole
|
||||
/// Handles PPCallbacks and re-runs preprocessing of the whole
|
||||
/// translation unit with modules disabled.
|
||||
///
|
||||
/// This way it's possible to get PPCallbacks for the whole translation unit
|
||||
@ -40,7 +40,7 @@ public:
|
||||
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS);
|
||||
~ExpandModularHeadersPPCallbacks();
|
||||
|
||||
/// \brief Returns the preprocessor that provides callbacks for the whole
|
||||
/// Returns the preprocessor that provides callbacks for the whole
|
||||
/// translation unit, including the main file, textual headers, and modular
|
||||
/// headers.
|
||||
///
|
||||
|
@ -21,7 +21,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace android {
|
||||
|
||||
/// \brief The base class for all close-on-exec checks in Android module.
|
||||
/// The base class for all close-on-exec checks in Android module.
|
||||
/// To be specific, there are some functions that need the close-on-exec flag to
|
||||
/// prevent the file descriptor leakage on fork+exec and this class provides
|
||||
/// utilities to identify and fix these C functions.
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace bugprone {
|
||||
|
||||
/// \brief Checks the usage of patterns known to produce incorrect rounding.
|
||||
/// Checks the usage of patterns known to produce incorrect rounding.
|
||||
/// Programmers often use
|
||||
/// (int)(double_expression + 0.5)
|
||||
/// to round the double expression to an integer. The problem with this
|
||||
|
@ -20,7 +20,7 @@ namespace {
|
||||
|
||||
AST_MATCHER(Expr, isInMacro) { return Node.getBeginLoc().isMacroID(); }
|
||||
|
||||
/// \brief Find the next statement after `S`.
|
||||
/// Find the next statement after `S`.
|
||||
const Stmt *nextStmt(const MatchFinder::MatchResult &Result, const Stmt *S) {
|
||||
auto Parents = Result.Context->getParents(*S);
|
||||
if (Parents.empty())
|
||||
|
@ -22,7 +22,7 @@ void SwappedArgumentsCheck::registerMatchers(MatchFinder *Finder) {
|
||||
Finder->addMatcher(callExpr().bind("call"), this);
|
||||
}
|
||||
|
||||
/// \brief Look through lvalue to rvalue and nop casts. This filters out
|
||||
/// Look through lvalue to rvalue and nop casts. This filters out
|
||||
/// implicit conversions that have no effect on the input but block our view for
|
||||
/// other implicit casts.
|
||||
static const Expr *ignoreNoOpCasts(const Expr *E) {
|
||||
@ -33,7 +33,7 @@ static const Expr *ignoreNoOpCasts(const Expr *E) {
|
||||
return E;
|
||||
}
|
||||
|
||||
/// \brief Restrict the warning to implicit casts that are most likely
|
||||
/// Restrict the warning to implicit casts that are most likely
|
||||
/// accidental. User defined or integral conversions fit in this category,
|
||||
/// lvalue to rvalue or derived to base does not.
|
||||
static bool isImplicitCastCandidate(const CastExpr *Cast) {
|
||||
|
@ -38,7 +38,7 @@ void TooSmallLoopVariableCheck::storeOptions(
|
||||
Options.store(Opts, "MagnitudeBitsUpperLimit", MagnitudeBitsUpperLimit);
|
||||
}
|
||||
|
||||
/// \brief The matcher for loops with suspicious integer loop variable.
|
||||
/// The matcher for loops with suspicious integer loop variable.
|
||||
///
|
||||
/// In this general example, assuming 'j' and 'k' are of integral type:
|
||||
/// \code
|
||||
@ -105,7 +105,7 @@ static unsigned calcMagnitudeBits(const ASTContext &Context,
|
||||
: Context.getIntWidth(IntExprType) - 1;
|
||||
}
|
||||
|
||||
/// \brief Calculate the upper bound expression's magnitude bits, but ignore
|
||||
/// Calculate the upper bound expression's magnitude bits, but ignore
|
||||
/// constant like values to reduce false positives.
|
||||
static unsigned calcUpperBoundMagnitudeBits(const ASTContext &Context,
|
||||
const Expr *UpperBound,
|
||||
|
@ -16,7 +16,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace bugprone {
|
||||
|
||||
/// \brief Checks for near miss of virtual methods.
|
||||
/// Checks for near miss of virtual methods.
|
||||
///
|
||||
/// For a method in a derived class, this check looks for virtual method with a
|
||||
/// very similar name and an identical signature defined in a base class.
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace cppcoreguidelines {
|
||||
|
||||
/// \brief Implements C++ Core Guidelines Type.6.
|
||||
/// Implements C++ Core Guidelines Type.6.
|
||||
///
|
||||
/// Checks that every user-provided constructor value-initializes all class
|
||||
/// members and base classes that would have undefined behavior otherwise. Also
|
||||
|
@ -16,7 +16,7 @@ namespace tidy {
|
||||
namespace google {
|
||||
namespace runtime {
|
||||
|
||||
/// \brief Checks the usage of non-constant references in function parameters.
|
||||
/// Checks the usage of non-constant references in function parameters.
|
||||
///
|
||||
/// https://google.github.io/styleguide/cppguide.html#Reference_Arguments
|
||||
class NonConstReferences : public ClangTidyCheck {
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace llvm_check {
|
||||
|
||||
/// \brief Looks at conditionals and finds and replaces cases of ``cast<>``, which will
|
||||
/// Looks at conditionals and finds and replaces cases of ``cast<>``, which will
|
||||
/// assert rather than return a null pointer, and ``dyn_cast<>`` where
|
||||
/// the return value is not captured. Additionally, finds and replaces cases that match the
|
||||
/// pattern ``var && isa<X>(var)``, where ``var`` is evaluated twice.
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace misc {
|
||||
|
||||
///\brief checks for locations that do not throw by value
|
||||
///checks for locations that do not throw by value
|
||||
// or catch by reference.
|
||||
// The check is C++ only. It checks that all throw locations
|
||||
// throw by value and not by pointer. Additionally it
|
||||
|
@ -61,7 +61,7 @@ static const StatementMatcher IncrementVarMatcher() {
|
||||
return declRefExpr(to(varDecl(hasType(isInteger())).bind(IncrementVarName)));
|
||||
}
|
||||
|
||||
/// \brief The matcher for loops over arrays.
|
||||
/// The matcher for loops over arrays.
|
||||
///
|
||||
/// In this general example, assuming 'j' and 'k' are of integral type:
|
||||
/// \code
|
||||
@ -97,7 +97,7 @@ StatementMatcher makeArrayLoopMatcher() {
|
||||
.bind(LoopNameArray);
|
||||
}
|
||||
|
||||
/// \brief The matcher used for iterator-based for loops.
|
||||
/// The matcher used for iterator-based for loops.
|
||||
///
|
||||
/// This matcher is more flexible than array-based loops. It will match
|
||||
/// catch loops of the following textual forms (regardless of whether the
|
||||
@ -204,7 +204,7 @@ StatementMatcher makeIteratorLoopMatcher() {
|
||||
.bind(LoopNameIterator);
|
||||
}
|
||||
|
||||
/// \brief The matcher used for array-like containers (pseudoarrays).
|
||||
/// The matcher used for array-like containers (pseudoarrays).
|
||||
///
|
||||
/// This matcher is more flexible than array-based loops. It will match
|
||||
/// loops of the following textual forms (regardless of whether the
|
||||
@ -296,7 +296,7 @@ StatementMatcher makePseudoArrayLoopMatcher() {
|
||||
.bind(LoopNamePseudoArray);
|
||||
}
|
||||
|
||||
/// \brief Determine whether Init appears to be an initializing an iterator.
|
||||
/// Determine whether Init appears to be an initializing an iterator.
|
||||
///
|
||||
/// If it is, returns the object whose begin() or end() method is called, and
|
||||
/// the output parameter isArrow is set to indicate whether the initialization
|
||||
@ -326,7 +326,7 @@ static const Expr *getContainerFromBeginEndCall(const Expr *Init, bool IsBegin,
|
||||
return SourceExpr;
|
||||
}
|
||||
|
||||
/// \brief Determines the container whose begin() and end() functions are called
|
||||
/// Determines the container whose begin() and end() functions are called
|
||||
/// for an iterator-based loop.
|
||||
///
|
||||
/// BeginExpr must be a member call to a function named "begin()", and EndExpr
|
||||
@ -355,7 +355,7 @@ static const Expr *findContainer(ASTContext *Context, const Expr *BeginExpr,
|
||||
return BeginContainerExpr;
|
||||
}
|
||||
|
||||
/// \brief Obtain the original source code text from a SourceRange.
|
||||
/// Obtain the original source code text from a SourceRange.
|
||||
static StringRef getStringFromRange(SourceManager &SourceMgr,
|
||||
const LangOptions &LangOpts,
|
||||
SourceRange Range) {
|
||||
@ -368,7 +368,7 @@ static StringRef getStringFromRange(SourceManager &SourceMgr,
|
||||
LangOpts);
|
||||
}
|
||||
|
||||
/// \brief If the given expression is actually a DeclRefExpr or a MemberExpr,
|
||||
/// If the given expression is actually a DeclRefExpr or a MemberExpr,
|
||||
/// find and return the underlying ValueDecl; otherwise, return NULL.
|
||||
static const ValueDecl *getReferencedVariable(const Expr *E) {
|
||||
if (const DeclRefExpr *DRE = getDeclRef(E))
|
||||
@ -378,7 +378,7 @@ static const ValueDecl *getReferencedVariable(const Expr *E) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/// \brief Returns true when the given expression is a member expression
|
||||
/// Returns true when the given expression is a member expression
|
||||
/// whose base is `this` (implicitly or not).
|
||||
static bool isDirectMemberExpr(const Expr *E) {
|
||||
if (const auto *Member = dyn_cast<MemberExpr>(E->IgnoreParenImpCasts()))
|
||||
@ -386,7 +386,7 @@ static bool isDirectMemberExpr(const Expr *E) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Given an expression that represents an usage of an element from the
|
||||
/// Given an expression that represents an usage of an element from the
|
||||
/// containter that we are iterating over, returns false when it can be
|
||||
/// guaranteed this element cannot be modified as a result of this usage.
|
||||
static bool canBeModified(ASTContext *Context, const Expr *E) {
|
||||
@ -406,7 +406,7 @@ static bool canBeModified(ASTContext *Context, const Expr *E) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Returns true when it can be guaranteed that the elements of the
|
||||
/// Returns true when it can be guaranteed that the elements of the
|
||||
/// container are not being modified.
|
||||
static bool usagesAreConst(ASTContext *Context, const UsageResult &Usages) {
|
||||
for (const Usage &U : Usages) {
|
||||
@ -422,7 +422,7 @@ static bool usagesAreConst(ASTContext *Context, const UsageResult &Usages) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Returns true if the elements of the container are never accessed
|
||||
/// Returns true if the elements of the container are never accessed
|
||||
/// by reference.
|
||||
static bool usagesReturnRValues(const UsageResult &Usages) {
|
||||
for (const auto &U : Usages) {
|
||||
@ -432,7 +432,7 @@ static bool usagesReturnRValues(const UsageResult &Usages) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Returns true if the container is const-qualified.
|
||||
/// Returns true if the container is const-qualified.
|
||||
static bool containerIsConst(const Expr *ContainerExpr, bool Dereference) {
|
||||
if (const auto *VDec = getReferencedVariable(ContainerExpr)) {
|
||||
QualType CType = VDec->getType();
|
||||
@ -491,7 +491,7 @@ void LoopConvertCheck::registerMatchers(MatchFinder *Finder) {
|
||||
Finder->addMatcher(makePseudoArrayLoopMatcher(), this);
|
||||
}
|
||||
|
||||
/// \brief Given the range of a single declaration, such as:
|
||||
/// Given the range of a single declaration, such as:
|
||||
/// \code
|
||||
/// unsigned &ThisIsADeclarationThatCanSpanSeveralLinesOfCode =
|
||||
/// InitializationValues[I];
|
||||
@ -515,7 +515,7 @@ void LoopConvertCheck::getAliasRange(SourceManager &SM, SourceRange &Range) {
|
||||
SourceRange(Range.getBegin(), Range.getEnd().getLocWithOffset(Offset));
|
||||
}
|
||||
|
||||
/// \brief Computes the changes needed to convert a given for loop, and
|
||||
/// Computes the changes needed to convert a given for loop, and
|
||||
/// applies them.
|
||||
void LoopConvertCheck::doConversion(
|
||||
ASTContext *Context, const VarDecl *IndexVar,
|
||||
@ -650,7 +650,7 @@ void LoopConvertCheck::doConversion(
|
||||
TUInfo->getGeneratedDecls().insert(make_pair(Loop, VarName));
|
||||
}
|
||||
|
||||
/// \brief Returns a string which refers to the container iterated over.
|
||||
/// Returns a string which refers to the container iterated over.
|
||||
StringRef LoopConvertCheck::getContainerString(ASTContext *Context,
|
||||
const ForStmt *Loop,
|
||||
const Expr *ContainerExpr) {
|
||||
@ -666,7 +666,7 @@ StringRef LoopConvertCheck::getContainerString(ASTContext *Context,
|
||||
return ContainerString;
|
||||
}
|
||||
|
||||
/// \brief Determines what kind of 'auto' must be used after converting a for
|
||||
/// Determines what kind of 'auto' must be used after converting a for
|
||||
/// loop that iterates over an array or pseudoarray.
|
||||
void LoopConvertCheck::getArrayLoopQualifiers(ASTContext *Context,
|
||||
const BoundNodes &Nodes,
|
||||
@ -701,7 +701,7 @@ void LoopConvertCheck::getArrayLoopQualifiers(ASTContext *Context,
|
||||
}
|
||||
}
|
||||
|
||||
/// \brief Determines what kind of 'auto' must be used after converting an
|
||||
/// Determines what kind of 'auto' must be used after converting an
|
||||
/// iterator based for loop.
|
||||
void LoopConvertCheck::getIteratorLoopQualifiers(ASTContext *Context,
|
||||
const BoundNodes &Nodes,
|
||||
@ -743,7 +743,7 @@ void LoopConvertCheck::getIteratorLoopQualifiers(ASTContext *Context,
|
||||
}
|
||||
}
|
||||
|
||||
/// \brief Determines the parameters needed to build the range replacement.
|
||||
/// Determines the parameters needed to build the range replacement.
|
||||
void LoopConvertCheck::determineRangeDescriptor(
|
||||
ASTContext *Context, const BoundNodes &Nodes, const ForStmt *Loop,
|
||||
LoopFixerKind FixerKind, const Expr *ContainerExpr,
|
||||
@ -756,7 +756,7 @@ void LoopConvertCheck::determineRangeDescriptor(
|
||||
getArrayLoopQualifiers(Context, Nodes, ContainerExpr, Usages, Descriptor);
|
||||
}
|
||||
|
||||
/// \brief Check some of the conditions that must be met for the loop to be
|
||||
/// Check some of the conditions that must be met for the loop to be
|
||||
/// convertible.
|
||||
bool LoopConvertCheck::isConvertible(ASTContext *Context,
|
||||
const ast_matchers::BoundNodes &Nodes,
|
||||
|
@ -30,7 +30,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace modernize {
|
||||
|
||||
/// \brief Tracks a stack of parent statements during traversal.
|
||||
/// Tracks a stack of parent statements during traversal.
|
||||
///
|
||||
/// All this really does is inject push_back() before running
|
||||
/// RecursiveASTVisitor::TraverseStmt() and pop_back() afterwards. The Stmt atop
|
||||
@ -44,7 +44,7 @@ bool StmtAncestorASTVisitor::TraverseStmt(Stmt *Statement) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Keep track of the DeclStmt associated with each VarDecl.
|
||||
/// Keep track of the DeclStmt associated with each VarDecl.
|
||||
///
|
||||
/// Combined with StmtAncestors, this provides roughly the same information as
|
||||
/// Scope, as we can map a VarDecl to its DeclStmt, then walk up the parent tree
|
||||
@ -57,19 +57,19 @@ bool StmtAncestorASTVisitor::VisitDeclStmt(DeclStmt *Decls) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief record the DeclRefExpr as part of the parent expression.
|
||||
/// record the DeclRefExpr as part of the parent expression.
|
||||
bool ComponentFinderASTVisitor::VisitDeclRefExpr(DeclRefExpr *E) {
|
||||
Components.push_back(E);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief record the MemberExpr as part of the parent expression.
|
||||
/// record the MemberExpr as part of the parent expression.
|
||||
bool ComponentFinderASTVisitor::VisitMemberExpr(MemberExpr *Member) {
|
||||
Components.push_back(Member);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Forward any DeclRefExprs to a check on the referenced variable
|
||||
/// Forward any DeclRefExprs to a check on the referenced variable
|
||||
/// declaration.
|
||||
bool DependencyFinderASTVisitor::VisitDeclRefExpr(DeclRefExpr *DeclRef) {
|
||||
if (auto *V = dyn_cast_or_null<VarDecl>(DeclRef->getDecl()))
|
||||
@ -77,7 +77,7 @@ bool DependencyFinderASTVisitor::VisitDeclRefExpr(DeclRefExpr *DeclRef) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Determine if any this variable is declared inside the ContainingStmt.
|
||||
/// Determine if any this variable is declared inside the ContainingStmt.
|
||||
bool DependencyFinderASTVisitor::VisitVarDecl(VarDecl *V) {
|
||||
const Stmt *Curr = DeclParents->lookup(V);
|
||||
// First, see if the variable was declared within an inner scope of the loop.
|
||||
@ -100,7 +100,7 @@ bool DependencyFinderASTVisitor::VisitVarDecl(VarDecl *V) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief If we already created a variable for TheLoop, check to make sure
|
||||
/// If we already created a variable for TheLoop, check to make sure
|
||||
/// that the name was not already taken.
|
||||
bool DeclFinderASTVisitor::VisitForStmt(ForStmt *TheLoop) {
|
||||
StmtGeneratedVarNameMap::const_iterator I = GeneratedDecls->find(TheLoop);
|
||||
@ -111,7 +111,7 @@ bool DeclFinderASTVisitor::VisitForStmt(ForStmt *TheLoop) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief If any named declaration within the AST subtree has the same name,
|
||||
/// If any named declaration within the AST subtree has the same name,
|
||||
/// then consider Name already taken.
|
||||
bool DeclFinderASTVisitor::VisitNamedDecl(NamedDecl *D) {
|
||||
const IdentifierInfo *Ident = D->getIdentifier();
|
||||
@ -122,7 +122,7 @@ bool DeclFinderASTVisitor::VisitNamedDecl(NamedDecl *D) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Forward any declaration references to the actual check on the
|
||||
/// Forward any declaration references to the actual check on the
|
||||
/// referenced declaration.
|
||||
bool DeclFinderASTVisitor::VisitDeclRefExpr(DeclRefExpr *DeclRef) {
|
||||
if (auto *D = dyn_cast<NamedDecl>(DeclRef->getDecl()))
|
||||
@ -130,7 +130,7 @@ bool DeclFinderASTVisitor::VisitDeclRefExpr(DeclRefExpr *DeclRef) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief If the new variable name conflicts with any type used in the loop,
|
||||
/// If the new variable name conflicts with any type used in the loop,
|
||||
/// then we mark that variable name as taken.
|
||||
bool DeclFinderASTVisitor::VisitTypeLoc(TypeLoc TL) {
|
||||
QualType QType = TL.getType();
|
||||
@ -152,7 +152,7 @@ bool DeclFinderASTVisitor::VisitTypeLoc(TypeLoc TL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Look through conversion/copy constructors to find the explicit
|
||||
/// Look through conversion/copy constructors to find the explicit
|
||||
/// initialization expression, returning it is found.
|
||||
///
|
||||
/// The main idea is that given
|
||||
@ -183,7 +183,7 @@ const Expr *digThroughConstructors(const Expr *E) {
|
||||
return E;
|
||||
}
|
||||
|
||||
/// \brief Returns true when two Exprs are equivalent.
|
||||
/// Returns true when two Exprs are equivalent.
|
||||
bool areSameExpr(ASTContext *Context, const Expr *First, const Expr *Second) {
|
||||
if (!First || !Second)
|
||||
return false;
|
||||
@ -194,18 +194,18 @@ bool areSameExpr(ASTContext *Context, const Expr *First, const Expr *Second) {
|
||||
return FirstID == SecondID;
|
||||
}
|
||||
|
||||
/// \brief Returns the DeclRefExpr represented by E, or NULL if there isn't one.
|
||||
/// Returns the DeclRefExpr represented by E, or NULL if there isn't one.
|
||||
const DeclRefExpr *getDeclRef(const Expr *E) {
|
||||
return dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts());
|
||||
}
|
||||
|
||||
/// \brief Returns true when two ValueDecls are the same variable.
|
||||
/// Returns true when two ValueDecls are the same variable.
|
||||
bool areSameVariable(const ValueDecl *First, const ValueDecl *Second) {
|
||||
return First && Second &&
|
||||
First->getCanonicalDecl() == Second->getCanonicalDecl();
|
||||
}
|
||||
|
||||
/// \brief Determines if an expression is a declaration reference to a
|
||||
/// Determines if an expression is a declaration reference to a
|
||||
/// particular variable.
|
||||
static bool exprReferencesVariable(const ValueDecl *Target, const Expr *E) {
|
||||
if (!Target || !E)
|
||||
@ -214,7 +214,7 @@ static bool exprReferencesVariable(const ValueDecl *Target, const Expr *E) {
|
||||
return Decl && areSameVariable(Target, Decl->getDecl());
|
||||
}
|
||||
|
||||
/// \brief If the expression is a dereference or call to operator*(), return the
|
||||
/// If the expression is a dereference or call to operator*(), return the
|
||||
/// operand. Otherwise, return NULL.
|
||||
static const Expr *getDereferenceOperand(const Expr *E) {
|
||||
if (const auto *Uop = dyn_cast<UnaryOperator>(E))
|
||||
@ -229,7 +229,7 @@ static const Expr *getDereferenceOperand(const Expr *E) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/// \brief Returns true when the Container contains an Expr equivalent to E.
|
||||
/// Returns true when the Container contains an Expr equivalent to E.
|
||||
template <typename ContainerT>
|
||||
static bool containsExpr(ASTContext *Context, const ContainerT *Container,
|
||||
const Expr *E) {
|
||||
@ -242,7 +242,7 @@ static bool containsExpr(ASTContext *Context, const ContainerT *Container,
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Returns true when the index expression is a declaration reference to
|
||||
/// Returns true when the index expression is a declaration reference to
|
||||
/// IndexVar.
|
||||
///
|
||||
/// If the index variable is `index`, this function returns true on
|
||||
@ -257,7 +257,7 @@ static bool isIndexInSubscriptExpr(const Expr *IndexExpr,
|
||||
areSameVariable(IndexVar, Idx->getDecl());
|
||||
}
|
||||
|
||||
/// \brief Returns true when the index expression is a declaration reference to
|
||||
/// Returns true when the index expression is a declaration reference to
|
||||
/// IndexVar, Obj is the same expression as SourceExpr after all parens and
|
||||
/// implicit casts are stripped off.
|
||||
///
|
||||
@ -302,7 +302,7 @@ static bool isIndexInSubscriptExpr(ASTContext *Context, const Expr *IndexExpr,
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Returns true when Opcall is a call a one-parameter dereference of
|
||||
/// Returns true when Opcall is a call a one-parameter dereference of
|
||||
/// IndexVar.
|
||||
///
|
||||
/// For example, if the index variable is `index`, returns true for
|
||||
@ -316,7 +316,7 @@ static bool isDereferenceOfOpCall(const CXXOperatorCallExpr *OpCall,
|
||||
exprReferencesVariable(IndexVar, OpCall->getArg(0));
|
||||
}
|
||||
|
||||
/// \brief Returns true when Uop is a dereference of IndexVar.
|
||||
/// Returns true when Uop is a dereference of IndexVar.
|
||||
///
|
||||
/// For example, if the index variable is `index`, returns true for
|
||||
/// *index
|
||||
@ -329,7 +329,7 @@ static bool isDereferenceOfUop(const UnaryOperator *Uop,
|
||||
exprReferencesVariable(IndexVar, Uop->getSubExpr());
|
||||
}
|
||||
|
||||
/// \brief Determines whether the given Decl defines a variable initialized to
|
||||
/// Determines whether the given Decl defines a variable initialized to
|
||||
/// the loop object.
|
||||
///
|
||||
/// This is intended to find cases such as
|
||||
@ -416,7 +416,7 @@ static bool isAliasDecl(ASTContext *Context, const Decl *TheDecl,
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Determines whether the bound of a for loop condition expression is
|
||||
/// Determines whether the bound of a for loop condition expression is
|
||||
/// the same as the statically computable size of ArrayType.
|
||||
///
|
||||
/// Given
|
||||
@ -489,7 +489,7 @@ void ForLoopIndexUseVisitor::addUsage(const Usage &U) {
|
||||
Usages.push_back(U);
|
||||
}
|
||||
|
||||
/// \brief If the unary operator is a dereference of IndexVar, include it
|
||||
/// If the unary operator is a dereference of IndexVar, include it
|
||||
/// as a valid usage and prune the traversal.
|
||||
///
|
||||
/// For example, if container.begin() and container.end() both return pointers
|
||||
@ -511,7 +511,7 @@ bool ForLoopIndexUseVisitor::TraverseUnaryDeref(UnaryOperator *Uop) {
|
||||
return VisitorBase::TraverseUnaryOperator(Uop);
|
||||
}
|
||||
|
||||
/// \brief If the member expression is operator-> (overloaded or not) on
|
||||
/// If the member expression is operator-> (overloaded or not) on
|
||||
/// IndexVar, include it as a valid usage and prune the traversal.
|
||||
///
|
||||
/// For example, given
|
||||
@ -588,7 +588,7 @@ bool ForLoopIndexUseVisitor::TraverseMemberExpr(MemberExpr *Member) {
|
||||
return VisitorBase::TraverseMemberExpr(Member);
|
||||
}
|
||||
|
||||
/// \brief If a member function call is the at() accessor on the container with
|
||||
/// If a member function call is the at() accessor on the container with
|
||||
/// IndexVar as the single argument, include it as a valid usage and prune
|
||||
/// the traversal.
|
||||
///
|
||||
@ -621,7 +621,7 @@ bool ForLoopIndexUseVisitor::TraverseCXXMemberCallExpr(
|
||||
return VisitorBase::TraverseCXXMemberCallExpr(MemberCall);
|
||||
}
|
||||
|
||||
/// \brief If an overloaded operator call is a dereference of IndexVar or
|
||||
/// If an overloaded operator call is a dereference of IndexVar or
|
||||
/// a subscript of the container with IndexVar as the single argument,
|
||||
/// include it as a valid usage and prune the traversal.
|
||||
///
|
||||
@ -667,7 +667,7 @@ bool ForLoopIndexUseVisitor::TraverseCXXOperatorCallExpr(
|
||||
return VisitorBase::TraverseCXXOperatorCallExpr(OpCall);
|
||||
}
|
||||
|
||||
/// \brief If we encounter an array with IndexVar as the index of an
|
||||
/// If we encounter an array with IndexVar as the index of an
|
||||
/// ArraySubsriptExpression, note it as a consistent usage and prune the
|
||||
/// AST traversal.
|
||||
///
|
||||
@ -709,7 +709,7 @@ bool ForLoopIndexUseVisitor::TraverseArraySubscriptExpr(ArraySubscriptExpr *E) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief If we encounter a reference to IndexVar in an unpruned branch of the
|
||||
/// If we encounter a reference to IndexVar in an unpruned branch of the
|
||||
/// traversal, mark this loop as unconvertible.
|
||||
///
|
||||
/// This implements the whitelist for convertible loops: any usages of IndexVar
|
||||
@ -752,7 +752,7 @@ bool ForLoopIndexUseVisitor::VisitDeclRefExpr(DeclRefExpr *E) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief If the loop index is captured by a lambda, replace this capture
|
||||
/// If the loop index is captured by a lambda, replace this capture
|
||||
/// by the range-for loop variable.
|
||||
///
|
||||
/// For example:
|
||||
@ -792,7 +792,7 @@ bool ForLoopIndexUseVisitor::TraverseLambdaCapture(LambdaExpr *LE,
|
||||
return VisitorBase::TraverseLambdaCapture(LE, C, Init);
|
||||
}
|
||||
|
||||
/// \brief If we find that another variable is created just to refer to the loop
|
||||
/// If we find that another variable is created just to refer to the loop
|
||||
/// element, note it for reuse as the loop variable.
|
||||
///
|
||||
/// See the comments for isAliasDecl.
|
||||
@ -867,7 +867,7 @@ std::string VariableNamer::createIndexName() {
|
||||
return OldIndex->getName();
|
||||
}
|
||||
|
||||
/// \brief Determines whether or not the the name \a Symbol conflicts with
|
||||
/// Determines whether or not the the name \a Symbol conflicts with
|
||||
/// language keywords or defined macros. Also checks if the name exists in
|
||||
/// LoopContext, any of its parent contexts, or any of its child statements.
|
||||
///
|
||||
|
@ -48,14 +48,14 @@ typedef llvm::DenseMap<const clang::Stmt *, std::string>
|
||||
/// A vector used to store the AST subtrees of an Expr.
|
||||
typedef llvm::SmallVector<const clang::Expr *, 16> ComponentVector;
|
||||
|
||||
/// \brief Class used build the reverse AST properties needed to detect
|
||||
/// Class used build the reverse AST properties needed to detect
|
||||
/// name conflicts and free variables.
|
||||
class StmtAncestorASTVisitor
|
||||
: public clang::RecursiveASTVisitor<StmtAncestorASTVisitor> {
|
||||
public:
|
||||
StmtAncestorASTVisitor() { StmtStack.push_back(nullptr); }
|
||||
|
||||
/// \brief Run the analysis on the AST.
|
||||
/// Run the analysis on the AST.
|
||||
///
|
||||
/// In case we're running this analysis multiple times, don't repeat the work.
|
||||
void gatherAncestors(ASTContext &Ctx) {
|
||||
@ -116,7 +116,7 @@ public:
|
||||
: StmtParents(StmtParents), DeclParents(DeclParents),
|
||||
ContainingStmt(ContainingStmt), ReplacedVars(ReplacedVars) {}
|
||||
|
||||
/// \brief Run the analysis on Body, and return true iff the expression
|
||||
/// Run the analysis on Body, and return true iff the expression
|
||||
/// depends on some variable declared within ContainingStmt.
|
||||
///
|
||||
/// This is intended to protect against hoisting the container expression
|
||||
@ -200,7 +200,7 @@ private:
|
||||
bool VisitTypeLoc(clang::TypeLoc TL);
|
||||
};
|
||||
|
||||
/// \brief The information needed to describe a valid convertible usage
|
||||
/// The information needed to describe a valid convertible usage
|
||||
/// of an array index or iterator.
|
||||
struct Usage {
|
||||
enum UsageKind {
|
||||
@ -238,7 +238,7 @@ struct Usage {
|
||||
: Expression(E), Kind(Kind), Range(std::move(Range)) {}
|
||||
};
|
||||
|
||||
/// \brief A class to encapsulate lowering of the tool's confidence level.
|
||||
/// A class to encapsulate lowering of the tool's confidence level.
|
||||
class Confidence {
|
||||
public:
|
||||
enum Level {
|
||||
@ -251,15 +251,15 @@ public:
|
||||
// Transformations that will not change semantics.
|
||||
CL_Safe
|
||||
};
|
||||
/// \brief Initialize confidence level.
|
||||
/// Initialize confidence level.
|
||||
explicit Confidence(Confidence::Level Level) : CurrentLevel(Level) {}
|
||||
|
||||
/// \brief Lower the internal confidence level to Level, but do not raise it.
|
||||
/// Lower the internal confidence level to Level, but do not raise it.
|
||||
void lowerTo(Confidence::Level Level) {
|
||||
CurrentLevel = std::min(Level, CurrentLevel);
|
||||
}
|
||||
|
||||
/// \brief Return the internal confidence level.
|
||||
/// Return the internal confidence level.
|
||||
Level getLevel() const { return CurrentLevel; }
|
||||
|
||||
private:
|
||||
@ -275,7 +275,7 @@ bool areSameExpr(ASTContext *Context, const Expr *First, const Expr *Second);
|
||||
const DeclRefExpr *getDeclRef(const Expr *E);
|
||||
bool areSameVariable(const ValueDecl *First, const ValueDecl *Second);
|
||||
|
||||
/// \brief Discover usages of expressions consisting of index or iterator
|
||||
/// Discover usages of expressions consisting of index or iterator
|
||||
/// access.
|
||||
///
|
||||
/// Given an index variable, recursively crawls a for loop to discover if the
|
||||
@ -288,7 +288,7 @@ public:
|
||||
const Expr *ArrayBoundExpr,
|
||||
bool ContainerNeedsDereference);
|
||||
|
||||
/// \brief Finds all uses of IndexVar in Body, placing all usages in Usages,
|
||||
/// Finds all uses of IndexVar in Body, placing all usages in Usages,
|
||||
/// and returns true if IndexVar was only used in a way consistent with a
|
||||
/// range-based for loop.
|
||||
///
|
||||
@ -301,35 +301,35 @@ public:
|
||||
/// function and in overloaded operator[].
|
||||
bool findAndVerifyUsages(const Stmt *Body);
|
||||
|
||||
/// \brief Add a set of components that we should consider relevant to the
|
||||
/// Add a set of components that we should consider relevant to the
|
||||
/// container.
|
||||
void addComponents(const ComponentVector &Components);
|
||||
|
||||
/// \brief Accessor for Usages.
|
||||
/// Accessor for Usages.
|
||||
const UsageResult &getUsages() const { return Usages; }
|
||||
|
||||
/// \brief Adds the Usage if it was not added before.
|
||||
/// Adds the Usage if it was not added before.
|
||||
void addUsage(const Usage &U);
|
||||
|
||||
/// \brief Get the container indexed by IndexVar, if any.
|
||||
/// Get the container indexed by IndexVar, if any.
|
||||
const Expr *getContainerIndexed() const { return ContainerExpr; }
|
||||
|
||||
/// \brief Returns the statement declaring the variable created as an alias
|
||||
/// Returns the statement declaring the variable created as an alias
|
||||
/// for the loop element, if any.
|
||||
const DeclStmt *getAliasDecl() const { return AliasDecl; }
|
||||
|
||||
/// \brief Accessor for ConfidenceLevel.
|
||||
/// Accessor for ConfidenceLevel.
|
||||
Confidence::Level getConfidenceLevel() const {
|
||||
return ConfidenceLevel.getLevel();
|
||||
}
|
||||
|
||||
/// \brief Indicates if the alias declaration was in a place where it cannot
|
||||
/// Indicates if the alias declaration was in a place where it cannot
|
||||
/// simply be removed but rather replaced with a use of the alias variable.
|
||||
/// For example, variables declared in the condition of an if, switch, or for
|
||||
/// stmt.
|
||||
bool aliasUseRequired() const { return ReplaceWithAliasUse; }
|
||||
|
||||
/// \brief Indicates if the alias declaration came from the init clause of a
|
||||
/// Indicates if the alias declaration came from the init clause of a
|
||||
/// nested for loop. SourceRanges provided by Clang for DeclStmts in this
|
||||
/// case need to be adjusted.
|
||||
bool aliasFromForInit() const { return AliasFromForInit; }
|
||||
@ -351,7 +351,7 @@ private:
|
||||
bool VisitDeclStmt(DeclStmt *S);
|
||||
bool TraverseStmt(Stmt *S);
|
||||
|
||||
/// \brief Add an expression to the list of expressions on which the container
|
||||
/// Add an expression to the list of expressions on which the container
|
||||
/// expression depends.
|
||||
void addComponent(const Expr *E);
|
||||
|
||||
@ -376,7 +376,7 @@ private:
|
||||
/// The DeclStmt for an alias to the container element.
|
||||
const DeclStmt *AliasDecl;
|
||||
Confidence ConfidenceLevel;
|
||||
/// \brief A list of expressions on which ContainerExpr depends.
|
||||
/// A list of expressions on which ContainerExpr depends.
|
||||
///
|
||||
/// If any of these expressions are encountered outside of an acceptable usage
|
||||
/// of the loop element, lower our confidence level.
|
||||
@ -398,7 +398,7 @@ private:
|
||||
};
|
||||
|
||||
struct TUTrackingInfo {
|
||||
/// \brief Reset and initialize per-TU tracking information.
|
||||
/// Reset and initialize per-TU tracking information.
|
||||
///
|
||||
/// Must be called before using container accessors.
|
||||
TUTrackingInfo() : ParentFinder(new StmtAncestorASTVisitor) {}
|
||||
@ -413,7 +413,7 @@ private:
|
||||
ReplacedVarsMap ReplacedVars;
|
||||
};
|
||||
|
||||
/// \brief Create names for generated variables within a particular statement.
|
||||
/// Create names for generated variables within a particular statement.
|
||||
///
|
||||
/// VariableNamer uses a DeclContext as a reference point, checking for any
|
||||
/// conflicting declarations higher up in the context or within SourceStmt.
|
||||
@ -438,7 +438,7 @@ public:
|
||||
SourceStmt(SourceStmt), OldIndex(OldIndex), TheContainer(TheContainer),
|
||||
Context(Context), Style(Style) {}
|
||||
|
||||
/// \brief Generate a new index name.
|
||||
/// Generate a new index name.
|
||||
///
|
||||
/// Generates the name to be used for an inserted iterator. It relies on
|
||||
/// declarationExists() to determine that there are no naming conflicts, and
|
||||
|
@ -23,7 +23,7 @@ namespace tidy {
|
||||
namespace modernize {
|
||||
|
||||
namespace {
|
||||
/// \brief Matches move-constructible classes.
|
||||
/// Matches move-constructible classes.
|
||||
///
|
||||
/// Given
|
||||
/// \code
|
||||
@ -54,12 +54,12 @@ static TypeMatcher nonConstValueType() {
|
||||
return qualType(unless(anyOf(referenceType(), isConstQualified())));
|
||||
}
|
||||
|
||||
/// \brief Whether or not \p ParamDecl is used exactly one time in \p Ctor.
|
||||
/// Whether or not \p ParamDecl is used exactly one time in \p Ctor.
|
||||
///
|
||||
/// Checks both in the init-list and the body of the constructor.
|
||||
static bool paramReferredExactlyOnce(const CXXConstructorDecl *Ctor,
|
||||
const ParmVarDecl *ParamDecl) {
|
||||
/// \brief \c clang::RecursiveASTVisitor that checks that the given
|
||||
/// \c clang::RecursiveASTVisitor that checks that the given
|
||||
/// \c ParmVarDecl is used exactly one time.
|
||||
///
|
||||
/// \see ExactlyOneUsageVisitor::hasExactlyOneUsageIn()
|
||||
@ -71,7 +71,7 @@ static bool paramReferredExactlyOnce(const CXXConstructorDecl *Ctor,
|
||||
ExactlyOneUsageVisitor(const ParmVarDecl *ParamDecl)
|
||||
: ParamDecl(ParamDecl) {}
|
||||
|
||||
/// \brief Whether or not the parameter variable is referred only once in
|
||||
/// Whether or not the parameter variable is referred only once in
|
||||
/// the
|
||||
/// given constructor.
|
||||
bool hasExactlyOneUsageIn(const CXXConstructorDecl *Ctor) {
|
||||
@ -81,7 +81,7 @@ static bool paramReferredExactlyOnce(const CXXConstructorDecl *Ctor,
|
||||
}
|
||||
|
||||
private:
|
||||
/// \brief Counts the number of references to a variable.
|
||||
/// Counts the number of references to a variable.
|
||||
///
|
||||
/// Stops the AST traversal if more than one usage is found.
|
||||
bool VisitDeclRefExpr(DeclRefExpr *D) {
|
||||
@ -104,7 +104,7 @@ static bool paramReferredExactlyOnce(const CXXConstructorDecl *Ctor,
|
||||
return ExactlyOneUsageVisitor(ParamDecl).hasExactlyOneUsageIn(Ctor);
|
||||
}
|
||||
|
||||
/// \brief Find all references to \p ParamDecl across all of the
|
||||
/// Find all references to \p ParamDecl across all of the
|
||||
/// redeclarations of \p Ctor.
|
||||
static SmallVector<const ParmVarDecl *, 2>
|
||||
collectParamDecls(const CXXConstructorDecl *Ctor,
|
||||
|
@ -18,7 +18,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace modernize {
|
||||
|
||||
/// \brief Find and remove redundant void argument lists.
|
||||
/// Find and remove redundant void argument lists.
|
||||
///
|
||||
/// Examples:
|
||||
/// `int f(void);` becomes `int f();`
|
||||
|
@ -24,7 +24,7 @@ namespace {
|
||||
static const char AutoPtrTokenId[] = "AutoPrTokenId";
|
||||
static const char AutoPtrOwnershipTransferId[] = "AutoPtrOwnershipTransferId";
|
||||
|
||||
/// \brief Matches expressions that are lvalues.
|
||||
/// Matches expressions that are lvalues.
|
||||
///
|
||||
/// In the following example, a[0] matches expr(isLValue()):
|
||||
/// \code
|
||||
|
@ -55,7 +55,7 @@ size_t GetTypeNameLength(bool RemoveStars, StringRef Text) {
|
||||
return NumChars;
|
||||
}
|
||||
|
||||
/// \brief Matches variable declarations that have explicit initializers that
|
||||
/// Matches variable declarations that have explicit initializers that
|
||||
/// are not initializer lists.
|
||||
///
|
||||
/// Given
|
||||
@ -84,7 +84,7 @@ AST_MATCHER(VarDecl, hasWrittenNonListInitializer) {
|
||||
return Node.getInitStyle() != VarDecl::ListInit;
|
||||
}
|
||||
|
||||
/// \brief Matches QualTypes that are type sugar for QualTypes that match \c
|
||||
/// Matches QualTypes that are type sugar for QualTypes that match \c
|
||||
/// SugarMatcher.
|
||||
///
|
||||
/// Given
|
||||
@ -109,7 +109,7 @@ AST_MATCHER_P(QualType, isSugarFor, Matcher<QualType>, SugarMatcher) {
|
||||
}
|
||||
}
|
||||
|
||||
/// \brief Matches named declarations that have one of the standard iterator
|
||||
/// Matches named declarations that have one of the standard iterator
|
||||
/// names: iterator, reverse_iterator, const_iterator, const_reverse_iterator.
|
||||
///
|
||||
/// Given
|
||||
@ -131,7 +131,7 @@ AST_MATCHER(NamedDecl, hasStdIteratorName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Matches named declarations that have one of the standard container
|
||||
/// Matches named declarations that have one of the standard container
|
||||
/// names.
|
||||
///
|
||||
/// Given
|
||||
@ -207,7 +207,7 @@ AST_POLYMORPHIC_MATCHER(hasExplicitTemplateArgs,
|
||||
return Node.hasExplicitTemplateArgs();
|
||||
}
|
||||
|
||||
/// \brief Returns a DeclarationMatcher that matches standard iterators nested
|
||||
/// Returns a DeclarationMatcher that matches standard iterators nested
|
||||
/// inside records with a standard container name.
|
||||
DeclarationMatcher standardIterator() {
|
||||
return decl(
|
||||
@ -215,19 +215,19 @@ DeclarationMatcher standardIterator() {
|
||||
hasDeclContext(recordDecl(hasStdContainerName(), isFromStdNamespace())));
|
||||
}
|
||||
|
||||
/// \brief Returns a TypeMatcher that matches typedefs for standard iterators
|
||||
/// Returns a TypeMatcher that matches typedefs for standard iterators
|
||||
/// inside records with a standard container name.
|
||||
TypeMatcher typedefIterator() {
|
||||
return typedefType(hasDeclaration(standardIterator()));
|
||||
}
|
||||
|
||||
/// \brief Returns a TypeMatcher that matches records named for standard
|
||||
/// Returns a TypeMatcher that matches records named for standard
|
||||
/// iterators nested inside records named for standard containers.
|
||||
TypeMatcher nestedIterator() {
|
||||
return recordType(hasDeclaration(standardIterator()));
|
||||
}
|
||||
|
||||
/// \brief Returns a TypeMatcher that matches types declared with using
|
||||
/// Returns a TypeMatcher that matches types declared with using
|
||||
/// declarations and which name standard iterators for standard containers.
|
||||
TypeMatcher iteratorFromUsingDeclaration() {
|
||||
auto HasIteratorDecl = hasDeclaration(namedDecl(hasStdIteratorName()));
|
||||
@ -243,7 +243,7 @@ TypeMatcher iteratorFromUsingDeclaration() {
|
||||
anyOf(typedefType(HasIteratorDecl), recordType(HasIteratorDecl))));
|
||||
}
|
||||
|
||||
/// \brief This matcher returns declaration statements that contain variable
|
||||
/// This matcher returns declaration statements that contain variable
|
||||
/// declarations with written non-list initializer for standard iterators.
|
||||
StatementMatcher makeIteratorDeclMatcher() {
|
||||
return declStmt(unless(has(
|
||||
|
@ -19,7 +19,7 @@ namespace modernize {
|
||||
|
||||
static const char SpecialFunction[] = "SpecialFunction";
|
||||
|
||||
/// \brief Finds all the named non-static fields of \p Record.
|
||||
/// Finds all the named non-static fields of \p Record.
|
||||
static std::set<const FieldDecl *>
|
||||
getAllNamedFields(const CXXRecordDecl *Record) {
|
||||
std::set<const FieldDecl *> Result;
|
||||
@ -32,7 +32,7 @@ getAllNamedFields(const CXXRecordDecl *Record) {
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// \brief Returns the names of the direct bases of \p Record, both virtual and
|
||||
/// Returns the names of the direct bases of \p Record, both virtual and
|
||||
/// non-virtual.
|
||||
static std::set<const Type *> getAllDirectBases(const CXXRecordDecl *Record) {
|
||||
std::set<const Type *> Result;
|
||||
@ -44,7 +44,7 @@ static std::set<const Type *> getAllDirectBases(const CXXRecordDecl *Record) {
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// \brief Returns a matcher that matches member expressions where the base is
|
||||
/// Returns a matcher that matches member expressions where the base is
|
||||
/// the variable declared as \p Var and the accessed member is the one declared
|
||||
/// as \p Field.
|
||||
internal::Matcher<Expr> accessToFieldInVar(const FieldDecl *Field,
|
||||
@ -54,7 +54,7 @@ internal::Matcher<Expr> accessToFieldInVar(const FieldDecl *Field,
|
||||
member(fieldDecl(equalsNode(Field)))));
|
||||
}
|
||||
|
||||
/// \brief Check that the given constructor has copy signature and that it
|
||||
/// Check that the given constructor has copy signature and that it
|
||||
/// copy-initializes all its bases and members.
|
||||
static bool isCopyConstructorAndCanBeDefaulted(ASTContext *Context,
|
||||
const CXXConstructorDecl *Ctor) {
|
||||
@ -111,7 +111,7 @@ static bool isCopyConstructorAndCanBeDefaulted(ASTContext *Context,
|
||||
BasesToInit.size() + FieldsToInit.size();
|
||||
}
|
||||
|
||||
/// \brief Checks that the given method is an overloading of the assignment
|
||||
/// Checks that the given method is an overloading of the assignment
|
||||
/// operator, has copy signature, returns a reference to "*this" and copies
|
||||
/// all its members and subobjects.
|
||||
static bool isCopyAssignmentAndCanBeDefaulted(ASTContext *Context,
|
||||
@ -187,7 +187,7 @@ static bool isCopyAssignmentAndCanBeDefaulted(ASTContext *Context,
|
||||
return Compound->size() == BasesToInit.size() + FieldsToInit.size() + 1;
|
||||
}
|
||||
|
||||
/// \brief Returns false if the body has any non-whitespace character.
|
||||
/// Returns false if the body has any non-whitespace character.
|
||||
static bool bodyEmpty(const ASTContext *Context, const CompoundStmt *Body) {
|
||||
bool Invalid = false;
|
||||
StringRef Text = Lexer::getSourceText(
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace modernize {
|
||||
|
||||
/// \brief Replace default bodies of special member functions with '= default;'.
|
||||
/// Replace default bodies of special member functions with '= default;'.
|
||||
/// \code
|
||||
/// struct A {
|
||||
/// A() {}
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace modernize {
|
||||
|
||||
/// \brief Mark unimplemented private special member functions with '= delete'.
|
||||
/// Mark unimplemented private special member functions with '= delete'.
|
||||
/// \code
|
||||
/// struct A {
|
||||
/// private:
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace modernize {
|
||||
|
||||
/// \brief Add ``[[nodiscard]]`` to non-void const-member functions with no
|
||||
/// Add ``[[nodiscard]]`` to non-void const-member functions with no
|
||||
/// arguments or pass-by-value or pass by const-reference arguments.
|
||||
/// \code
|
||||
/// bool empty() const;
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace modernize {
|
||||
|
||||
/// \brief Replace dynamic exception specifications, with
|
||||
/// Replace dynamic exception specifications, with
|
||||
/// `noexcept` (or user-defined macro) or `noexcept(false)`.
|
||||
/// \code
|
||||
/// void foo() throw();
|
||||
|
@ -30,7 +30,7 @@ AST_MATCHER(Type, sugaredNullptrType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief 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
|
||||
/// to null within.
|
||||
/// Finding sequences of explict casts is necessary so that an entire sequence
|
||||
@ -52,7 +52,7 @@ bool isReplaceableRange(SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
return SM.isWrittenInSameFile(StartLoc, EndLoc);
|
||||
}
|
||||
|
||||
/// \brief Replaces the provided range with the text "nullptr", but only if
|
||||
/// Replaces the provided range with the text "nullptr", but only if
|
||||
/// the start and end location are both in main file.
|
||||
/// Returns true if and only if a replacement was made.
|
||||
void replaceWithNullptr(ClangTidyCheck &Check, SourceManager &SM,
|
||||
@ -67,7 +67,7 @@ void replaceWithNullptr(ClangTidyCheck &Check, SourceManager &SM,
|
||||
Range, NeedsSpace ? " nullptr" : "nullptr");
|
||||
}
|
||||
|
||||
/// \brief Returns the name of the outermost macro.
|
||||
/// Returns the name of the outermost macro.
|
||||
///
|
||||
/// Given
|
||||
/// \code
|
||||
@ -87,7 +87,7 @@ StringRef getOutermostMacroName(SourceLocation Loc, const SourceManager &SM,
|
||||
return Lexer::getImmediateMacroName(OutermostMacroLoc, SM, LO);
|
||||
}
|
||||
|
||||
/// \brief RecursiveASTVisitor for ensuring all nodes rooted at a given AST
|
||||
/// RecursiveASTVisitor for ensuring all nodes rooted at a given AST
|
||||
/// subtree that have file-level source locations corresponding to a macro
|
||||
/// argument have implicit NullTo(Member)Pointer nodes as ancestors.
|
||||
class MacroArgUsageVisitor : public RecursiveASTVisitor<MacroArgUsageVisitor> {
|
||||
@ -157,7 +157,7 @@ private:
|
||||
bool InvalidFound;
|
||||
};
|
||||
|
||||
/// \brief Looks for implicit casts as well as sequences of 0 or more explicit
|
||||
/// Looks for implicit casts as well as sequences of 0 or more explicit
|
||||
/// casts with an implicit null-to-pointer cast within.
|
||||
///
|
||||
/// The matcher this visitor is used with will find a single implicit cast or a
|
||||
@ -263,7 +263,7 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Tests that all expansions of a macro arg, one of which expands to
|
||||
/// Tests that all expansions of a macro arg, one of which expands to
|
||||
/// result in \p CE, yield NullTo(Member)Pointer casts.
|
||||
bool allArgUsesValid(const CastExpr *CE) {
|
||||
SourceLocation CastLoc = CE->getBeginLoc();
|
||||
@ -297,7 +297,7 @@ private:
|
||||
return !ArgUsageVisitor.foundInvalid();
|
||||
}
|
||||
|
||||
/// \brief Given the SourceLocation for a macro arg expansion, finds the
|
||||
/// Given the SourceLocation for a macro arg expansion, finds the
|
||||
/// non-macro SourceLocation of the macro the arg was passed to and the
|
||||
/// non-macro SourceLocation of the argument in the arg list to that macro.
|
||||
/// These results are returned via \c MacroLoc and \c ArgLoc respectively.
|
||||
@ -347,7 +347,7 @@ private:
|
||||
llvm_unreachable("getMacroAndArgLocations");
|
||||
}
|
||||
|
||||
/// \brief Tests if TestMacroLoc is found while recursively unravelling
|
||||
/// Tests if TestMacroLoc is found while recursively unravelling
|
||||
/// expansions starting at TestLoc. TestMacroLoc.isFileID() must be true.
|
||||
/// Implementation is very similar to getMacroAndArgLocations() except in this
|
||||
/// case, it's not assumed that TestLoc is expanded from a macro argument.
|
||||
@ -400,7 +400,7 @@ private:
|
||||
llvm_unreachable("expandsFrom");
|
||||
}
|
||||
|
||||
/// \brief Given a starting point \c Start in the AST, find an ancestor that
|
||||
/// Given a starting point \c Start in the AST, find an ancestor that
|
||||
/// doesn't expand from the macro called at file location \c MacroLoc.
|
||||
///
|
||||
/// \pre MacroLoc.isFileID()
|
||||
|
@ -19,7 +19,7 @@ namespace objc {
|
||||
|
||||
namespace {
|
||||
|
||||
/// \brief Matches Objective-C methods in the initializer family.
|
||||
/// Matches Objective-C methods in the initializer family.
|
||||
///
|
||||
/// Example matches -init and -initWithInt:.
|
||||
/// (matcher = objcMethodDecl(isInitializer()))
|
||||
@ -35,7 +35,7 @@ AST_MATCHER(ObjCMethodDecl, isInitializer) {
|
||||
return Node.getMethodFamily() == OMF_init;
|
||||
}
|
||||
|
||||
/// \brief Matches Objective-C implementations with interfaces that match
|
||||
/// Matches Objective-C implementations with interfaces that match
|
||||
/// \c Base.
|
||||
///
|
||||
/// Example matches implementation declarations for X.
|
||||
@ -56,7 +56,7 @@ AST_MATCHER_P(ObjCImplementationDecl, hasInterface,
|
||||
return Base.matches(*InterfaceDecl, Finder, Builder);
|
||||
}
|
||||
|
||||
/// \brief Matches Objective-C message expressions where the receiver is the
|
||||
/// Matches Objective-C message expressions where the receiver is the
|
||||
/// super instance.
|
||||
///
|
||||
/// Example matches the invocations of -banana and -orange.
|
||||
|
@ -17,7 +17,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace performance {
|
||||
|
||||
/// \brief A check that flags value parameters of expensive to copy types that
|
||||
/// A check that flags value parameters of expensive to copy types that
|
||||
/// can safely be converted to const references.
|
||||
///
|
||||
/// For the user-facing documentation see:
|
||||
|
@ -91,7 +91,7 @@ void ConvertMemberFunctionsToStatic::registerMatchers(MatchFinder *Finder) {
|
||||
this);
|
||||
}
|
||||
|
||||
/// \brief Obtain the original source code text from a SourceRange.
|
||||
/// Obtain the original source code text from a SourceRange.
|
||||
static StringRef getStringFromRange(SourceManager &SourceMgr,
|
||||
const LangOptions &LangOpts,
|
||||
SourceRange Range) {
|
||||
|
@ -64,20 +64,20 @@ public:
|
||||
std::string Suffix;
|
||||
};
|
||||
|
||||
/// \brief 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 usages.
|
||||
struct NamingCheckFailure {
|
||||
std::string KindName;
|
||||
std::string Fixup;
|
||||
|
||||
/// \brief Whether the failure should be fixed or not.
|
||||
/// Whether the failure should be fixed or not.
|
||||
///
|
||||
/// ie: if the identifier was used or declared within a macro we won't offer
|
||||
/// a fixup for safety reasons.
|
||||
bool ShouldFix;
|
||||
|
||||
/// \brief A set of all the identifier usages starting SourceLocation, in
|
||||
/// A set of all the identifier usages starting SourceLocation, in
|
||||
/// their encoded form.
|
||||
llvm::DenseSet<unsigned> RawUsageLocs;
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace readability {
|
||||
|
||||
/// \brief Checks for use of implicit bool conversions in expressions.
|
||||
/// Checks for use of implicit bool conversions in expressions.
|
||||
///
|
||||
/// For the user-facing documentation see:
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/readability-implicit-bool-conversion.html
|
||||
|
@ -17,7 +17,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace readability {
|
||||
|
||||
/// \brief Checks for declarations of functions which differ in parameter names.
|
||||
/// Checks for declarations of functions which differ in parameter names.
|
||||
///
|
||||
/// For detailed documentation see:
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.html
|
||||
|
@ -15,7 +15,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace readability {
|
||||
|
||||
/// \@brief Checks for member expressions that access static members through
|
||||
/// Checks for member expressions that access static members through
|
||||
/// instances and replaces them with uses of the appropriate qualified-id.
|
||||
///
|
||||
/// For the user-facing documentation see:
|
||||
|
@ -18,7 +18,7 @@ namespace tidy {
|
||||
namespace utils {
|
||||
namespace decl_ref_expr {
|
||||
|
||||
/// \brief Returns true if all ``DeclRefExpr`` to the variable within ``Stmt``
|
||||
/// Returns true if all ``DeclRefExpr`` to the variable within ``Stmt``
|
||||
/// do not modify it.
|
||||
///
|
||||
/// Returns ``true`` if only const methods or operators are called on the
|
||||
|
@ -17,10 +17,10 @@ namespace tidy {
|
||||
namespace utils {
|
||||
namespace fixit {
|
||||
|
||||
/// \brief Creates fix to make ``VarDecl`` a reference by adding ``&``.
|
||||
/// Creates fix to make ``VarDecl`` a reference by adding ``&``.
|
||||
FixItHint changeVarDeclToReference(const VarDecl &Var, ASTContext &Context);
|
||||
|
||||
/// \brief Creates fix to make ``VarDecl`` const qualified.
|
||||
/// Creates fix to make ``VarDecl`` const qualified.
|
||||
FixItHint changeVarDeclToConst(const VarDecl &Var);
|
||||
|
||||
} // namespace fixit
|
||||
|
@ -20,31 +20,31 @@ namespace utils {
|
||||
|
||||
typedef llvm::SmallSet<llvm::StringRef, 5> HeaderFileExtensionsSet;
|
||||
|
||||
/// \brief Checks whether expansion location of \p Loc is in header file.
|
||||
/// Checks whether expansion location of \p Loc is in header file.
|
||||
bool isExpansionLocInHeaderFile(
|
||||
SourceLocation Loc, const SourceManager &SM,
|
||||
const HeaderFileExtensionsSet &HeaderFileExtensions);
|
||||
|
||||
/// \brief Checks whether presumed location of \p Loc is in header file.
|
||||
/// Checks whether presumed location of \p Loc is in header file.
|
||||
bool isPresumedLocInHeaderFile(
|
||||
SourceLocation Loc, SourceManager &SM,
|
||||
const HeaderFileExtensionsSet &HeaderFileExtensions);
|
||||
|
||||
/// \brief Checks whether spelling location of \p Loc is in header file.
|
||||
/// Checks whether spelling location of \p Loc is in header file.
|
||||
bool isSpellingLocInHeaderFile(
|
||||
SourceLocation Loc, SourceManager &SM,
|
||||
const HeaderFileExtensionsSet &HeaderFileExtensions);
|
||||
|
||||
/// \brief Returns recommended default value for the list of header file
|
||||
/// Returns recommended default value for the list of header file
|
||||
/// extensions.
|
||||
inline StringRef defaultHeaderFileExtensions() { return ",h,hh,hpp,hxx"; }
|
||||
|
||||
/// \brief Parses header file extensions from a semicolon-separated list.
|
||||
/// Parses header file extensions from a semicolon-separated list.
|
||||
bool parseHeaderFileExtensions(StringRef AllHeaderFileExtensions,
|
||||
HeaderFileExtensionsSet &HeaderFileExtensions,
|
||||
char delimiter);
|
||||
|
||||
/// \brief Decides whether a file has a header file extension.
|
||||
/// Decides whether a file has a header file extension.
|
||||
bool isHeaderFileExtension(StringRef FileName,
|
||||
const HeaderFileExtensionsSet &HeaderFileExtensions);
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace utils {
|
||||
|
||||
/// \brief canonicalize a path by removing ./ and ../ components.
|
||||
/// canonicalize a path by removing ./ and ../ components.
|
||||
static std::string cleanPath(StringRef Path) {
|
||||
SmallString<256> Result = Path;
|
||||
llvm::sys::path::remove_dots(Result, true);
|
||||
@ -159,7 +159,7 @@ public:
|
||||
(EndIfStr != "/* " + HeaderGuard.str() + " */");
|
||||
}
|
||||
|
||||
/// \brief Look for header guards that don't match the preferred style. Emit
|
||||
/// Look for header guards that don't match the preferred style. Emit
|
||||
/// fix-its and return the suggested header guard (or the original if no
|
||||
/// change was made.
|
||||
std::string checkHeaderGuardDefinition(SourceLocation Ifndef,
|
||||
@ -189,7 +189,7 @@ public:
|
||||
return CurHeaderGuard;
|
||||
}
|
||||
|
||||
/// \brief Checks the comment after the #endif of a header guard and fixes it
|
||||
/// Checks the comment after the #endif of a header guard and fixes it
|
||||
/// if it doesn't match \c HeaderGuard.
|
||||
void checkEndifComment(StringRef FileName, SourceLocation EndIf,
|
||||
StringRef HeaderGuard,
|
||||
@ -203,7 +203,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/// \brief Looks for files that were visited but didn't have a header guard.
|
||||
/// Looks for files that were visited but didn't have a header guard.
|
||||
/// Emits a warning with fixits suggesting adding one.
|
||||
void checkGuardlessHeaders() {
|
||||
// Look for header files that didn't have a header guard. Emit a warning and
|
||||
|
@ -21,7 +21,7 @@ namespace clang {
|
||||
namespace tidy {
|
||||
namespace utils {
|
||||
|
||||
/// \brief Produces fixes to insert specified includes to source files, if not
|
||||
/// Produces fixes to insert specified includes to source files, if not
|
||||
/// yet present.
|
||||
///
|
||||
/// ``IncludeInserter`` can be used in clang-tidy checks in the following way:
|
||||
|
@ -16,10 +16,10 @@ namespace tidy {
|
||||
namespace utils {
|
||||
namespace options {
|
||||
|
||||
/// \brief Parse a semicolon separated list of strings.
|
||||
/// Parse a semicolon separated list of strings.
|
||||
std::vector<std::string> parseStringList(StringRef Option);
|
||||
|
||||
/// \brief Serialize a sequence of names that can be parsed by
|
||||
/// Serialize a sequence of names that can be parsed by
|
||||
/// ``parseStringList``.
|
||||
std::string serializeStringList(ArrayRef<std::string> Strings);
|
||||
|
||||
|
@ -26,7 +26,7 @@ inline llvm::Error make_string_error(const llvm::Twine &Message) {
|
||||
llvm::inconvertibleErrorCode());
|
||||
}
|
||||
|
||||
/// \brief This manages file paths in the file system. All paths in the scheme
|
||||
/// This manages file paths in the file system. All paths in the scheme
|
||||
/// are absolute (with leading '/').
|
||||
/// Note that this scheme is hardcoded into the library and not registered in
|
||||
/// registry.
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief This file implements a function that runs clangd on a single input.
|
||||
/// This file implements a function that runs clangd on a single input.
|
||||
/// This function is then linked into the Fuzzer library.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -24,10 +24,10 @@ namespace clang {
|
||||
namespace clangd {
|
||||
|
||||
struct FuzzyFindRequest {
|
||||
/// \brief A query string for the fuzzy find. This is matched against symbols'
|
||||
/// A query string for the fuzzy find. This is matched against symbols'
|
||||
/// un-qualified identifiers and should not contain qualifiers like "::".
|
||||
std::string Query;
|
||||
/// \brief If this is non-empty, symbols must be in at least one of the scopes
|
||||
/// If this is non-empty, symbols must be in at least one of the scopes
|
||||
/// (e.g. namespaces) excluding nested scopes. For example, if a scope "xyz::"
|
||||
/// is provided, the matched symbols must be defined in namespace xyz but not
|
||||
/// namespace xyz::abc.
|
||||
@ -37,7 +37,7 @@ struct FuzzyFindRequest {
|
||||
/// If set to true, allow symbols from any scope. Scopes explicitly listed
|
||||
/// above will be ranked higher.
|
||||
bool AnyScope = false;
|
||||
/// \brief The number of top candidates to return. The index may choose to
|
||||
/// The number of top candidates to return. The index may choose to
|
||||
/// return more than this, e.g. if it doesn't know which candidates are best.
|
||||
llvm::Optional<uint32_t> Limit;
|
||||
/// If set to true, only symbols for completion support will be considered.
|
||||
@ -86,7 +86,7 @@ class SymbolIndex {
|
||||
public:
|
||||
virtual ~SymbolIndex() = default;
|
||||
|
||||
/// \brief Matches symbols in the index fuzzily and applies \p Callback on
|
||||
/// Matches symbols in the index fuzzily and applies \p Callback on
|
||||
/// each matched symbol before returning.
|
||||
/// If returned Symbols are used outside Callback, they must be deep-copied!
|
||||
///
|
||||
|
@ -25,7 +25,7 @@
|
||||
namespace clang {
|
||||
namespace clangd {
|
||||
|
||||
/// \brief Collect declarations (symbols) from an AST.
|
||||
/// Collect declarations (symbols) from an AST.
|
||||
/// It collects most declarations except:
|
||||
/// - Implicit declarations
|
||||
/// - Anonymous declarations (anonymous enum/class/struct, etc)
|
||||
|
@ -374,7 +374,7 @@ opt<bool> PrettyPrint{
|
||||
init(false),
|
||||
};
|
||||
|
||||
/// \brief Supports a test URI scheme with relaxed constraints for lit tests.
|
||||
/// Supports a test URI scheme with relaxed constraints for lit tests.
|
||||
/// The path in a test URI will be combined with a platform-specific fake
|
||||
/// directory to form an absolute path. For example, test:///a.cpp is resolved
|
||||
/// C:\clangd-test\a.cpp on Windows and /clangd-test/a.cpp on Unix.
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===--------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief Definitions for CoverageChecker.
|
||||
/// Definitions for CoverageChecker.
|
||||
///
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===--------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief Common definitions for Modularize.
|
||||
/// Common definitions for Modularize.
|
||||
///
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
@ -41,7 +41,7 @@ typedef llvm::StringMap<DependentsVector> DependencyMap;
|
||||
/// \param HeaderPrefix Tells the code where the headers are, if they
|
||||
/// aren's in the current directory, allowing the generator to strip
|
||||
/// the leading, non-relative beginning of the header paths.
|
||||
/// \brief RootModuleName If not empty, specifies that a root module
|
||||
/// RootModuleName If not empty, specifies that a root module
|
||||
/// should be created with this name.
|
||||
/// \returns True if successful.
|
||||
bool createModuleMap(llvm::StringRef ModuleMapPath,
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===--------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief ModularizeUtilities class definition.
|
||||
/// ModularizeUtilities class definition.
|
||||
///
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===--------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief Macro expansions and preprocessor conditional consistency checker.
|
||||
/// Macro expansions and preprocessor conditional consistency checker.
|
||||
///
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
namespace Modularize {
|
||||
|
||||
/// \brief Preprocessor tracker for modularize.
|
||||
/// Preprocessor tracker for modularize.
|
||||
///
|
||||
/// The PreprocessorTracker class defines an API for
|
||||
/// checking macro expansions and preprocessor conditional expressions
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief Implementations for preprocessor tracking.
|
||||
/// Implementations for preprocessor tracking.
|
||||
///
|
||||
/// See the header for details.
|
||||
///
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief Classes and definitions for preprocessor tracking.
|
||||
/// Classes and definitions for preprocessor tracking.
|
||||
///
|
||||
/// The core definition is the PPCallbacksTracker class, derived from Clang's
|
||||
/// PPCallbacks class from the Lex library, which overrides all the callbacks
|
||||
@ -41,7 +41,7 @@ struct Argument {
|
||||
std::string Value;
|
||||
};
|
||||
|
||||
/// \brief This class represents one callback call by name and an array
|
||||
/// This class represents one callback call by name and an array
|
||||
/// of arguments.
|
||||
class CallbackCall {
|
||||
public:
|
||||
@ -54,7 +54,7 @@ public:
|
||||
|
||||
using FilterType = std::vector<std::pair<llvm::GlobPattern, bool>>;
|
||||
|
||||
/// \brief This class overrides the PPCallbacks class for tracking preprocessor
|
||||
/// This class overrides the PPCallbacks class for tracking preprocessor
|
||||
/// activity by means of its callback functions.
|
||||
///
|
||||
/// This object is given a vector for storing the trace information, built up
|
||||
@ -73,7 +73,7 @@ using FilterType = std::vector<std::pair<llvm::GlobPattern, bool>>;
|
||||
/// and the recorded data structure.
|
||||
class PPCallbacksTracker : public PPCallbacks {
|
||||
public:
|
||||
/// \brief Note that all of the arguments are references, and owned
|
||||
/// Note that all of the arguments are references, and owned
|
||||
/// by the caller.
|
||||
/// \param Filters - List of (Glob,Enabled) pairs used to filter callbacks.
|
||||
/// \param CallbackCalls - Trace buffer.
|
||||
@ -149,76 +149,76 @@ public:
|
||||
|
||||
// Helper functions.
|
||||
|
||||
/// \brief Start a new callback.
|
||||
/// Start a new callback.
|
||||
void beginCallback(const char *Name);
|
||||
|
||||
/// \brief Append a string to the top trace item.
|
||||
/// Append a string to the top trace item.
|
||||
void append(const char *Str);
|
||||
|
||||
/// \brief Append a bool argument to the top trace item.
|
||||
/// Append a bool argument to the top trace item.
|
||||
void appendArgument(const char *Name, bool Value);
|
||||
|
||||
/// \brief Append an int argument to the top trace item.
|
||||
/// Append an int argument to the top trace item.
|
||||
void appendArgument(const char *Name, int Value);
|
||||
|
||||
/// \brief Append a string argument to the top trace item.
|
||||
/// Append a string argument to the top trace item.
|
||||
void appendArgument(const char *Name, const char *Value);
|
||||
|
||||
/// \brief Append a string reference object argument to the top trace item.
|
||||
/// Append a string reference object argument to the top trace item.
|
||||
void appendArgument(const char *Name, llvm::StringRef Value);
|
||||
|
||||
/// \brief Append a string object argument to the top trace item.
|
||||
/// Append a string object argument to the top trace item.
|
||||
void appendArgument(const char *Name, const std::string &Value);
|
||||
|
||||
/// \brief Append a token argument to the top trace item.
|
||||
/// Append a token argument to the top trace item.
|
||||
void appendArgument(const char *Name, const Token &Value);
|
||||
|
||||
/// \brief Append an enum argument to the top trace item.
|
||||
/// Append an enum argument to the top trace item.
|
||||
void appendArgument(const char *Name, int Value, const char *const Strings[]);
|
||||
|
||||
/// \brief Append a FileID argument to the top trace item.
|
||||
/// Append a FileID argument to the top trace item.
|
||||
void appendArgument(const char *Name, FileID Value);
|
||||
|
||||
/// \brief Append a FileEntry argument to the top trace item.
|
||||
/// Append a FileEntry argument to the top trace item.
|
||||
void appendArgument(const char *Name, const FileEntry *Value);
|
||||
|
||||
/// \brief Append a SourceLocation argument to the top trace item.
|
||||
/// Append a SourceLocation argument to the top trace item.
|
||||
void appendArgument(const char *Name, SourceLocation Value);
|
||||
|
||||
/// \brief Append a SourceRange argument to the top trace item.
|
||||
/// Append a SourceRange argument to the top trace item.
|
||||
void appendArgument(const char *Name, SourceRange Value);
|
||||
|
||||
/// \brief Append a CharSourceRange argument to the top trace item.
|
||||
/// Append a CharSourceRange argument to the top trace item.
|
||||
void appendArgument(const char *Name, CharSourceRange Value);
|
||||
|
||||
/// \brief Append a ModuleIdPath argument to the top trace item.
|
||||
/// Append a ModuleIdPath argument to the top trace item.
|
||||
void appendArgument(const char *Name, ModuleIdPath Value);
|
||||
|
||||
/// \brief Append an IdentifierInfo argument to the top trace item.
|
||||
/// Append an IdentifierInfo argument to the top trace item.
|
||||
void appendArgument(const char *Name, const IdentifierInfo *Value);
|
||||
|
||||
/// \brief Append a MacroDirective argument to the top trace item.
|
||||
/// Append a MacroDirective argument to the top trace item.
|
||||
void appendArgument(const char *Name, const MacroDirective *Value);
|
||||
|
||||
/// \brief Append a MacroDefinition argument to the top trace item.
|
||||
/// Append a MacroDefinition argument to the top trace item.
|
||||
void appendArgument(const char *Name, const MacroDefinition &Value);
|
||||
|
||||
/// \brief Append a MacroArgs argument to the top trace item.
|
||||
/// Append a MacroArgs argument to the top trace item.
|
||||
void appendArgument(const char *Name, const MacroArgs *Value);
|
||||
|
||||
/// \brief Append a Module argument to the top trace item.
|
||||
/// Append a Module argument to the top trace item.
|
||||
void appendArgument(const char *Name, const Module *Value);
|
||||
|
||||
/// \brief Append a double-quoted argument to the top trace item.
|
||||
/// Append a double-quoted argument to the top trace item.
|
||||
void appendQuotedArgument(const char *Name, const std::string &Value);
|
||||
|
||||
/// \brief Append a double-quoted file path argument to the top trace item.
|
||||
/// Append a double-quoted file path argument to the top trace item.
|
||||
void appendFilePathArgument(const char *Name, llvm::StringRef Value);
|
||||
|
||||
/// \brief Get the raw source string of the range.
|
||||
/// Get the raw source string of the range.
|
||||
llvm::StringRef getSourceString(CharSourceRange Range);
|
||||
|
||||
/// \brief Callback trace information.
|
||||
/// Callback trace information.
|
||||
/// We use a reference so the trace will be preserved for the caller
|
||||
/// after this object is destructed.
|
||||
std::vector<CallbackCall> &CallbackCalls;
|
||||
@ -229,7 +229,7 @@ public:
|
||||
// Whether a callback should be printed.
|
||||
llvm::StringMap<bool> CallbackIsEnabled;
|
||||
|
||||
/// \brief Inhibit trace while this is set.
|
||||
/// Inhibit trace while this is set.
|
||||
bool DisableTrace;
|
||||
|
||||
Preprocessor &PP;
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \brief This file defines an utility class for tests that needs a source
|
||||
/// This file defines an utility class for tests that needs a source
|
||||
/// manager for a virtual file with customizable content.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
namespace clang {
|
||||
|
||||
/// \brief Class that provides easy access to a SourceManager and that allows to
|
||||
/// Class that provides easy access to a SourceManager and that allows to
|
||||
/// map virtual files conveniently.
|
||||
class VirtualFileHelper {
|
||||
struct VirtualFile {
|
||||
@ -38,13 +38,13 @@ public:
|
||||
DiagnosticPrinter(llvm::outs(), &*DiagOpts),
|
||||
Files((FileSystemOptions())) {}
|
||||
|
||||
/// \brief Create a virtual file \p FileName, with content \p Code.
|
||||
/// Create a virtual file \p FileName, with content \p Code.
|
||||
void mapFile(llvm::StringRef FileName, llvm::StringRef Code) {
|
||||
VirtualFile VF = { FileName, Code };
|
||||
VirtualFiles.push_back(VF);
|
||||
}
|
||||
|
||||
/// \brief Create a new \c SourceManager with the virtual files and contents
|
||||
/// Create a new \c SourceManager with the virtual files and contents
|
||||
/// mapped to it.
|
||||
SourceManager &getNewSourceManager() {
|
||||
Sources.reset(new SourceManager(Diagnostics, Files));
|
||||
@ -52,7 +52,7 @@ public:
|
||||
return *Sources;
|
||||
}
|
||||
|
||||
/// \brief Map the virtual file contents in the given \c SourceManager.
|
||||
/// Map the virtual file contents in the given \c SourceManager.
|
||||
void mapVirtualFiles(SourceManager &SM) const {
|
||||
for (llvm::SmallVectorImpl<VirtualFile>::const_iterator
|
||||
I = VirtualFiles.begin(),
|
||||
|
Loading…
Reference in New Issue
Block a user