[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 22 00:24:54 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-static-analyzer-1
Author: Balazs Benics (steakhal)
<details>
<summary>Changes</summary>
I figured I could reformat all (cpp,h) files of CSA to see if anything would need special formatting.
Let me know if you find debatable hunks.
clang-format version 19.0.0git (bc1c86b810e518a8e3fa90d5c26908c43788873d)
```
clang/include/clang/Analysis/**/*.{cpp,h}
clang/include/clang/StaticAnalyzer/**/*.{cpp,h}
clang/lib/Analysis/**/*.{cpp,h}
clang/lib/StaticAnalyzer/**/*.{cpp,h}
```
I don't intend to merge this PR; it is just to see how it would look, and how broad the changes would be for us.
---
Patch is 1.74 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/82599.diff
256 Files Affected:
- (modified) clang/include/clang/Analysis/Analyses/Consumed.h (+200-200)
- (modified) clang/include/clang/Analysis/Analyses/Dominators.h (+19-31)
- (modified) clang/include/clang/Analysis/Analyses/LiveVariables.h (+4-5)
- (modified) clang/include/clang/Analysis/Analyses/PostOrderCFGView.h (+4-4)
- (modified) clang/include/clang/Analysis/Analyses/ReachableCode.h (+9-12)
- (modified) clang/include/clang/Analysis/Analyses/ThreadSafety.h (+3-3)
- (modified) clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h (+14-16)
- (modified) clang/include/clang/Analysis/Analyses/ThreadSafetyLogical.h (+6-11)
- (modified) clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h (+195-227)
- (modified) clang/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h (+133-133)
- (modified) clang/include/clang/Analysis/Analyses/ThreadSafetyUtil.h (+8-9)
- (modified) clang/include/clang/Analysis/Analyses/UninitializedValues.h (+6-7)
- (modified) clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h (+2-2)
- (modified) clang/include/clang/Analysis/AnyCall.h (+5-12)
- (modified) clang/include/clang/Analysis/CFG.h (+134-171)
- (modified) clang/include/clang/Analysis/CFGStmtMap.h (+5-5)
- (modified) clang/include/clang/Analysis/CallGraph.h (+15-15)
- (modified) clang/include/clang/Analysis/CloneDetection.h (+2-2)
- (modified) clang/include/clang/Analysis/CodeInjector.h (+1-1)
- (modified) clang/include/clang/Analysis/ConstructionContext.h (+37-36)
- (modified) clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h (+8-8)
- (modified) clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h (+1-1)
- (modified) clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h (+6-6)
- (modified) clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h (+10-16)
- (modified) clang/include/clang/Analysis/FlowSensitive/DataflowValues.h (+39-39)
- (modified) clang/include/clang/Analysis/PathDiagnostic.h (+59-83)
- (modified) clang/include/clang/Analysis/ProgramPoint.h (+112-117)
- (modified) clang/include/clang/Analysis/RetainSummaryManager.h (+78-102)
- (modified) clang/include/clang/Analysis/SelectorExtras.h (+2-2)
- (modified) clang/include/clang/Analysis/Support/BumpVector.h (+19-32)
- (modified) clang/include/clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h (+2-2)
- (modified) clang/include/clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h (+27-16)
- (modified) clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h (+12-14)
- (modified) clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (+10-13)
- (modified) clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h (+35-53)
- (modified) clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h (+2-2)
- (modified) clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h (+1-1)
- (modified) clang/include/clang/StaticAnalyzer/Core/Checker.h (+93-120)
- (modified) clang/include/clang/StaticAnalyzer/Core/CheckerManager.h (+87-124)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h (+5-4)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h (+3-3)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h (+13-28)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h (+26-27)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h (+6-5)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h (+4-2)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h (+36-65)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h (+1-1)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h (+3-5)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h (+57-71)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h (+9-17)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h (+55-71)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h (+82-106)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h (+10-12)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h (+2-2)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h (+97-116)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h (+139-145)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h (+234-251)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h (+17-18)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h (+27-33)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValVisitor.h (+15-14)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h (+8-14)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h (+21-25)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/SummaryManager.h (+6-15)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h (+1-3)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h (+70-76)
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h (+7-13)
- (modified) clang/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h (+1-1)
- (modified) clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h (-1)
- (modified) clang/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h (+2-2)
- (modified) clang/lib/Analysis/AnalysisDeclContext.cpp (+28-28)
- (modified) clang/lib/Analysis/BodyFarm.cpp (+60-70)
- (modified) clang/lib/Analysis/CFG.cpp (+609-626)
- (modified) clang/lib/Analysis/CFGReachabilityAnalysis.cpp (+4-4)
- (modified) clang/lib/Analysis/CFGStmtMap.cpp (+4-6)
- (modified) clang/lib/Analysis/CallGraph.cpp (+17-26)
- (modified) clang/lib/Analysis/CocoaConventions.cpp (+8-10)
- (modified) clang/lib/Analysis/ConstructionContext.cpp (+25-13)
- (modified) clang/lib/Analysis/Consumed.cpp (+87-89)
- (modified) clang/lib/Analysis/Dominators.cpp (+2-4)
- (modified) clang/lib/Analysis/ExprMutationAnalyzer.cpp (+6-2)
- (modified) clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp (+3-5)
- (modified) clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp (+5-7)
- (modified) clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp (+9-10)
- (modified) clang/lib/Analysis/FlowSensitive/Transfer.cpp (+2-2)
- (modified) clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp (+3-6)
- (modified) clang/lib/Analysis/IssueHash.cpp (+4-3)
- (modified) clang/lib/Analysis/LiveVariables.cpp (+147-144)
- (modified) clang/lib/Analysis/MacroExpansionContext.cpp (-1)
- (modified) clang/lib/Analysis/ObjCNoReturn.cpp (+6-8)
- (modified) clang/lib/Analysis/PathDiagnostic.cpp (+123-135)
- (modified) clang/lib/Analysis/PostOrderCFGView.cpp (+6-2)
- (modified) clang/lib/Analysis/ProgramPoint.cpp (+25-28)
- (modified) clang/lib/Analysis/ReachableCode.cpp (+164-170)
- (modified) clang/lib/Analysis/RetainSummaryManager.cpp (+114-149)
- (modified) clang/lib/Analysis/ThreadSafety.cpp (+317-323)
- (modified) clang/lib/Analysis/ThreadSafetyCommon.cpp (+121-93)
- (modified) clang/lib/Analysis/ThreadSafetyLogical.cpp (+3-3)
- (modified) clang/lib/Analysis/ThreadSafetyTIL.cpp (+53-29)
- (modified) clang/lib/Analysis/UninitializedValues.cpp (+34-52)
- (modified) clang/lib/Analysis/UnsafeBufferUsage.cpp (+131-132)
- (modified) clang/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp (+1-1)
- (modified) clang/lib/StaticAnalyzer/Checkers/AnalysisOrderChecker.cpp (+4-2)
- (modified) clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp (+12-14)
- (modified) clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp (+4-5)
- (modified) clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp (+4-2)
- (modified) clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp (+107-103)
- (modified) clang/lib/StaticAnalyzer/Checkers/BitwiseShiftChecker.cpp (+44-41)
- (modified) clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp (+12-10)
- (modified) clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp (+5-4)
- (modified) clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp (+83-96)
- (modified) clang/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp (+26-24)
- (modified) clang/lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp (+4-5)
- (modified) clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp (+21-25)
- (modified) clang/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp (+5-4)
- (modified) clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp (+10-10)
- (modified) clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp (+19-19)
- (modified) clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (+26-37)
- (modified) clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp (+10-12)
- (modified) clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp (+63-70)
- (modified) clang/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp (+8-8)
- (modified) clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp (+27-45)
- (modified) clang/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp (+8-8)
- (modified) clang/lib/StaticAnalyzer/Checkers/CloneChecker.cpp (+9-7)
- (modified) clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp (+57-57)
- (modified) clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp (+2-2)
- (modified) clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp (+69-71)
- (modified) clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp (+38-44)
- (modified) clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp (+16-19)
- (modified) clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp (+20-12)
- (modified) clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp (+47-51)
- (modified) clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp (+21-20)
- (modified) clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp (+2-5)
- (modified) clang/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp (+2-2)
- (modified) clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp (+9-13)
- (modified) clang/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp (+2-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp (+45-69)
- (modified) clang/lib/StaticAnalyzer/Checkers/GTestChecker.cpp (+2-2)
- (modified) clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp (+21-22)
- (modified) clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp (+24-24)
- (modified) clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp (+4-5)
- (modified) clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp (+4-6)
- (modified) clang/lib/StaticAnalyzer/Checkers/Iterator.cpp (+12-17)
- (modified) clang/lib/StaticAnalyzer/Checkers/Iterator.h (+24-16)
- (modified) clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp (+82-82)
- (modified) clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp (+14-13)
- (modified) clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp (+70-86)
- (modified) clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp (+13-12)
- (modified) clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp (+12-11)
- (modified) clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp (+8-10)
- (modified) clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp (+9-11)
- (modified) clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h (+4-4)
- (modified) clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp (+3-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.h (+3-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.cpp (+3-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h (+3-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp (+40-54)
- (modified) clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp (+6-8)
- (modified) clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (+157-150)
- (modified) clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp (+140-148)
- (modified) clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp (+14-16)
- (modified) clang/lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp (+5-6)
- (modified) clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp (+7-10)
- (modified) clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp (+79-91)
- (modified) clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp (+2-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp (+41-42)
- (modified) clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp (+31-28)
- (modified) clang/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp (+2-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/NonnullGlobalConstantsChecker.cpp (+6-5)
- (modified) clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp (+15-18)
- (modified) clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp (+73-91)
- (modified) clang/lib/StaticAnalyzer/Checkers/OSObjectCStyleCast.cpp (+7-11)
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp (+2-2)
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp (+43-58)
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp (+7-8)
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp (+9-11)
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp (+30-37)
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCPropertyChecker.cpp (+5-5)
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp (+26-33)
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp (+7-8)
- (modified) clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp (+10-12)
- (modified) clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp (+5-5)
- (modified) clang/lib/StaticAnalyzer/Checkers/PointerIterationChecker.cpp (+10-14)
- (modified) clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp (+12-22)
- (modified) clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp (+2-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp (+3-1)
- (modified) clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp (+216-226)
- (modified) clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h (+50-72)
- (modified) clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp (+18-24)
- (modified) clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h (+3-5)
- (modified) clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp (+3-4)
- (modified) clang/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp (+3-2)
- (modified) clang/lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp (+40-47)
- (modified) clang/lib/StaticAnalyzer/Checkers/STLAlgorithmModeling.cpp (+34-36)
- (modified) clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp (+19-25)
- (modified) clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp (+2-1)
- (modified) clang/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp (+2-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp (+1-1)
- (modified) clang/lib/StaticAnalyzer/Checkers/TraversalChecker.cpp (+8-11)
- (modified) clang/lib/StaticAnalyzer/Checkers/TrustNonnullChecker.cpp (+10-14)
- (modified) clang/lib/StaticAnalyzer/Checkers/TrustReturnsNonnullChecker.cpp (+1-1)
- (modified) clang/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp (+6-6)
- (modified) clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp (+4-7)
- (modified) clang/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp (+6-6)
- (modified) clang/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp (+3-4)
- (modified) clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h (+2-3)
- (modified) clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp (+12-11)
- (modified) clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp (+26-41)
- (modified) clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp (+13-14)
- (modified) clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp (+2-4)
- (modified) clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp (+9-20)
- (modified) clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp (+2-4)
- (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp (+4-5)
- (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp (+4-8)
- (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h (+4-4)
- (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp (+4-4)
- (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp (+4-4)
- (modified) clang/lib/StaticAnalyzer/Core/APSIntType.cpp (+2-2)
- (modified) clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp (+8-13)
- (modified) clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp (+14-17)
- (modified) clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp (+91-89)
- (modified) clang/lib/StaticAnalyzer/Core/BlockCounter.cpp (+16-18)
- (modified) clang/lib/StaticAnalyzer/Core/BugReporter.cpp (+274-288)
- (modified) clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (+106-90)
- (modified) clang/lib/StaticAnalyzer/Core/CallEvent.cpp (+46-52)
- (modified) clang/lib/StaticAnalyzer/Core/Checker.cpp (+3-3)
- (modified) clang/lib/StaticAnalyzer/Core/CheckerContext.cpp (+1-2)
- (modified) clang/lib/StaticAnalyzer/Core/CheckerManager.cpp (+247-272)
- (modified) clang/lib/StaticAnalyzer/Core/CoreEngine.cpp (+181-189)
- (modified) clang/lib/StaticAnalyzer/Core/Environment.cpp (+10-15)
- (modified) clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp (+27-29)
- (modified) clang/lib/StaticAnalyzer/Core/ExprEngine.cpp (+770-816)
- (modified) clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp (+323-318)
- (modified) clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp (+115-128)
- (modified) clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (+54-57)
- (modified) clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp (+12-13)
- (modified) clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp (+73-81)
- (modified) clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp (+4-4)
- (modified) clang/lib/StaticAnalyzer/Core/LoopWidening.cpp (+1-2)
- (modified) clang/lib/StaticAnalyzer/Core/MemRegion.cpp (+99-131)
- (modified) clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp (+111-116)
- (modified) clang/lib/StaticAnalyzer/Core/PrettyStackTraceLocationContext.h (+3-2)
- (modified) clang/lib/StaticAnalyzer/Core/ProgramState.cpp (+73-95)
- (modified) clang/lib/StaticAnalyzer/Core/RangedConstraintManager.cpp (+1-1)
- (modified) clang/lib/StaticAnalyzer/Core/RegionStore.cpp (+162-199)
- (modified) clang/lib/StaticAnalyzer/Core/SValBuilder.cpp (+15-17)
- (modified) clang/lib/StaticAnalyzer/Core/SVals.cpp (+56-60)
- (modified) clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp (+100-110)
- (modified) clang/lib/StaticAnalyzer/Core/Store.cpp (+114-117)
- (modified) clang/lib/StaticAnalyzer/Core/SymbolManager.cpp (+55-65)
- (modified) clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp (+2-4)
- (modified) clang/lib/StaticAnalyzer/Core/WorkList.cpp (+41-56)
- (modified) clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (+24-31)
- (modified) clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp (+9-15)
- (modified) clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp (+8-14)
- (modified) clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp (+1-1)
- (modified) clang/lib/StaticAnalyzer/Frontend/ModelInjector.h (+6-6)
``````````diff
diff --git a/clang/include/clang/Analysis/Analyses/Consumed.h b/clang/include/clang/Analysis/Analyses/Consumed.h
index 3e2788cac3c9cb..0e4818f043b9e8 100644
--- a/clang/include/clang/Analysis/Analyses/Consumed.h
+++ b/clang/include/clang/Analysis/Analyses/Consumed.h
@@ -38,235 +38,235 @@ class VarDecl;
namespace consumed {
- class ConsumedStmtVisitor;
-
- enum ConsumedState {
- // No state information for the given variable.
- CS_None,
-
- CS_Unknown,
- CS_Unconsumed,
- CS_Consumed
- };
-
- using OptionalNotes = SmallVector<PartialDiagnosticAt, 1>;
- using DelayedDiag = std::pair<PartialDiagnosticAt, OptionalNotes>;
- using DiagList = std::list<DelayedDiag>;
-
- class ConsumedWarningsHandlerBase {
- public:
- virtual ~ConsumedWarningsHandlerBase();
-
- /// Emit the warnings and notes left by the analysis.
- virtual void emitDiagnostics() {}
-
- /// Warn that a variable's state doesn't match at the entry and exit
- /// of a loop.
- ///
- /// \param Loc -- The location of the end of the loop.
- ///
- /// \param VariableName -- The name of the variable that has a mismatched
- /// state.
- virtual void warnLoopStateMismatch(SourceLocation Loc,
- StringRef VariableName) {}
-
- /// Warn about parameter typestate mismatches upon return.
- ///
- /// \param Loc -- The SourceLocation of the return statement.
- ///
- /// \param ExpectedState -- The state the return value was expected to be
- /// in.
- ///
- /// \param ObservedState -- The state the return value was observed to be
- /// in.
- virtual void warnParamReturnTypestateMismatch(SourceLocation Loc,
- StringRef VariableName,
- StringRef ExpectedState,
- StringRef ObservedState) {}
-
- // FIXME: Add documentation.
- virtual void warnParamTypestateMismatch(SourceLocation LOC,
- StringRef ExpectedState,
- StringRef ObservedState) {}
-
- // FIXME: This can be removed when the attr propagation fix for templated
- // classes lands.
- /// Warn about return typestates set for unconsumable types.
- ///
- /// \param Loc -- The location of the attributes.
- ///
- /// \param TypeName -- The name of the unconsumable type.
- virtual void warnReturnTypestateForUnconsumableType(SourceLocation Loc,
- StringRef TypeName) {}
-
- /// Warn about return typestate mismatches.
- ///
- /// \param Loc -- The SourceLocation of the return statement.
- ///
- /// \param ExpectedState -- The state the return value was expected to be
- /// in.
- ///
- /// \param ObservedState -- The state the return value was observed to be
- /// in.
- virtual void warnReturnTypestateMismatch(SourceLocation Loc,
- StringRef ExpectedState,
- StringRef ObservedState) {}
-
- /// Warn about use-while-consumed errors.
- /// \param MethodName -- The name of the method that was incorrectly
- /// invoked.
- ///
- /// \param State -- The state the object was used in.
- ///
- /// \param Loc -- The SourceLocation of the method invocation.
- virtual void warnUseOfTempInInvalidState(StringRef MethodName,
- StringRef State,
- SourceLocation Loc) {}
-
- /// Warn about use-while-consumed errors.
- /// \param MethodName -- The name of the method that was incorrectly
- /// invoked.
- ///
- /// \param State -- The state the object was used in.
- ///
- /// \param VariableName -- The name of the variable that holds the unique
- /// value.
- ///
- /// \param Loc -- The SourceLocation of the method invocation.
- virtual void warnUseInInvalidState(StringRef MethodName,
- StringRef VariableName,
- StringRef State,
- SourceLocation Loc) {}
- };
-
- class ConsumedStateMap {
- using VarMapType = llvm::DenseMap<const VarDecl *, ConsumedState>;
- using TmpMapType =
- llvm::DenseMap<const CXXBindTemporaryExpr *, ConsumedState>;
-
- protected:
- bool Reachable = true;
- const Stmt *From = nullptr;
- VarMapType VarMap;
- TmpMapType TmpMap;
-
- public:
- ConsumedStateMap() = default;
- ConsumedStateMap(const ConsumedStateMap &Other)
- : Reachable(Other.Reachable), From(Other.From), VarMap(Other.VarMap) {}
-
- // The copy assignment operator is defined as deleted pending further
- // motivation.
- ConsumedStateMap &operator=(const ConsumedStateMap &) = delete;
-
- /// Warn if any of the parameters being tracked are not in the state
- /// they were declared to be in upon return from a function.
- void checkParamsForReturnTypestate(SourceLocation BlameLoc,
+class ConsumedStmtVisitor;
+
+enum ConsumedState {
+ // No state information for the given variable.
+ CS_None,
+
+ CS_Unknown,
+ CS_Unconsumed,
+ CS_Consumed
+};
+
+using OptionalNotes = SmallVector<PartialDiagnosticAt, 1>;
+using DelayedDiag = std::pair<PartialDiagnosticAt, OptionalNotes>;
+using DiagList = std::list<DelayedDiag>;
+
+class ConsumedWarningsHandlerBase {
+public:
+ virtual ~ConsumedWarningsHandlerBase();
+
+ /// Emit the warnings and notes left by the analysis.
+ virtual void emitDiagnostics() {}
+
+ /// Warn that a variable's state doesn't match at the entry and exit
+ /// of a loop.
+ ///
+ /// \param Loc -- The location of the end of the loop.
+ ///
+ /// \param VariableName -- The name of the variable that has a mismatched
+ /// state.
+ virtual void warnLoopStateMismatch(SourceLocation Loc,
+ StringRef VariableName) {}
+
+ /// Warn about parameter typestate mismatches upon return.
+ ///
+ /// \param Loc -- The SourceLocation of the return statement.
+ ///
+ /// \param ExpectedState -- The state the return value was expected to be
+ /// in.
+ ///
+ /// \param ObservedState -- The state the return value was observed to be
+ /// in.
+ virtual void warnParamReturnTypestateMismatch(SourceLocation Loc,
+ StringRef VariableName,
+ StringRef ExpectedState,
+ StringRef ObservedState) {}
+
+ // FIXME: Add documentation.
+ virtual void warnParamTypestateMismatch(SourceLocation LOC,
+ StringRef ExpectedState,
+ StringRef ObservedState) {}
+
+ // FIXME: This can be removed when the attr propagation fix for templated
+ // classes lands.
+ /// Warn about return typestates set for unconsumable types.
+ ///
+ /// \param Loc -- The location of the attributes.
+ ///
+ /// \param TypeName -- The name of the unconsumable type.
+ virtual void warnReturnTypestateForUnconsumableType(SourceLocation Loc,
+ StringRef TypeName) {}
+
+ /// Warn about return typestate mismatches.
+ ///
+ /// \param Loc -- The SourceLocation of the return statement.
+ ///
+ /// \param ExpectedState -- The state the return value was expected to be
+ /// in.
+ ///
+ /// \param ObservedState -- The state the return value was observed to be
+ /// in.
+ virtual void warnReturnTypestateMismatch(SourceLocation Loc,
+ StringRef ExpectedState,
+ StringRef ObservedState) {}
+
+ /// Warn about use-while-consumed errors.
+ /// \param MethodName -- The name of the method that was incorrectly
+ /// invoked.
+ ///
+ /// \param State -- The state the object was used in.
+ ///
+ /// \param Loc -- The SourceLocation of the method invocation.
+ virtual void warnUseOfTempInInvalidState(StringRef MethodName,
+ StringRef State,
+ SourceLocation Loc) {}
+
+ /// Warn about use-while-consumed errors.
+ /// \param MethodName -- The name of the method that was incorrectly
+ /// invoked.
+ ///
+ /// \param State -- The state the object was used in.
+ ///
+ /// \param VariableName -- The name of the variable that holds the unique
+ /// value.
+ ///
+ /// \param Loc -- The SourceLocation of the method invocation.
+ virtual void warnUseInInvalidState(StringRef MethodName,
+ StringRef VariableName, StringRef State,
+ SourceLocation Loc) {}
+};
+
+class ConsumedStateMap {
+ using VarMapType = llvm::DenseMap<const VarDecl *, ConsumedState>;
+ using TmpMapType =
+ llvm::DenseMap<const CXXBindTemporaryExpr *, ConsumedState>;
+
+protected:
+ bool Reachable = true;
+ const Stmt *From = nullptr;
+ VarMapType VarMap;
+ TmpMapType TmpMap;
+
+public:
+ ConsumedStateMap() = default;
+ ConsumedStateMap(const ConsumedStateMap &Other)
+ : Reachable(Other.Reachable), From(Other.From), VarMap(Other.VarMap) {}
+
+ // The copy assignment operator is defined as deleted pending further
+ // motivation.
+ ConsumedStateMap &operator=(const ConsumedStateMap &) = delete;
+
+ /// Warn if any of the parameters being tracked are not in the state
+ /// they were declared to be in upon return from a function.
+ void checkParamsForReturnTypestate(
+ SourceLocation BlameLoc,
ConsumedWarningsHandlerBase &WarningsHandler) const;
- /// Clear the TmpMap.
- void clearTemporaries();
+ /// Clear the TmpMap.
+ void clearTemporaries();
- /// Get the consumed state of a given variable.
- ConsumedState getState(const VarDecl *Var) const;
+ /// Get the consumed state of a given variable.
+ ConsumedState getState(const VarDecl *Var) const;
- /// Get the consumed state of a given temporary value.
- ConsumedState getState(const CXXBindTemporaryExpr *Tmp) const;
+ /// Get the consumed state of a given temporary value.
+ ConsumedState getState(const CXXBindTemporaryExpr *Tmp) const;
- /// Merge this state map with another map.
- void intersect(const ConsumedStateMap &Other);
+ /// Merge this state map with another map.
+ void intersect(const ConsumedStateMap &Other);
- void intersectAtLoopHead(const CFGBlock *LoopHead, const CFGBlock *LoopBack,
- const ConsumedStateMap *LoopBackStates,
- ConsumedWarningsHandlerBase &WarningsHandler);
+ void intersectAtLoopHead(const CFGBlock *LoopHead, const CFGBlock *LoopBack,
+ const ConsumedStateMap *LoopBackStates,
+ ConsumedWarningsHandlerBase &WarningsHandler);
- /// Return true if this block is reachable.
- bool isReachable() const { return Reachable; }
+ /// Return true if this block is reachable.
+ bool isReachable() const { return Reachable; }
- /// Mark the block as unreachable.
- void markUnreachable();
+ /// Mark the block as unreachable.
+ void markUnreachable();
- /// Set the source for a decision about the branching of states.
- /// \param Source -- The statement that was the origin of a branching
- /// decision.
- void setSource(const Stmt *Source) { this->From = Source; }
+ /// Set the source for a decision about the branching of states.
+ /// \param Source -- The statement that was the origin of a branching
+ /// decision.
+ void setSource(const Stmt *Source) { this->From = Source; }
- /// Set the consumed state of a given variable.
- void setState(const VarDecl *Var, ConsumedState State);
+ /// Set the consumed state of a given variable.
+ void setState(const VarDecl *Var, ConsumedState State);
- /// Set the consumed state of a given temporary value.
- void setState(const CXXBindTemporaryExpr *Tmp, ConsumedState State);
+ /// Set the consumed state of a given temporary value.
+ void setState(const CXXBindTemporaryExpr *Tmp, ConsumedState State);
- /// Remove the temporary value from our state map.
- void remove(const CXXBindTemporaryExpr *Tmp);
+ /// Remove the temporary value from our state map.
+ void remove(const CXXBindTemporaryExpr *Tmp);
- /// Tests to see if there is a mismatch in the states stored in two
- /// maps.
- ///
- /// \param Other -- The second map to compare against.
- bool operator!=(const ConsumedStateMap *Other) const;
- };
+ /// Tests to see if there is a mismatch in the states stored in two
+ /// maps.
+ ///
+ /// \param Other -- The second map to compare against.
+ bool operator!=(const ConsumedStateMap *Other) const;
+};
- class ConsumedBlockInfo {
- std::vector<std::unique_ptr<ConsumedStateMap>> StateMapsArray;
- std::vector<unsigned int> VisitOrder;
+class ConsumedBlockInfo {
+ std::vector<std::unique_ptr<ConsumedStateMap>> StateMapsArray;
+ std::vector<unsigned int> VisitOrder;
- public:
- ConsumedBlockInfo() = default;
+public:
+ ConsumedBlockInfo() = default;
- ConsumedBlockInfo(unsigned int NumBlocks, PostOrderCFGView *SortedGraph)
- : StateMapsArray(NumBlocks), VisitOrder(NumBlocks, 0) {
- unsigned int VisitOrderCounter = 0;
- for (const auto BI : *SortedGraph)
- VisitOrder[BI->getBlockID()] = VisitOrderCounter++;
- }
+ ConsumedBlockInfo(unsigned int NumBlocks, PostOrderCFGView *SortedGraph)
+ : StateMapsArray(NumBlocks), VisitOrder(NumBlocks, 0) {
+ unsigned int VisitOrderCounter = 0;
+ for (const auto BI : *SortedGraph)
+ VisitOrder[BI->getBlockID()] = VisitOrderCounter++;
+ }
- bool allBackEdgesVisited(const CFGBlock *CurrBlock,
- const CFGBlock *TargetBlock);
+ bool allBackEdgesVisited(const CFGBlock *CurrBlock,
+ const CFGBlock *TargetBlock);
- void addInfo(const CFGBlock *Block, ConsumedStateMap *StateMap,
- std::unique_ptr<ConsumedStateMap> &OwnedStateMap);
- void addInfo(const CFGBlock *Block,
- std::unique_ptr<ConsumedStateMap> StateMap);
+ void addInfo(const CFGBlock *Block, ConsumedStateMap *StateMap,
+ std::unique_ptr<ConsumedStateMap> &OwnedStateMap);
+ void addInfo(const CFGBlock *Block,
+ std::unique_ptr<ConsumedStateMap> StateMap);
- ConsumedStateMap* borrowInfo(const CFGBlock *Block);
+ ConsumedStateMap *borrowInfo(const CFGBlock *Block);
- void discardInfo(const CFGBlock *Block);
+ void discardInfo(const CFGBlock *Block);
- std::unique_ptr<ConsumedStateMap> getInfo(const CFGBlock *Block);
+ std::unique_ptr<ConsumedStateMap> getInfo(const CFGBlock *Block);
- bool isBackEdge(const CFGBlock *From, const CFGBlock *To);
- bool isBackEdgeTarget(const CFGBlock *Block);
- };
+ bool isBackEdge(const CFGBlock *From, const CFGBlock *To);
+ bool isBackEdgeTarget(const CFGBlock *Block);
+};
- /// A class that handles the analysis of uniqueness violations.
- class ConsumedAnalyzer {
- ConsumedBlockInfo BlockInfo;
- std::unique_ptr<ConsumedStateMap> CurrStates;
+/// A class that handles the analysis of uniqueness violations.
+class ConsumedAnalyzer {
+ ConsumedBlockInfo BlockInfo;
+ std::unique_ptr<ConsumedStateMap> CurrStates;
- ConsumedState ExpectedReturnState = CS_None;
+ ConsumedState ExpectedReturnState = CS_None;
- void determineExpectedReturnState(AnalysisDeclContext &AC,
- const FunctionDecl *D);
- bool splitState(const CFGBlock *CurrBlock,
- const ConsumedStmtVisitor &Visitor);
+ void determineExpectedReturnState(AnalysisDeclContext &AC,
+ const FunctionDecl *D);
+ bool splitState(const CFGBlock *CurrBlock,
+ const ConsumedStmtVisitor &Visitor);
- public:
- ConsumedWarningsHandlerBase &WarningsHandler;
+public:
+ ConsumedWarningsHandlerBase &WarningsHandler;
- ConsumedAnalyzer(ConsumedWarningsHandlerBase &WarningsHandler)
- : WarningsHandler(WarningsHandler) {}
+ ConsumedAnalyzer(ConsumedWarningsHandlerBase &WarningsHandler)
+ : WarningsHandler(WarningsHandler) {}
- ConsumedState getExpectedReturnState() const { return ExpectedReturnState; }
+ ConsumedState getExpectedReturnState() const { return ExpectedReturnState; }
- /// Check a function's CFG for consumed violations.
- ///
- /// We traverse the blocks in the CFG, keeping track of the state of each
- /// value who's type has uniqueness annotations. If methods are invoked in
- /// the wrong state a warning is issued. Each block in the CFG is traversed
- /// exactly once.
- void run(AnalysisDeclContext &AC);
- };
+ /// Check a function's CFG for consumed violations.
+ ///
+ /// We traverse the blocks in the CFG, keeping track of the state of each
+ /// value who's type has uniqueness annotations. If methods are invoked in
+ /// the wrong state a warning is issued. Each block in the CFG is traversed
+ /// exactly once.
+ void run(AnalysisDeclContext &AC);
+};
} // namespace consumed
diff --git a/clang/include/clang/Analysis/Analyses/Dominators.h b/clang/include/clang/Analysis/Analyses/Dominators.h
index 7dd54c5ce262cc..05d62dbaa63158 100644
--- a/clang/include/clang/Analysis/Analyses/Dominators.h
+++ b/clang/include/clang/Analysis/Analyses/Dominators.h
@@ -18,9 +18,9 @@
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/iterator.h"
-#include "llvm/Support/GenericIteratedDominanceFrontier.h"
#include "llvm/Support/GenericDomTree.h"
#include "llvm/Support/GenericDomTreeConstruction.h"
+#include "llvm/Support/GenericIteratedDominanceFrontier.h"
#include "llvm/Support/raw_ostream.h"
// FIXME: There is no good reason for the domtree to require a print method
@@ -38,8 +38,7 @@ namespace clang {
using DomTreeNode = llvm::DomTreeNodeBase<CFGBlock>;
/// Dominator tree builder for Clang's CFG based on llvm::DominatorTreeBase.
-template <bool IsPostDom>
-class CFGDominatorTreeImpl : public ManagedAnalysis {
+template <bool IsPostDom> class CFGDominatorTreeImpl : public ManagedAnalysis {
virtual void anchor();
public:
@@ -47,9 +46,7 @@ class CFGDominatorTreeImpl : public ManagedAnalysis {
CFGDominatorTreeImpl() = default;
- CFGDominatorTreeImpl(CFG *cfg) {
- buildDominatorTree(cfg);
- }
+ CFGDominatorTreeImpl(CFG *cfg) { buildDominatorTree(cfg); }
~CFGDominatorTreeImpl() override = default;
@@ -58,14 +55,10 @@ class CFGDominatorTreeImpl : public ManagedAnalysis {
CFG *getCFG() { return cfg; }
/// \returns the root CFGBlock of the dominators tree.
- CFGBlock *getRoot() const {
- return DT.getRoot();
- }
+ CFGBlock *getRoot() const { return DT.getRoot(); }
/// \returns the root DomTreeNode, which is the wrapper for CFGBlock.
- DomTreeNode *getRootNode() {
- return DT.getRootNode();
- }
+ DomTreeNode *getRootNode() { return DT.getRootNode(); }
/// Compares two dominator trees.
/// \returns false if the other dominator tree matches this dominator tree,
@@ -94,8 +87,7 @@ class CFGDominatorTreeImpl : public ManagedAnalysis {
void dump() {
llvm::errs() << "Immediate " << (IsPostDom ? "post " : "")
<< "dominance tree (Node#,IDom#):\n";
- for (CFG::const_iterator I = cfg->begin(),
- E = cfg->end(); I != E; ++I) {
+ for (CFG::const_iterator I = cfg->begin(), E = cfg->end(); I != E; ++I) {
assert(*I &&
"LLVM's Dominator tree builder uses nullpointers to signify the "
@@ -103,10 +95,8 @@ class CFGDominatorTreeImpl : public ManagedAnalysis {
DomTreeNode *IDom = DT.getNode(*I)->getIDom();
if (IDom && IDom->getBlock())
- llvm::errs() << "(" << (*I)->getBlockID()
- << ","
- << IDom->getBlock()->getBlockID()
- << ")\n";
+ llvm::errs() << "(" << (*I)->getBlockID() << ","
+ << IDom->getBlock()->getBlockID() << ")\n";
else {
bool IsEntryBlock = *I == &(*I)->getParent()->getEntry();
bool IsExitBlock = *I == &...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/82599
More information about the cfe-commits
mailing list