[clang] [clang][Lex] Reformat suspicious condition (PR #89923)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 06:27:17 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Troy Butler (Troy-Butler)

<details>
<summary>Changes</summary>

Addresses issue #<!-- -->89805.

Assignment + comparison performed in conditional statement. Resolved by parenthesizing comparison operation.

---
Full diff: https://github.com/llvm/llvm-project/pull/89923.diff


1 Files Affected:

- (modified) clang/lib/Lex/Pragma.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp
index 499813f8ab7df0..ced407355e0015 100644
--- a/clang/lib/Lex/Pragma.cpp
+++ b/clang/lib/Lex/Pragma.cpp
@@ -1444,7 +1444,7 @@ struct PragmaWarningHandler : public PragmaHandler {
                                  .Case("once", PPCallbacks::PWS_Once)
                                  .Case("suppress", PPCallbacks::PWS_Suppress)
                                  .Default(-1);
-          if ((SpecifierValid = SpecifierInt != -1))
+          if (SpecifierValid = (SpecifierInt != -1))
             Specifier =
                 static_cast<PPCallbacks::PragmaWarningSpecifier>(SpecifierInt);
 

``````````

</details>


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


More information about the cfe-commits mailing list