Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT][analyzer][NFC] clang-format our folders #82599

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

steakhal
Copy link
Contributor

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 (bc1c86b)

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.

clang-format version 19.0.0git (bc1c86b)

clang/include/clang/Analysis/**/*.{cpp,h}
clang/include/clang/StaticAnalyzer/**/*.{cpp,h}
clang/lib/Analysis/**/*.{cpp,h}
clang/lib/StaticAnalyzer/**/*.{cpp,h}
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 22, 2024

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Balazs Benics (steakhal)

Changes

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 (bc1c86b)

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 --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]

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff bc1c86b810e518a8e3fa90d5c26908c43788873d c21867a39c74b23897158989081293558feb698c -- clang/include/clang/Analysis/Analyses/Consumed.h clang/include/clang/Analysis/Analyses/Dominators.h clang/include/clang/Analysis/Analyses/LiveVariables.h clang/include/clang/Analysis/Analyses/PostOrderCFGView.h clang/include/clang/Analysis/Analyses/ReachableCode.h clang/include/clang/Analysis/Analyses/ThreadSafety.h clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h clang/include/clang/Analysis/Analyses/ThreadSafetyLogical.h clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h clang/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h clang/include/clang/Analysis/Analyses/ThreadSafetyUtil.h clang/include/clang/Analysis/Analyses/UninitializedValues.h clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h clang/include/clang/Analysis/AnyCall.h clang/include/clang/Analysis/CFG.h clang/include/clang/Analysis/CFGStmtMap.h clang/include/clang/Analysis/CallGraph.h clang/include/clang/Analysis/CloneDetection.h clang/include/clang/Analysis/CodeInjector.h clang/include/clang/Analysis/ConstructionContext.h clang/include/clang/Analysis/DomainSpecific/CocoaConventions.h clang/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h clang/include/clang/Analysis/FlowSensitive/DataflowValues.h clang/include/clang/Analysis/PathDiagnostic.h clang/include/clang/Analysis/ProgramPoint.h clang/include/clang/Analysis/RetainSummaryManager.h clang/include/clang/Analysis/SelectorExtras.h clang/include/clang/Analysis/Support/BumpVector.h clang/include/clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h clang/include/clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h clang/include/clang/StaticAnalyzer/Core/Checker.h clang/include/clang/StaticAnalyzer/Core/CheckerManager.h clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValVisitor.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/SummaryManager.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h clang/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h clang/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h clang/lib/Analysis/AnalysisDeclContext.cpp clang/lib/Analysis/BodyFarm.cpp clang/lib/Analysis/CFG.cpp clang/lib/Analysis/CFGReachabilityAnalysis.cpp clang/lib/Analysis/CFGStmtMap.cpp clang/lib/Analysis/CallGraph.cpp clang/lib/Analysis/CocoaConventions.cpp clang/lib/Analysis/ConstructionContext.cpp clang/lib/Analysis/Consumed.cpp clang/lib/Analysis/Dominators.cpp clang/lib/Analysis/ExprMutationAnalyzer.cpp clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp clang/lib/Analysis/FlowSensitive/Transfer.cpp clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp clang/lib/Analysis/IssueHash.cpp clang/lib/Analysis/LiveVariables.cpp clang/lib/Analysis/MacroExpansionContext.cpp clang/lib/Analysis/ObjCNoReturn.cpp clang/lib/Analysis/PathDiagnostic.cpp clang/lib/Analysis/PostOrderCFGView.cpp clang/lib/Analysis/ProgramPoint.cpp clang/lib/Analysis/ReachableCode.cpp clang/lib/Analysis/RetainSummaryManager.cpp clang/lib/Analysis/ThreadSafety.cpp clang/lib/Analysis/ThreadSafetyCommon.cpp clang/lib/Analysis/ThreadSafetyLogical.cpp clang/lib/Analysis/ThreadSafetyTIL.cpp clang/lib/Analysis/UninitializedValues.cpp clang/lib/Analysis/UnsafeBufferUsage.cpp clang/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp clang/lib/StaticAnalyzer/Checkers/AnalysisOrderChecker.cpp clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp clang/lib/StaticAnalyzer/Checkers/BitwiseShiftChecker.cpp clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp clang/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp clang/lib/StaticAnalyzer/Checkers/CXXSelfAssignmentChecker.cpp clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp clang/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp clang/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp clang/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp clang/lib/StaticAnalyzer/Checkers/CloneChecker.cpp clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp clang/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp clang/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp clang/lib/StaticAnalyzer/Checkers/GTestChecker.cpp clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp clang/lib/StaticAnalyzer/Checkers/IdenticalExprChecker.cpp clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp clang/lib/StaticAnalyzer/Checkers/Iterator.cpp clang/lib/StaticAnalyzer/Checkers/Iterator.h clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp clang/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.h clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.cpp clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp clang/lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp clang/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp clang/lib/StaticAnalyzer/Checkers/NonnullGlobalConstantsChecker.cpp clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp clang/lib/StaticAnalyzer/Checkers/OSObjectCStyleCast.cpp clang/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCContainersASTChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCPropertyChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp clang/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp clang/lib/StaticAnalyzer/Checkers/PointerIterationChecker.cpp clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp clang/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp clang/lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp clang/lib/StaticAnalyzer/Checkers/STLAlgorithmModeling.cpp clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp clang/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp clang/lib/StaticAnalyzer/Checkers/TraversalChecker.cpp clang/lib/StaticAnalyzer/Checkers/TrustNonnullChecker.cpp clang/lib/StaticAnalyzer/Checkers/TrustReturnsNonnullChecker.cpp clang/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp clang/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp clang/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp clang/lib/StaticAnalyzer/Core/APSIntType.cpp clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp clang/lib/StaticAnalyzer/Core/BlockCounter.cpp clang/lib/StaticAnalyzer/Core/BugReporter.cpp clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp clang/lib/StaticAnalyzer/Core/CallEvent.cpp clang/lib/StaticAnalyzer/Core/Checker.cpp clang/lib/StaticAnalyzer/Core/CheckerContext.cpp clang/lib/StaticAnalyzer/Core/CheckerManager.cpp clang/lib/StaticAnalyzer/Core/CoreEngine.cpp clang/lib/StaticAnalyzer/Core/Environment.cpp clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp clang/lib/StaticAnalyzer/Core/ExprEngine.cpp clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp clang/lib/StaticAnalyzer/Core/LoopWidening.cpp clang/lib/StaticAnalyzer/Core/MemRegion.cpp clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp clang/lib/StaticAnalyzer/Core/PrettyStackTraceLocationContext.h clang/lib/StaticAnalyzer/Core/ProgramState.cpp clang/lib/StaticAnalyzer/Core/RangedConstraintManager.cpp clang/lib/StaticAnalyzer/Core/RegionStore.cpp clang/lib/StaticAnalyzer/Core/SValBuilder.cpp clang/lib/StaticAnalyzer/Core/SVals.cpp clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp clang/lib/StaticAnalyzer/Core/Store.cpp clang/lib/StaticAnalyzer/Core/SymbolManager.cpp clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp clang/lib/StaticAnalyzer/Core/WorkList.cpp clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp clang/lib/StaticAnalyzer/Frontend/ModelInjector.h
View the diff from clang-format here.
diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
index f29efb9721..b95095d218 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
@@ -138,8 +138,8 @@ private:
 
   // The first-choice implementation: use `widen` when it is available.
   template <typename T>
-  static auto widenInternal(Rank0, T &Current,
-                            const T &Prev) -> decltype(Current.widen(Prev)) {
+  static auto widenInternal(Rank0, T &Current, const T &Prev)
+      -> decltype(Current.widen(Prev)) {
     return Current.widen(Prev);
   }
 
@@ -247,13 +247,13 @@ runDataflowAnalysis(
 // FIXME: Make all classes derived from `DataflowAnalysis` take an `Environment`
 // parameter in their constructor so that we can get rid of this abomination.
 template <typename AnalysisT>
-auto createAnalysis(ASTContext &ASTCtx,
-                    Environment &Env) -> decltype(AnalysisT(ASTCtx, Env)) {
+auto createAnalysis(ASTContext &ASTCtx, Environment &Env)
+    -> decltype(AnalysisT(ASTCtx, Env)) {
   return AnalysisT(ASTCtx, Env);
 }
 template <typename AnalysisT>
-auto createAnalysis(ASTContext &ASTCtx,
-                    Environment &Env) -> decltype(AnalysisT(ASTCtx)) {
+auto createAnalysis(ASTContext &ASTCtx, Environment &Env)
+    -> decltype(AnalysisT(ASTCtx)) {
   return AnalysisT(ASTCtx);
 }
 
diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp
index 9a6f158bfd..9c24983a48 100644
--- a/clang/lib/Analysis/BodyFarm.cpp
+++ b/clang/lib/Analysis/BodyFarm.cpp
@@ -422,9 +422,9 @@ static Stmt *create_call_once(ASTContext &C, const FunctionDecl *D) {
 
   // First two arguments are used for the flag and for the callback.
   if (D->getNumParams() != CallbackFunctionType->getNumParams() + 2) {
-    LLVM_DEBUG(llvm::dbgs()
-               << "Types of params of the callback do not match "
-               << "params passed to std::call_once, " << "ignoring the call\n");
+    LLVM_DEBUG(llvm::dbgs() << "Types of params of the callback do not match "
+                            << "params passed to std::call_once, "
+                            << "ignoring the call\n");
     return nullptr;
   }
 
diff --git a/clang/lib/Analysis/ProgramPoint.cpp b/clang/lib/Analysis/ProgramPoint.cpp
index 1404f1d401..50db61da55 100644
--- a/clang/lib/Analysis/ProgramPoint.cpp
+++ b/clang/lib/Analysis/ProgramPoint.cpp
@@ -58,7 +58,8 @@ void ProgramPoint::printJson(llvm::raw_ostream &Out, const char *NL) const {
   Out << "\"kind\": \"";
   switch (getKind()) {
   case ProgramPoint::BlockEntranceKind:
-    Out << "BlockEntrance\"" << ", \"block_id\": "
+    Out << "BlockEntrance\""
+        << ", \"block_id\": "
         << castAs<BlockEntrance>().getBlock()->getBlockID();
     break;
 
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index e31dd0f0f5..e1ff0d92f6 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -2052,8 +2052,8 @@ fixUPCAddressofArraySubscriptWithSpan(const UnaryOperator *Node) {
     if (!IndexString)
       return std::nullopt;
 
-    SS << "&" << (*DreString).str() << ".data()" << "[" << (*IndexString).str()
-       << "]";
+    SS << "&" << (*DreString).str() << ".data()"
+       << "[" << (*IndexString).str() << "]";
   }
   return FixItList{
       FixItHint::CreateReplacement(Node->getSourceRange(), SS.str())};
diff --git a/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp b/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
index cdba82cee3..05300328c4 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
@@ -1061,7 +1061,8 @@ bool ento::shouldRegisterContainerModeling(const CheckerManager &mgr) {
   if (!mgr.getAnalyzerOptions().ShouldAggressivelySimplifyBinaryOperation) {
     mgr.getASTContext().getDiagnostics().Report(
         diag::err_analyzer_checker_incompatible_analyzer_option)
-        << "aggressive-binary-operation-simplification" << "false";
+        << "aggressive-binary-operation-simplification"
+        << "false";
     return false;
   }
 
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
index f06ef3500c..06c3f45ceb 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp
@@ -226,8 +226,8 @@ public:
         else
           OS << "call";
         OS << " is converted to a pointer of type '" << PointeeType
-           << "', which is incompatible with " << "sizeof operand type '"
-           << SizeofType << "'";
+           << "', which is incompatible with "
+           << "sizeof operand type '" << SizeofType << "'";
         SmallVector<SourceRange, 4> Ranges;
         Ranges.push_back(CallRec.AllocCall->getCallee()->getSourceRange());
         Ranges.push_back(SFinder.Sizeofs[0]->getSourceRange());
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
index 5fe7d6f0db..d4d4b81413 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -820,7 +820,8 @@ PathDiagnosticPieceRef PathDiagnosticBuilder::generateDiagForBinaryOP(
   PathDiagnosticLocation Start, End;
 
   if (B->getOpcode() == BO_LAnd) {
-    os << "&&" << "' is ";
+    os << "&&"
+       << "' is ";
 
     if (*(Src->succ_begin() + 1) == Dst) {
       os << "false";
@@ -834,7 +835,8 @@ PathDiagnosticPieceRef PathDiagnosticBuilder::generateDiagForBinaryOP(
     }
   } else {
     assert(B->getOpcode() == BO_LOr);
-    os << "||" << "' is ";
+    os << "||"
+       << "' is ";
 
     if (*(Src->succ_begin() + 1) == Dst) {
       os << "false";
diff --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
index 8f55bb3e0e..80d885d71d 100644
--- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -600,9 +600,10 @@ void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic &D, Rewriter &R,
         int ColumnNumber =
             P->getLocation().asLocation().getExpansionColumnNumber();
         ++NumExtraPieces;
-        os << "<tr><td class=\"rowname\">Note:</td><td>" << "<a href=\"#Note"
-           << NumExtraPieces << "\">line " << LineNumber << ", column "
-           << ColumnNumber << "</a><br />" << P->getString() << "</td></tr>";
+        os << "<tr><td class=\"rowname\">Note:</td><td>"
+           << "<a href=\"#Note" << NumExtraPieces << "\">line " << LineNumber
+           << ", column " << ColumnNumber << "</a><br />" << P->getString()
+           << "</td></tr>";
       }
     }
 
diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
index edbb3b4f22..bd1aeecffc 100644
--- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -495,8 +495,8 @@ void CompoundLiteralRegion::dumpToStream(raw_ostream &os) const {
 }
 
 void CXXTempObjectRegion::dumpToStream(raw_ostream &os) const {
-  os << "temp_object{" << getValueType() << ", " << "S"
-     << Ex->getID(getContext()) << '}';
+  os << "temp_object{" << getValueType() << ", "
+     << "S" << Ex->getID(getContext()) << '}';
 }
 
 void CXXLifetimeExtendedObjectRegion::dumpToStream(raw_ostream &os) const {
@@ -505,7 +505,8 @@ void CXXLifetimeExtendedObjectRegion::dumpToStream(raw_ostream &os) const {
     os << ID->getName();
   else
     os << "D" << ExD->getID();
-  os << ", " << "S" << Ex->getID(getContext()) << '}';
+  os << ", "
+     << "S" << Ex->getID(getContext()) << '}';
 }
 
 void CXXBaseObjectRegion::dumpToStream(raw_ostream &os) const {

Copy link
Contributor Author

@steakhal steakhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now I don't have more time for this. I reached this part:
the end of clang/lib/Analysis/ThreadSafety.cpp

So far I haven't found anything critical. Only a handful of license headers break and maybe a few other tables looked better in the previous revision - but that's subjective.
I plan to come back and continue this.

Comment on lines +131 to +138
const TIL_Opcode COP_Min = COP_Future;
const TIL_Opcode COP_Max = COP_Branch;
const TIL_UnaryOpcode UOP_Min = UOP_Minus;
const TIL_UnaryOpcode UOP_Max = UOP_LogicNot;
const TIL_BinaryOpcode BOP_Min = BOP_Add;
const TIL_BinaryOpcode BOP_Max = BOP_LogicOr;
const TIL_CastOpcode CAST_Min = CAST_none;
const TIL_CastOpcode CAST_Max = CAST_toInt;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const TIL_Opcode COP_Min = COP_Future;
const TIL_Opcode COP_Max = COP_Branch;
const TIL_UnaryOpcode UOP_Min = UOP_Minus;
const TIL_UnaryOpcode UOP_Max = UOP_LogicNot;
const TIL_BinaryOpcode BOP_Min = BOP_Add;
const TIL_BinaryOpcode BOP_Max = BOP_LogicOr;
const TIL_CastOpcode CAST_Min = CAST_none;
const TIL_CastOpcode CAST_Max = CAST_toInt;
// clang-format off
const TIL_Opcode COP_Min = COP_Future;
const TIL_Opcode COP_Max = COP_Branch;
const TIL_UnaryOpcode UOP_Min = UOP_Minus;
const TIL_UnaryOpcode UOP_Max = UOP_LogicNot;
const TIL_BinaryOpcode BOP_Min = BOP_Add;
const TIL_BinaryOpcode BOP_Max = BOP_LogicOr;
const TIL_CastOpcode CAST_Min = CAST_none;
const TIL_CastOpcode CAST_Max = CAST_toInt;
// clang-format on

This was previously nicely aligned.

Comment on lines +190 to +201
case 1:
return ST_8;
case 2:
return ST_16;
case 4:
return ST_32;
case 8:
return ST_64;
case 16:
return ST_128;
default:
return ST_0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case 1:
return ST_8;
case 2:
return ST_16;
case 4:
return ST_32;
case 8:
return ST_64;
case 16:
return ST_128;
default:
return ST_0;
// clang-format off
case 1: return ST_8;
case 2: return ST_16;
case 4: return ST_32;
case 8: return ST_64;
case 16: return ST_128;
default: return ST_0;
// clang-format on

This was previously nicely aligned.

Comment on lines +1462 to +1469
case COP_Goto:
return cast<Goto>(this)->successors();
case COP_Branch:
return cast<Branch>(this)->successors();
case COP_Return:
return cast<Return>(this)->successors();
default:
return std::nullopt;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was aligned before, but I don't see much value keeping it.

Comment on lines +422 to +489
case COP_Future:
return Prec_Atom;
case COP_Undefined:
return Prec_Atom;
case COP_Wildcard:
return Prec_Atom;

case COP_Literal:
return Prec_Atom;
case COP_LiteralPtr:
return Prec_Atom;
case COP_Variable:
return Prec_Atom;
case COP_Function:
return Prec_Decl;
case COP_SFunction:
return Prec_Decl;
case COP_Code:
return Prec_Decl;
case COP_Field:
return Prec_Decl;

case COP_Apply:
return Prec_Postfix;
case COP_SApply:
return Prec_Postfix;
case COP_Project:
return Prec_Postfix;

case COP_Call:
return Prec_Postfix;
case COP_Alloc:
return Prec_Other;
case COP_Load:
return Prec_Postfix;
case COP_Store:
return Prec_Other;
case COP_ArrayIndex:
return Prec_Postfix;
case COP_ArrayAdd:
return Prec_Postfix;

case COP_UnaryOp:
return Prec_Unary;
case COP_BinaryOp:
return Prec_Binary;
case COP_Cast:
return Prec_Atom;

case COP_SCFG:
return Prec_Decl;
case COP_BasicBlock:
return Prec_MAX;
case COP_Phi:
return Prec_Atom;
case COP_Goto:
return Prec_Atom;
case COP_Branch:
return Prec_Atom;
case COP_Return:
return Prec_Other;

case COP_Identifier:
return Prec_Atom;
case COP_IfThenElse:
return Prec_Other;
case COP_Let:
return Prec_Decl;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case COP_Future:
return Prec_Atom;
case COP_Undefined:
return Prec_Atom;
case COP_Wildcard:
return Prec_Atom;
case COP_Literal:
return Prec_Atom;
case COP_LiteralPtr:
return Prec_Atom;
case COP_Variable:
return Prec_Atom;
case COP_Function:
return Prec_Decl;
case COP_SFunction:
return Prec_Decl;
case COP_Code:
return Prec_Decl;
case COP_Field:
return Prec_Decl;
case COP_Apply:
return Prec_Postfix;
case COP_SApply:
return Prec_Postfix;
case COP_Project:
return Prec_Postfix;
case COP_Call:
return Prec_Postfix;
case COP_Alloc:
return Prec_Other;
case COP_Load:
return Prec_Postfix;
case COP_Store:
return Prec_Other;
case COP_ArrayIndex:
return Prec_Postfix;
case COP_ArrayAdd:
return Prec_Postfix;
case COP_UnaryOp:
return Prec_Unary;
case COP_BinaryOp:
return Prec_Binary;
case COP_Cast:
return Prec_Atom;
case COP_SCFG:
return Prec_Decl;
case COP_BasicBlock:
return Prec_MAX;
case COP_Phi:
return Prec_Atom;
case COP_Goto:
return Prec_Atom;
case COP_Branch:
return Prec_Atom;
case COP_Return:
return Prec_Other;
case COP_Identifier:
return Prec_Atom;
case COP_IfThenElse:
return Prec_Other;
case COP_Let:
return Prec_Decl;
// clang-format off
case COP_Future: return Prec_Atom;
case COP_Undefined: return Prec_Atom;
case COP_Wildcard: return Prec_Atom;
case COP_Literal: return Prec_Atom;
case COP_LiteralPtr: return Prec_Atom;
case COP_Variable: return Prec_Atom;
case COP_Function: return Prec_Decl;
case COP_SFunction: return Prec_Decl;
case COP_Code: return Prec_Decl;
case COP_Field: return Prec_Decl;
case COP_Apply: return Prec_Postfix;
case COP_SApply: return Prec_Postfix;
case COP_Project: return Prec_Postfix;
case COP_Call: return Prec_Postfix;
case COP_Alloc: return Prec_Other;
case COP_Load: return Prec_Postfix;
case COP_Store: return Prec_Other;
case COP_ArrayIndex: return Prec_Postfix;
case COP_ArrayAdd: return Prec_Postfix;
case COP_UnaryOp: return Prec_Unary;
case COP_BinaryOp: return Prec_Binary;
case COP_Cast: return Prec_Atom;
case COP_SCFG: return Prec_Decl;
case COP_BasicBlock: return Prec_MAX;
case COP_Phi: return Prec_Atom;
case COP_Goto: return Prec_Atom;
case COP_Branch: return Prec_Atom;
case COP_Return: return Prec_Other;
case COP_Identifier: return Prec_Atom;
case COP_IfThenElse: return Prec_Other;
case COP_Let: return Prec_Decl;
// clang-format on

Comment on lines -901 to +881
CFGElement front() const { return Elements.front(); }
CFGElement back() const { return Elements.back(); }
CFGElement front() const { return Elements.front(); }
CFGElement back() const { return Elements.back(); }

iterator begin() { return Elements.begin(); }
iterator end() { return Elements.end(); }
const_iterator begin() const { return Elements.begin(); }
const_iterator end() const { return Elements.end(); }
iterator begin() { return Elements.begin(); }
iterator end() { return Elements.end(); }
const_iterator begin() const { return Elements.begin(); }
const_iterator end() const { return Elements.end(); }

reverse_iterator rbegin() { return Elements.rbegin(); }
reverse_iterator rend() { return Elements.rend(); }
const_reverse_iterator rbegin() const { return Elements.rbegin(); }
const_reverse_iterator rend() const { return Elements.rend(); }
reverse_iterator rbegin() { return Elements.rbegin(); }
reverse_iterator rend() { return Elements.rend(); }
const_reverse_iterator rbegin() const { return Elements.rbegin(); }
const_reverse_iterator rend() const { return Elements.rend(); }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These hunks were aligned before, but I don't think it's worth to keep it.
There are some similar later, that I won't explicitly highlight.

Comment on lines +388 to +389
/// processRegionChanges - Called by ProgramStateManager whenever a change is
/// made
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// processRegionChanges - Called by ProgramStateManager whenever a change is
/// made
/// It's called by ProgramStateManager whenever a change is made.

Comment on lines +574 to 577
/// evalEagerlyAssumeBinOpBifurcation - Given the nodes in 'Src', eagerly
/// assume symbolic
/// expressions of the form 'x != 0' and generate new nodes (stored in Dst)
/// with those assumptions.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// evalEagerlyAssumeBinOpBifurcation - Given the nodes in 'Src', eagerly
/// assume symbolic
/// expressions of the form 'x != 0' and generate new nodes (stored in Dst)
/// with those assumptions.
/// Given the nodes in 'Src', eagerly assume symbolic expressions of the form
/// 'x != 0' and generate new nodes (stored in Dst) with those assumptions.

Comment on lines +527 to +528
/// TypedValueRegion - An abstract class representing regions having a typed
/// value.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// TypedValueRegion - An abstract class representing regions having a typed
/// value.
/// An abstract class representing regions having a typed value.

Comment on lines -1 to +13
//ProgramStateTrait.h - Partial implementations of ProgramStateTrait -*- C++ -*-
// ProgramStateTrait.h - Partial implementations of ProgramStateTrait -*- C++
// -*-
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
// Exceptions. See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines partial implementations of template specializations of
// the class ProgramStateTrait<>. ProgramStateTrait<> is used by ProgramState
// to implement set/get methods for manipulating a ProgramState's
// generic data map.
// This file defines partial implementations of template specializations of
// the class ProgramStateTrait<>. ProgramStateTrait<> is used by ProgramState
// to implement set/get methods for manipulating a ProgramState's
// generic data map.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment header is just bad. I should come back to this.

Comment on lines +783 to +784
// FIXME: Provide better range information for different
// terminators.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// FIXME: Provide better range information for different
// terminators.
// FIXME: Provide better range information for different terminators.

Copy link
Contributor Author

@steakhal steakhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeey, my review is done.
We only have a handful (<50) debatable formatting problems.

I'll try to fix them in an other PR.

Comment on lines +568 to +628
case BO_Mul:
return translateBinOp(til::BOP_Mul, BO, Ctx);
case BO_Div:
return translateBinOp(til::BOP_Div, BO, Ctx);
case BO_Rem:
return translateBinOp(til::BOP_Rem, BO, Ctx);
case BO_Add:
return translateBinOp(til::BOP_Add, BO, Ctx);
case BO_Sub:
return translateBinOp(til::BOP_Sub, BO, Ctx);
case BO_Shl:
return translateBinOp(til::BOP_Shl, BO, Ctx);
case BO_Shr:
return translateBinOp(til::BOP_Shr, BO, Ctx);
case BO_LT:
return translateBinOp(til::BOP_Lt, BO, Ctx);
case BO_GT:
return translateBinOp(til::BOP_Lt, BO, Ctx, true);
case BO_LE:
return translateBinOp(til::BOP_Leq, BO, Ctx);
case BO_GE:
return translateBinOp(til::BOP_Leq, BO, Ctx, true);
case BO_EQ:
return translateBinOp(til::BOP_Eq, BO, Ctx);
case BO_NE:
return translateBinOp(til::BOP_Neq, BO, Ctx);
case BO_Cmp:
return translateBinOp(til::BOP_Cmp, BO, Ctx);
case BO_And:
return translateBinOp(til::BOP_BitAnd, BO, Ctx);
case BO_Xor:
return translateBinOp(til::BOP_BitXor, BO, Ctx);
case BO_Or:
return translateBinOp(til::BOP_BitOr, BO, Ctx);
case BO_LAnd:
return translateBinOp(til::BOP_LogicAnd, BO, Ctx);
case BO_LOr:
return translateBinOp(til::BOP_LogicOr, BO, Ctx);

case BO_Assign:
return translateBinAssign(til::BOP_Eq, BO, Ctx, true);
case BO_MulAssign:
return translateBinAssign(til::BOP_Mul, BO, Ctx);
case BO_DivAssign:
return translateBinAssign(til::BOP_Div, BO, Ctx);
case BO_RemAssign:
return translateBinAssign(til::BOP_Rem, BO, Ctx);
case BO_AddAssign:
return translateBinAssign(til::BOP_Add, BO, Ctx);
case BO_SubAssign:
return translateBinAssign(til::BOP_Sub, BO, Ctx);
case BO_ShlAssign:
return translateBinAssign(til::BOP_Shl, BO, Ctx);
case BO_ShrAssign:
return translateBinAssign(til::BOP_Shr, BO, Ctx);
case BO_AndAssign:
return translateBinAssign(til::BOP_BitAnd, BO, Ctx);
case BO_XorAssign:
return translateBinAssign(til::BOP_BitXor, BO, Ctx);
case BO_OrAssign:
return translateBinAssign(til::BOP_BitOr, BO, Ctx);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case BO_Mul:
return translateBinOp(til::BOP_Mul, BO, Ctx);
case BO_Div:
return translateBinOp(til::BOP_Div, BO, Ctx);
case BO_Rem:
return translateBinOp(til::BOP_Rem, BO, Ctx);
case BO_Add:
return translateBinOp(til::BOP_Add, BO, Ctx);
case BO_Sub:
return translateBinOp(til::BOP_Sub, BO, Ctx);
case BO_Shl:
return translateBinOp(til::BOP_Shl, BO, Ctx);
case BO_Shr:
return translateBinOp(til::BOP_Shr, BO, Ctx);
case BO_LT:
return translateBinOp(til::BOP_Lt, BO, Ctx);
case BO_GT:
return translateBinOp(til::BOP_Lt, BO, Ctx, true);
case BO_LE:
return translateBinOp(til::BOP_Leq, BO, Ctx);
case BO_GE:
return translateBinOp(til::BOP_Leq, BO, Ctx, true);
case BO_EQ:
return translateBinOp(til::BOP_Eq, BO, Ctx);
case BO_NE:
return translateBinOp(til::BOP_Neq, BO, Ctx);
case BO_Cmp:
return translateBinOp(til::BOP_Cmp, BO, Ctx);
case BO_And:
return translateBinOp(til::BOP_BitAnd, BO, Ctx);
case BO_Xor:
return translateBinOp(til::BOP_BitXor, BO, Ctx);
case BO_Or:
return translateBinOp(til::BOP_BitOr, BO, Ctx);
case BO_LAnd:
return translateBinOp(til::BOP_LogicAnd, BO, Ctx);
case BO_LOr:
return translateBinOp(til::BOP_LogicOr, BO, Ctx);
case BO_Assign:
return translateBinAssign(til::BOP_Eq, BO, Ctx, true);
case BO_MulAssign:
return translateBinAssign(til::BOP_Mul, BO, Ctx);
case BO_DivAssign:
return translateBinAssign(til::BOP_Div, BO, Ctx);
case BO_RemAssign:
return translateBinAssign(til::BOP_Rem, BO, Ctx);
case BO_AddAssign:
return translateBinAssign(til::BOP_Add, BO, Ctx);
case BO_SubAssign:
return translateBinAssign(til::BOP_Sub, BO, Ctx);
case BO_ShlAssign:
return translateBinAssign(til::BOP_Shl, BO, Ctx);
case BO_ShrAssign:
return translateBinAssign(til::BOP_Shr, BO, Ctx);
case BO_AndAssign:
return translateBinAssign(til::BOP_BitAnd, BO, Ctx);
case BO_XorAssign:
return translateBinAssign(til::BOP_BitXor, BO, Ctx);
case BO_OrAssign:
return translateBinAssign(til::BOP_BitOr, BO, Ctx);
// clang-format off
case BO_Mul: return translateBinOp(til::BOP_Mul, BO, Ctx);
case BO_Div: return translateBinOp(til::BOP_Div, BO, Ctx);
case BO_Rem: return translateBinOp(til::BOP_Rem, BO, Ctx);
case BO_Add: return translateBinOp(til::BOP_Add, BO, Ctx);
case BO_Sub: return translateBinOp(til::BOP_Sub, BO, Ctx);
case BO_Shl: return translateBinOp(til::BOP_Shl, BO, Ctx);
case BO_Shr: return translateBinOp(til::BOP_Shr, BO, Ctx);
case BO_LT: return translateBinOp(til::BOP_Lt, BO, Ctx);
case BO_GT: return translateBinOp(til::BOP_Lt, BO, Ctx, true);
case BO_LE: return translateBinOp(til::BOP_Leq, BO, Ctx);
case BO_GE: return translateBinOp(til::BOP_Leq, BO, Ctx, true);
case BO_EQ: return translateBinOp(til::BOP_Eq, BO, Ctx);
case BO_NE: return translateBinOp(til::BOP_Neq, BO, Ctx);
case BO_Cmp: return translateBinOp(til::BOP_Cmp, BO, Ctx);
case BO_And: return translateBinOp(til::BOP_BitAnd, BO, Ctx);
case BO_Xor: return translateBinOp(til::BOP_BitXor, BO, Ctx);
case BO_Or: return translateBinOp(til::BOP_BitOr, BO, Ctx);
case BO_LAnd: return translateBinOp(til::BOP_LogicAnd, BO, Ctx);
case BO_LOr: return translateBinOp(til::BOP_LogicOr, BO, Ctx);
case BO_Assign: return translateBinAssign(til::BOP_Eq, BO, Ctx, true);
case BO_MulAssign: return translateBinAssign(til::BOP_Mul, BO, Ctx);
case BO_DivAssign: return translateBinAssign(til::BOP_Div, BO, Ctx);
case BO_RemAssign: return translateBinAssign(til::BOP_Rem, BO, Ctx);
case BO_AddAssign: return translateBinAssign(til::BOP_Add, BO, Ctx);
case BO_SubAssign: return translateBinAssign(til::BOP_Sub, BO, Ctx);
case BO_ShlAssign: return translateBinAssign(til::BOP_Shl, BO, Ctx);
case BO_ShrAssign: return translateBinAssign(til::BOP_Shr, BO, Ctx);
case BO_AndAssign: return translateBinAssign(til::BOP_BitAnd, BO, Ctx);
case BO_XorAssign: return translateBinAssign(til::BOP_BitXor, BO, Ctx);
case BO_OrAssign: return translateBinAssign(til::BOP_BitOr, BO, Ctx);
// clang-format on

Comment on lines +33 to +66
case BOP_Mul:
return "*";
case BOP_Div:
return "/";
case BOP_Rem:
return "%";
case BOP_Add:
return "+";
case BOP_Sub:
return "-";
case BOP_Shl:
return "<<";
case BOP_Shr:
return ">>";
case BOP_BitAnd:
return "&";
case BOP_BitXor:
return "^";
case BOP_BitOr:
return "|";
case BOP_Eq:
return "==";
case BOP_Neq:
return "!=";
case BOP_Lt:
return "<";
case BOP_Leq:
return "<=";
case BOP_Cmp:
return "<=>";
case BOP_LogicAnd:
return "&&";
case BOP_LogicOr:
return "||";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case BOP_Mul:
return "*";
case BOP_Div:
return "/";
case BOP_Rem:
return "%";
case BOP_Add:
return "+";
case BOP_Sub:
return "-";
case BOP_Shl:
return "<<";
case BOP_Shr:
return ">>";
case BOP_BitAnd:
return "&";
case BOP_BitXor:
return "^";
case BOP_BitOr:
return "|";
case BOP_Eq:
return "==";
case BOP_Neq:
return "!=";
case BOP_Lt:
return "<";
case BOP_Leq:
return "<=";
case BOP_Cmp:
return "<=>";
case BOP_LogicAnd:
return "&&";
case BOP_LogicOr:
return "||";
// clang-format off
case BOP_Mul: return "*";
case BOP_Div: return "/";
case BOP_Rem: return "%";
case BOP_Add: return "+";
case BOP_Sub: return "-";
case BOP_Shl: return "<<";
case BOP_Shr: return ">>";
case BOP_BitAnd: return "&";
case BOP_BitXor: return "^";
case BOP_BitOr: return "|";
case BOP_Eq: return "==";
case BOP_Neq: return "!=";
case BOP_Lt: return "<";
case BOP_Leq: return "<=";
case BOP_Cmp: return "<=>";
case BOP_LogicAnd: return "&&";
case BOP_LogicOr: return "||";
// clang-format on

Comment on lines +387 to +413
case kCFNumberCharType:
T = Ctx.CharTy;
break;
case kCFNumberShortType:
T = Ctx.ShortTy;
break;
case kCFNumberIntType:
T = Ctx.IntTy;
break;
case kCFNumberLongType:
T = Ctx.LongTy;
break;
case kCFNumberLongLongType:
T = Ctx.LongLongTy;
break;
case kCFNumberFloatType:
T = Ctx.FloatTy;
break;
case kCFNumberDoubleType:
T = Ctx.DoubleTy;
break;
case kCFNumberCFIndexType:
case kCFNumberNSIntegerType:
case kCFNumberCGFloatType:
// FIXME: We need a way to map from names to Type*.
default:
return std::nullopt;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case kCFNumberCharType:
T = Ctx.CharTy;
break;
case kCFNumberShortType:
T = Ctx.ShortTy;
break;
case kCFNumberIntType:
T = Ctx.IntTy;
break;
case kCFNumberLongType:
T = Ctx.LongTy;
break;
case kCFNumberLongLongType:
T = Ctx.LongLongTy;
break;
case kCFNumberFloatType:
T = Ctx.FloatTy;
break;
case kCFNumberDoubleType:
T = Ctx.DoubleTy;
break;
case kCFNumberCFIndexType:
case kCFNumberNSIntegerType:
case kCFNumberCGFloatType:
// FIXME: We need a way to map from names to Type*.
default:
return std::nullopt;
// clang-format off
case kCFNumberCharType: T = Ctx.CharTy; break;
case kCFNumberShortType: T = Ctx.ShortTy; break;
case kCFNumberIntType: T = Ctx.IntTy; break;
case kCFNumberLongType: T = Ctx.LongTy; break;
case kCFNumberLongLongType: T = Ctx.LongLongTy; break;
case kCFNumberFloatType: T = Ctx.FloatTy; break;
case kCFNumberDoubleType: T = Ctx.DoubleTy; break;
case kCFNumberCFIndexType:
case kCFNumberNSIntegerType:
case kCFNumberCGFloatType:
// FIXME: We need a way to map from names to Type*.
default:
return std::nullopt;
// clang-format on

Comment on lines +548 to +549
// CFRetain/CFRelease/CFMakeCollectable/CFAutorelease checking for null
// arguments.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is debatable formatting.

Comment on lines +231 to +234
os << "Replace with 'sizeof(" << DstName
<< ") "
"- strlen("
<< DstName << ") - 1'";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad formatting.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, lots of these ostream chained operators are written to reflect coherent bits of output, and clang-format will be unaware of the semantic relevance. I think clang-format off is the only solution here.

Comment on lines +1 to +2
//===- ObjCAutoreleaseWriteChecker.cpp ----------------------------*- C++
//-*-==//
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//===- ObjCAutoreleaseWriteChecker.cpp ----------------------------*- C++
//-*-==//
//===- ObjCAutoreleaseWriteChecker.cpp ---------------------------*- C++ -*-==//

Comment on lines 57 to +85
std::vector<std::string> SelectorsWithAutoreleasingPool = {
// Common to NSArray, NSSet, NSOrderedSet
"enumerateObjectsUsingBlock:",
"enumerateObjectsWithOptions:usingBlock:",
"enumerateObjectsUsingBlock:", "enumerateObjectsWithOptions:usingBlock:",

// Common to NSArray and NSOrderedSet
"enumerateObjectsAtIndexes:options:usingBlock:",
"indexOfObjectAtIndexes:options:passingTest:",
"indexesOfObjectsAtIndexes:options:passingTest:",
"indexOfObjectPassingTest:",
"indexOfObjectWithOptions:passingTest:",
"indexOfObjectPassingTest:", "indexOfObjectWithOptions:passingTest:",
"indexesOfObjectsPassingTest:",
"indexesOfObjectsWithOptions:passingTest:",

// NSDictionary
"enumerateKeysAndObjectsUsingBlock:",
"enumerateKeysAndObjectsWithOptions:usingBlock:",
"keysOfEntriesPassingTest:",
"keysOfEntriesWithOptions:passingTest:",
"keysOfEntriesPassingTest:", "keysOfEntriesWithOptions:passingTest:",

// NSSet
"objectsPassingTest:",
"objectsWithOptions:passingTest:",
"objectsPassingTest:", "objectsWithOptions:passingTest:",
"enumerateIndexPathsWithOptions:usingBlock:",

// NSIndexSet
"enumerateIndexesWithOptions:usingBlock:",
"enumerateIndexesUsingBlock:",
"enumerateIndexesWithOptions:usingBlock:", "enumerateIndexesUsingBlock:",
"enumerateIndexesInRange:options:usingBlock:",
"enumerateRangesUsingBlock:",
"enumerateRangesWithOptions:usingBlock:",
"enumerateRangesInRange:options:usingBlock:",
"indexPassingTest:",
"indexesPassingTest:",
"indexWithOptions:passingTest:",
"indexesWithOptions:passingTest:",
"indexInRange:options:passingTest:",
"indexesInRange:options:passingTest:"
};
"enumerateRangesUsingBlock:", "enumerateRangesWithOptions:usingBlock:",
"enumerateRangesInRange:options:usingBlock:", "indexPassingTest:",
"indexesPassingTest:", "indexWithOptions:passingTest:",
"indexesWithOptions:passingTest:", "indexInRange:options:passingTest:",
"indexesInRange:options:passingTest:"};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad formatting for the SelectorsWithAutoreleasingPool member.

Comment on lines +1 to +2
//===-- STLAlgorithmModeling.cpp -----------------------------------*- C++
//-*--//
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//===-- STLAlgorithmModeling.cpp -----------------------------------*- C++
//-*--//
//===-- STLAlgorithmModeling.cpp ----------------------------------*- C++ -*--//

Comment on lines +1 to +2
//===-- SimpleStreamChecker.cpp -----------------------------------------*- C++
//-*--//
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//===-- SimpleStreamChecker.cpp -----------------------------------------*- C++
//-*--//
//===-- SimpleStreamChecker.cpp -----------------------------------*- C++ -*--//

Comment on lines +117 to +148
default:
llvm_unreachable("Invalid opcode for compound assignment.");
case BO_MulAssign:
Op = BO_Mul;
break;
case BO_DivAssign:
Op = BO_Div;
break;
case BO_RemAssign:
Op = BO_Rem;
break;
case BO_AddAssign:
Op = BO_Add;
break;
case BO_SubAssign:
Op = BO_Sub;
break;
case BO_ShlAssign:
Op = BO_Shl;
break;
case BO_ShrAssign:
Op = BO_Shr;
break;
case BO_AndAssign:
Op = BO_And;
break;
case BO_XorAssign:
Op = BO_Xor;
break;
case BO_OrAssign:
Op = BO_Or;
break;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default:
llvm_unreachable("Invalid opcode for compound assignment.");
case BO_MulAssign:
Op = BO_Mul;
break;
case BO_DivAssign:
Op = BO_Div;
break;
case BO_RemAssign:
Op = BO_Rem;
break;
case BO_AddAssign:
Op = BO_Add;
break;
case BO_SubAssign:
Op = BO_Sub;
break;
case BO_ShlAssign:
Op = BO_Shl;
break;
case BO_ShrAssign:
Op = BO_Shr;
break;
case BO_AndAssign:
Op = BO_And;
break;
case BO_XorAssign:
Op = BO_Xor;
break;
case BO_OrAssign:
Op = BO_Or;
break;
// clang-format off
default:
llvm_unreachable("Invalid opcode for compound assignment.");
case BO_MulAssign: Op = BO_Mul; break;
case BO_DivAssign: Op = BO_Div; break;
case BO_RemAssign: Op = BO_Rem; break;
case BO_AddAssign: Op = BO_Add; break;
case BO_SubAssign: Op = BO_Sub; break;
case BO_ShlAssign: Op = BO_Shl; break;
case BO_ShrAssign: Op = BO_Shr; break;
case BO_AndAssign: Op = BO_And; break;
case BO_XorAssign: Op = BO_Xor; break;
case BO_OrAssign: Op = BO_Or; break;
// clang-format on

@steakhal
Copy link
Contributor Author

I've submitted PRs to resolve the pending formatting issues.

@whisperity whisperity added the wontfix Issue is real, but we can't or won't fix it. Not invalid label Feb 25, 2024
@whisperity
Copy link
Member

(In case you do intend to merge changes related to formatting, consider adding the resulting commit hash into the blame-ignore file.)

@steakhal
Copy link
Contributor Author

(In case you do intend to merge changes related to formatting, consider adding the resulting commit hash into the blame-ignore file.)

I dont intend to merge this.

Copy link
Collaborator

@pogo59 pogo59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to feed back some of these examples to the RFC. Improving how clang-format handles some of these cases (esp. the doxygen ones) would help progress toward the goal.

Comment on lines +388 to +389
/// processRegionChanges - Called by ProgramStateManager whenever a change is
/// made
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// processRegionChanges - Called by ProgramStateManager whenever a change is
/// made
/// Called by ProgramStateManager whenever a change is made

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how smart clang-format is about Doxygen comments. It's very common to have the function name repeated at the beginning of the comment, which is somewhere between unnecessary (due to Doxygen changes) and producing bad-looking documentation.

Comment on lines -110 to +111
/// \copydoc clang::ento::CallDescription::matchesAny(const CallEvent &, const CallDescription &)
/// \copydoc clang::ento::CallDescription::matchesAny(const CallEvent &, const
/// CallDescription &)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think clang-format would have to be taught not to break lines starting with Doxygen directives.

Comment on lines +231 to +234
os << "Replace with 'sizeof(" << DstName
<< ") "
"- strlen("
<< DstName << ") - 1'";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, lots of these ostream chained operators are written to reflect coherent bits of output, and clang-format will be unaware of the semantic relevance. I think clang-format off is the only solution here.

Comment on lines +256 to 258
os << "The third argument allows to potentially copy more bytes than it "
"should. ";
os << "Replace with the value ";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
os << "The third argument allows to potentially copy more bytes than it "
"should. ";
os << "Replace with the value ";
os << "The third argument allows to potentially copy more bytes than it "
"should. Replace with the value ";

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format can't do that sort of thing automatically. Breaking the too-long line is correct IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:static analyzer wontfix Issue is real, but we can't or won't fix it. Not invalid
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants