Skip to content

Commit 8a85495

Browse files
committed
Enable for Objective-C/C++
1 parent 491d304 commit 8a85495

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

clang-tools-extra/clang-tidy/readability/UseConcisePreprocessorDirectivesCheck.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ class IfPreprocessorCallbacks final : public PPCallbacks {
3030

3131
void Elif(SourceLocation Loc, SourceRange ConditionRange, ConditionValueKind,
3232
SourceLocation) override {
33-
if (PP.getLangOpts().C23 || PP.getLangOpts().CPlusPlus23) {
33+
if (PP.getLangOpts().C23 || PP.getLangOpts().CPlusPlus23)
3434
impl(Loc, ConditionRange, {"elifdef", "elifndef"});
35-
}
3635
}
3736

3837
private:

clang-tools-extra/clang-tidy/readability/UseConcisePreprocessorDirectivesCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class UseConcisePreprocessorDirectivesCheck : public ClangTidyCheck {
2525
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
2626
Preprocessor *ModuleExpanderPP) override;
2727
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
28-
return LangOpts.CPlusPlus || LangOpts.C99;
28+
return true;
2929
}
3030
};
3131

clang-tools-extra/test/clang-tidy/checkers/readability/use-concise-preprocessor-directives.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %check_clang_tidy -std=c++98,c++11,c++14,c++17,c++20 -check-suffixes=,CXX %s readability-use-concise-preprocessor-directives %t
22
// RUN: %check_clang_tidy -std=c++23-or-later -check-suffixes=,23,CXX,CXX23 %s readability-use-concise-preprocessor-directives %t
33

4-
// RUN: %check_clang_tidy -std=c99,c17,c11 %s readability-use-concise-preprocessor-directives %t -- -- -x c
4+
// RUN: %check_clang_tidy -std=c99,c11,c17 %s readability-use-concise-preprocessor-directives %t -- -- -x c
55
// RUN: %check_clang_tidy -std=c23-or-later -check-suffixes=,23 %s readability-use-concise-preprocessor-directives %t -- -- -x c
66

77
// CHECK-MESSAGES: :[[@LINE+2]]:2: warning: preprocessor condition can be written more concisely using '#ifdef' [readability-use-concise-preprocessor-directives]

0 commit comments

Comments
 (0)