[clang] [clang-tools-extra] [clang][dataflow] Cache accessors for bugprone-unchecked-optional-access (PR #112605)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 21 11:20:15 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff ae778ae7ce72219270c30d5c8b3d88c9a4803f81 38ee8196fd5e4440604d50a6b4bfce4371348b78 --extensions h,cpp -- clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
index 38e0566a82..b0bd827440 100644
--- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -603,7 +603,7 @@ void handleNonConstMemberCall(const CallExpr *CE,
                               LatticeTransferState &State) {
   // When a non-const member function is called, reset some state.
   if (RecordLoc != nullptr) {
-    for (const auto& [Field, FieldLoc] : RecordLoc->children()) {
+    for (const auto &[Field, FieldLoc] : RecordLoc->children()) {
       if (isSupportedOptionalType(Field->getType())) {
         auto *FieldRecordLoc = cast_or_null<RecordStorageLocation>(FieldLoc);
         if (FieldRecordLoc) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/112605


More information about the cfe-commits mailing list