1717#include " clang/Tooling/Refactoring.h"
1818#include " llvm/ADT/DenseMap.h"
1919#include " llvm/ADT/StringMap.h"
20- #include " llvm/Support/Regex.h"
2120#include " llvm/Support/Timer.h"
2221
2322namespace clang {
@@ -33,7 +32,7 @@ class CompilationDatabase;
3332
3433namespace tidy {
3534
36- // / \brief A detected error complete with information to display diagnostic and
35+ // / A detected error complete with information to display diagnostic and
3736// / automatic fix.
3837// /
3938// / This is used as an intermediate format to transport Diagnostics without a
@@ -47,28 +46,7 @@ struct ClangTidyError : tooling::Diagnostic {
4746 bool IsWarningAsError;
4847};
4948
50- // / \brief Read-only set of strings represented as a list of positive and
51- // / negative globs. Positive globs add all matched strings to the set, negative
52- // / globs remove them in the order of appearance in the list.
53- class GlobList {
54- public:
55- // / \brief \p GlobList is a comma-separated list of globs (only '*'
56- // / metacharacter is supported) with optional '-' prefix to denote exclusion.
57- GlobList (StringRef Globs);
58-
59- // / \brief Returns \c true if the pattern matches \p S. The result is the last
60- // / matching glob's Positive flag.
61- bool contains (StringRef S) { return contains (S, false ); }
62-
63- private:
64- bool contains (StringRef S, bool Contains);
65-
66- bool Positive;
67- llvm::Regex Regex;
68- std::unique_ptr<GlobList> NextGlob;
69- };
70-
71- // / \brief Contains displayed and ignored diagnostic counters for a ClangTidy
49+ // / Contains displayed and ignored diagnostic counters for a ClangTidy
7250// / run.
7351struct ClangTidyStats {
7452 ClangTidyStats ()
@@ -87,7 +65,7 @@ struct ClangTidyStats {
8765 }
8866};
8967
90- // / \brief Every \c ClangTidyCheck reports errors through a \c DiagnosticsEngine
68+ // / Every \c ClangTidyCheck reports errors through a \c DiagnosticsEngine
9169// / provided by this context.
9270// /
9371// / A \c ClangTidyCheck always has access to the active context to report
@@ -98,7 +76,7 @@ struct ClangTidyStats {
9876// / \endcode
9977class ClangTidyContext {
10078public:
101- // / \brief Initializes \c ClangTidyContext instance.
79+ // / Initializes \c ClangTidyContext instance.
10280 ClangTidyContext (std::unique_ptr<ClangTidyOptionsProvider> OptionsProvider,
10381 bool AllowEnablingAnalyzerAlphaCheckers = false );
10482 // / Sets the DiagnosticsEngine that diag() will emit diagnostics to.
@@ -110,7 +88,7 @@ class ClangTidyContext {
11088
11189 ~ClangTidyContext ();
11290
113- // / \brief Report any errors detected using this method.
91+ // / Report any errors detected using this method.
11492 // /
11593 // / This is still under heavy development and will likely change towards using
11694 // / tablegen'd diagnostic IDs.
@@ -119,72 +97,72 @@ class ClangTidyContext {
11997 StringRef Message,
12098 DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
12199
122- // / \brief Sets the \c SourceManager of the used \c DiagnosticsEngine.
100+ // / Sets the \c SourceManager of the used \c DiagnosticsEngine.
123101 // /
124102 // / This is called from the \c ClangTidyCheck base class.
125103 void setSourceManager (SourceManager *SourceMgr);
126104
127- // / \brief Should be called when starting to process new translation unit.
105+ // / Should be called when starting to process new translation unit.
128106 void setCurrentFile (StringRef File);
129107
130- // / \brief Returns the main file name of the current translation unit.
108+ // / Returns the main file name of the current translation unit.
131109 StringRef getCurrentFile () const { return CurrentFile; }
132110
133- // / \brief Sets ASTContext for the current translation unit.
111+ // / Sets ASTContext for the current translation unit.
134112 void setASTContext (ASTContext *Context);
135113
136- // / \brief Gets the language options from the AST context.
114+ // / Gets the language options from the AST context.
137115 const LangOptions &getLangOpts () const { return LangOpts; }
138116
139- // / \brief Returns the name of the clang-tidy check which produced this
117+ // / Returns the name of the clang-tidy check which produced this
140118 // / diagnostic ID.
141119 std::string getCheckName (unsigned DiagnosticID) const ;
142120
143- // / \brief Returns \c true if the check is enabled for the \c CurrentFile.
121+ // / Returns \c true if the check is enabled for the \c CurrentFile.
144122 // /
145123 // / The \c CurrentFile can be changed using \c setCurrentFile.
146124 bool isCheckEnabled (StringRef CheckName) const ;
147125
148- // / \brief Returns \c true if the check should be upgraded to error for the
126+ // / Returns \c true if the check should be upgraded to error for the
149127 // / \c CurrentFile.
150128 bool treatAsError (StringRef CheckName) const ;
151129
152- // / \brief Returns global options.
130+ // / Returns global options.
153131 const ClangTidyGlobalOptions &getGlobalOptions () const ;
154132
155- // / \brief Returns options for \c CurrentFile.
133+ // / Returns options for \c CurrentFile.
156134 // /
157135 // / The \c CurrentFile can be changed using \c setCurrentFile.
158136 const ClangTidyOptions &getOptions () const ;
159137
160- // / \brief Returns options for \c File. Does not change or depend on
138+ // / Returns options for \c File. Does not change or depend on
161139 // / \c CurrentFile.
162140 ClangTidyOptions getOptionsForFile (StringRef File) const ;
163141
164- // / \brief Returns \c ClangTidyStats containing issued and ignored diagnostic
142+ // / Returns \c ClangTidyStats containing issued and ignored diagnostic
165143 // / counters.
166144 const ClangTidyStats &getStats () const { return Stats; }
167145
168- // / \brief Control profile collection in clang-tidy.
146+ // / Control profile collection in clang-tidy.
169147 void setEnableProfiling (bool Profile);
170148 bool getEnableProfiling () const { return Profile; }
171149
172- // / \brief Control storage of profile date.
150+ // / Control storage of profile date.
173151 void setProfileStoragePrefix (StringRef ProfilePrefix);
174152 llvm::Optional<ClangTidyProfiling::StorageParams>
175153 getProfileStorageParams () const ;
176154
177- // / \brief Should be called when starting to process new translation unit.
155+ // / Should be called when starting to process new translation unit.
178156 void setCurrentBuildDirectory (StringRef BuildDirectory) {
179157 CurrentBuildDirectory = BuildDirectory;
180158 }
181159
182- // / \brief Returns build directory of the current translation unit.
160+ // / Returns build directory of the current translation unit.
183161 const std::string &getCurrentBuildDirectory () {
184162 return CurrentBuildDirectory;
185163 }
186164
187- // / \brief If the experimental alpha checkers from the static analyzer can be
165+ // / If the experimental alpha checkers from the static analyzer can be
188166 // / enabled.
189167 bool canEnableAnalyzerAlphaCheckers () const {
190168 return AllowEnablingAnalyzerAlphaCheckers;
@@ -239,11 +217,11 @@ class ClangTidyContext {
239217// / examining source files other than the one in which the diagnostic is
240218// / located, and in some use cases we cannot rely on such other files being
241219// / mapped in the SourceMapper.
242- bool ShouldSuppressDiagnostic (DiagnosticsEngine::Level DiagLevel,
220+ bool shouldSuppressDiagnostic (DiagnosticsEngine::Level DiagLevel,
243221 const Diagnostic &Info, ClangTidyContext &Context,
244222 bool CheckMacroExpansion = true );
245223
246- // / \brief A diagnostic consumer that turns each \c Diagnostic into a
224+ // / A diagnostic consumer that turns each \c Diagnostic into a
247225// / \c SourceManager-independent \c ClangTidyError.
248226//
249227// FIXME: If we move away from unit-tests, this can be moved to a private
@@ -267,11 +245,11 @@ class ClangTidyDiagnosticConsumer : public DiagnosticConsumer {
267245 void finalizeLastError ();
268246 void removeIncompatibleErrors ();
269247
270- // / \brief Returns the \c HeaderFilter constructed for the options set in the
248+ // / Returns the \c HeaderFilter constructed for the options set in the
271249 // / context.
272250 llvm::Regex *getHeaderFilter ();
273251
274- // / \brief Updates \c LastErrorRelatesToUserCode and LastErrorPassesLineFilter
252+ // / Updates \c LastErrorRelatesToUserCode and LastErrorPassesLineFilter
275253 // / according to the diagnostic \p Location.
276254 void checkFilters (SourceLocation Location, const SourceManager &Sources);
277255 bool passesLineFilter (StringRef FileName, unsigned LineNumber) const ;
0 commit comments