Skip to content

Commit 56fb92a

Browse files
authored
[NFC] [FlowSensitive] [StatusOr] expose statusType in header (#171719)
1 parent 2b958b9 commit 56fb92a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

clang/include/clang/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ clang::ast_matchers::DeclarationMatcher statusClass();
3737
// Match declaration of `absl::internal_statusor::OperatorBase`.
3838
clang::ast_matchers::DeclarationMatcher statusOrOperatorBaseClass();
3939
clang::ast_matchers::TypeMatcher statusOrType();
40+
clang::ast_matchers::TypeMatcher statusType();
4041

4142
// Get RecordStorageLocation for the `Status` contained in the `StatusOr`
4243
RecordStorageLocation &locForStatus(RecordStorageLocation &StatusOrLoc);

clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,6 @@ static auto valueOperatorCall() {
138138
isStatusOrOperatorCallWithName("->")));
139139
}
140140

141-
static clang::ast_matchers::TypeMatcher statusType() {
142-
using namespace ::clang::ast_matchers; // NOLINT: Too many names
143-
return hasCanonicalType(qualType(hasDeclaration(statusClass())));
144-
}
145-
146141
static auto isComparisonOperatorCall(llvm::StringRef operator_name) {
147142
using namespace ::clang::ast_matchers; // NOLINT: Too many names
148143
return cxxOperatorCallExpr(
@@ -446,6 +441,11 @@ clang::ast_matchers::TypeMatcher statusOrType() {
446441
return hasCanonicalType(qualType(hasDeclaration(statusOrClass())));
447442
}
448443

444+
clang::ast_matchers::TypeMatcher statusType() {
445+
using namespace ::clang::ast_matchers; // NOLINT: Too many names
446+
return hasCanonicalType(qualType(hasDeclaration(statusClass())));
447+
}
448+
449449
bool isStatusOrType(QualType Type) {
450450
return isTypeNamed(Type, {"absl"}, "StatusOr");
451451
}

0 commit comments

Comments
 (0)