summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h')
-rw-r--r--clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
index 250dc361ff7..e72ae4e29d4 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
@@ -65,6 +65,24 @@ public:
std::string Suffix;
};
+ /// This enum will be used in %select of the diagnostic message.
+ /// Each value below IgnoreFailureThreshold should have an error message.
+ enum class ShouldFixStatus {
+ ShouldFix,
+ ConflictsWithKeyword, /// The fixup will conflict with a language keyword,
+ /// so we can't fix it automatically.
+ ConflictsWithMacroDefinition, /// The fixup will conflict with a macro
+ /// definition, so we can't fix it
+ /// automatically.
+
+ /// Values pass this threshold will be ignored completely
+ /// i.e no message, no fixup.
+ IgnoreFailureThreshold,
+
+ InsideMacro, /// If the identifier was used or declared within a macro we
+ /// won't offer a fixup for safety reasons.
+ };
+
/// Holds an identifier name check failure, tracking the kind of the
/// identifer, its possible fixup and the starting locations of all the
/// identifier usages.
@@ -76,13 +94,19 @@ public:
///
/// ie: if the identifier was used or declared within a macro we won't offer
/// a fixup for safety reasons.
- bool ShouldFix;
+ bool ShouldFix() const { return FixStatus == ShouldFixStatus::ShouldFix; }
+
+ bool ShouldNotify() const {
+ return FixStatus < ShouldFixStatus::IgnoreFailureThreshold;
+ }
+
+ ShouldFixStatus FixStatus = ShouldFixStatus::ShouldFix;
/// A set of all the identifier usages starting SourceLocation, in
/// their encoded form.
llvm::DenseSet<unsigned> RawUsageLocs;
- NamingCheckFailure() : ShouldFix(true) {}
+ NamingCheckFailure() = default;
};
typedef std::pair<SourceLocation, std::string> NamingCheckId;
OpenPOWER on IntegriCloud