[clang] 56fb92a - [NFC] [FlowSensitive] [StatusOr] expose statusType in header (#171719)

via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 10 14:50:04 PST 2025


Author: Florian Mayer
Date: 2025-12-10T22:50:00Z
New Revision: 56fb92ae643a0ba4def920c347f47e80934314b5

URL: https://github.com/llvm/llvm-project/commit/56fb92ae643a0ba4def920c347f47e80934314b5
DIFF: https://github.com/llvm/llvm-project/commit/56fb92ae643a0ba4def920c347f47e80934314b5.diff

LOG: [NFC] [FlowSensitive] [StatusOr] expose statusType in header (#171719)

Added: 
    

Modified: 
    clang/include/clang/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.h
    clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.h b/clang/include/clang/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.h
index 2d54bd3c6f7ad..756dc1d848f98 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.h
@@ -37,6 +37,7 @@ clang::ast_matchers::DeclarationMatcher statusClass();
 // Match declaration of `absl::internal_statusor::OperatorBase`.
 clang::ast_matchers::DeclarationMatcher statusOrOperatorBaseClass();
 clang::ast_matchers::TypeMatcher statusOrType();
+clang::ast_matchers::TypeMatcher statusType();
 
 // Get RecordStorageLocation for the `Status` contained in the `StatusOr`
 RecordStorageLocation &locForStatus(RecordStorageLocation &StatusOrLoc);

diff  --git a/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp b/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
index d7171359d57bd..94aa05559c5db 100644
--- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedStatusOrAccessModel.cpp
@@ -138,11 +138,6 @@ static auto valueOperatorCall() {
                     isStatusOrOperatorCallWithName("->")));
 }
 
-static clang::ast_matchers::TypeMatcher statusType() {
-  using namespace ::clang::ast_matchers; // NOLINT: Too many names
-  return hasCanonicalType(qualType(hasDeclaration(statusClass())));
-}
-
 static auto isComparisonOperatorCall(llvm::StringRef operator_name) {
   using namespace ::clang::ast_matchers; // NOLINT: Too many names
   return cxxOperatorCallExpr(
@@ -446,6 +441,11 @@ clang::ast_matchers::TypeMatcher statusOrType() {
   return hasCanonicalType(qualType(hasDeclaration(statusOrClass())));
 }
 
+clang::ast_matchers::TypeMatcher statusType() {
+  using namespace ::clang::ast_matchers; // NOLINT: Too many names
+  return hasCanonicalType(qualType(hasDeclaration(statusClass())));
+}
+
 bool isStatusOrType(QualType Type) {
   return isTypeNamed(Type, {"absl"}, "StatusOr");
 }


        


More information about the cfe-commits mailing list