Skip to content

Commit 86787ec

Browse files
committed
Formatting fix
1 parent 25425cc commit 86787ec

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

clang-tools-extra/clang-tidy/portability/AvoidPlatformSpecificFundamentalTypesCheck.cpp

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//===--- AvoidPlatformSpecificFundamentalTypesCheck.cpp - clang-tidy ---------------===//
1+
//===--- AvoidPlatformSpecificFundamentalTypesCheck.cpp - clang-tidy
2+
//---------------===//
23
//
34
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45
// See https://llvm.org/LICENSE.txt for license information.
@@ -31,8 +32,9 @@ AST_MATCHER_P(clang::TypeLoc, hasType,
3132

3233
} // namespace
3334

34-
AvoidPlatformSpecificFundamentalTypesCheck::AvoidPlatformSpecificFundamentalTypesCheck(
35-
StringRef Name, ClangTidyContext *Context)
35+
AvoidPlatformSpecificFundamentalTypesCheck::
36+
AvoidPlatformSpecificFundamentalTypesCheck(StringRef Name,
37+
ClangTidyContext *Context)
3638
: ClangTidyCheck(Name, Context) {}
3739

3840
bool AvoidPlatformSpecificFundamentalTypesCheck::isFundamentalIntegerType(
@@ -59,7 +61,8 @@ bool AvoidPlatformSpecificFundamentalTypesCheck::isFundamentalIntegerType(
5961
}
6062
}
6163

62-
bool AvoidPlatformSpecificFundamentalTypesCheck::isSemanticType(const Type *T) const {
64+
bool AvoidPlatformSpecificFundamentalTypesCheck::isSemanticType(
65+
const Type *T) const {
6366
if (!T->isBuiltinType())
6467
return false;
6568

@@ -84,35 +87,24 @@ bool AvoidPlatformSpecificFundamentalTypesCheck::isSemanticType(const Type *T) c
8487
}
8588
}
8689

87-
void AvoidPlatformSpecificFundamentalTypesCheck::registerMatchers(MatchFinder *Finder) {
90+
void AvoidPlatformSpecificFundamentalTypesCheck::registerMatchers(
91+
MatchFinder *Finder) {
8892
// Match variable declarations with fundamental integer types
89-
Finder->addMatcher(
90-
varDecl().bind("var_decl"),
91-
this);
93+
Finder->addMatcher(varDecl().bind("var_decl"), this);
9294

9395
// Match function declarations with fundamental integer return types
94-
Finder->addMatcher(
95-
functionDecl().bind("func_decl"),
96-
this);
96+
Finder->addMatcher(functionDecl().bind("func_decl"), this);
9797

9898
// Match function parameters with fundamental integer types
99-
Finder->addMatcher(
100-
parmVarDecl().bind("param_decl"),
101-
this);
99+
Finder->addMatcher(parmVarDecl().bind("param_decl"), this);
102100

103101
// Match field declarations with fundamental integer types
104-
Finder->addMatcher(
105-
fieldDecl().bind("field_decl"),
106-
this);
102+
Finder->addMatcher(fieldDecl().bind("field_decl"), this);
107103

108104
// Match typedef declarations to check their underlying types
109-
Finder->addMatcher(
110-
typedefDecl().bind("typedef_decl"),
111-
this);
105+
Finder->addMatcher(typedefDecl().bind("typedef_decl"), this);
112106

113-
Finder->addMatcher(
114-
typeAliasDecl().bind("alias_decl"),
115-
this);
107+
Finder->addMatcher(typeAliasDecl().bind("alias_decl"), this);
116108
}
117109

118110
void AvoidPlatformSpecificFundamentalTypesCheck::check(
@@ -125,23 +117,27 @@ void AvoidPlatformSpecificFundamentalTypesCheck::check(
125117
Loc = VD->getLocation();
126118
QT = VD->getType();
127119
DeclType = "variable";
128-
} else if (const auto *FD = Result.Nodes.getNodeAs<FunctionDecl>("func_decl")) {
120+
} else if (const auto *FD =
121+
Result.Nodes.getNodeAs<FunctionDecl>("func_decl")) {
129122
Loc = FD->getLocation();
130123
QT = FD->getReturnType();
131124
DeclType = "function return type";
132-
} else if (const auto *PD = Result.Nodes.getNodeAs<ParmVarDecl>("param_decl")) {
125+
} else if (const auto *PD =
126+
Result.Nodes.getNodeAs<ParmVarDecl>("param_decl")) {
133127
Loc = PD->getLocation();
134128
QT = PD->getType();
135129
DeclType = "function parameter";
136130
} else if (const auto *FD = Result.Nodes.getNodeAs<FieldDecl>("field_decl")) {
137131
Loc = FD->getLocation();
138132
QT = FD->getType();
139133
DeclType = "field";
140-
} else if (const auto *TD = Result.Nodes.getNodeAs<TypedefDecl>("typedef_decl")) {
134+
} else if (const auto *TD =
135+
Result.Nodes.getNodeAs<TypedefDecl>("typedef_decl")) {
141136
Loc = TD->getLocation();
142137
QT = TD->getUnderlyingType();
143138
DeclType = "typedef";
144-
} else if (const auto *AD = Result.Nodes.getNodeAs<TypeAliasDecl>("alias_decl")) {
139+
} else if (const auto *AD =
140+
Result.Nodes.getNodeAs<TypeAliasDecl>("alias_decl")) {
145141
Loc = AD->getLocation();
146142
QT = AD->getUnderlyingType();
147143
DeclType = "type alias";

clang-tools-extra/clang-tidy/portability/AvoidPlatformSpecificFundamentalTypesCheck.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//===--- AvoidPlatformSpecificFundamentalTypesCheck.h - clang-tidy -------*- C++ -*-===//
1+
//===--- AvoidPlatformSpecificFundamentalTypesCheck.h - clang-tidy -------*- C++
2+
//-*-===//
23
//
34
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45
// See https://llvm.org/LICENSE.txt for license information.
@@ -13,7 +14,8 @@
1314

1415
namespace clang::tidy::portability {
1516

16-
/// Find fundamental integer types and recommend using typedefs or fixed-width types.
17+
/// Find fundamental integer types and recommend using typedefs or fixed-width
18+
/// types.
1719
///
1820
/// Detects fundamental integer types (int, short, long, long long, and their
1921
/// unsigned variants) and warns against their use due to platform-dependent
@@ -24,7 +26,8 @@ namespace clang::tidy::portability {
2426
/// http://clang.llvm.org/extra/clang-tidy/checks/portability/avoid-platform-specific-fundamental-types.html
2527
class AvoidPlatformSpecificFundamentalTypesCheck : public ClangTidyCheck {
2628
public:
27-
AvoidPlatformSpecificFundamentalTypesCheck(StringRef Name, ClangTidyContext *Context);
29+
AvoidPlatformSpecificFundamentalTypesCheck(StringRef Name,
30+
ClangTidyContext *Context);
2831
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
2932
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3033
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {

0 commit comments

Comments
 (0)