[clang] [clang] Fix FnInfoOpts::operator&= and FnInfoOpts::operator|= not updating assigned operands (PR #107050)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 2 23:05:51 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-codegen

Author: None (mylai-mtk)

<details>
<summary>Changes</summary>

Hi, this is my first time sending a PR to the LLVM repo.
I ran into this bug when implementing a feature in my private repo, and I think maybe I can take this small patch as a chance to practice contributing to LLVM, so here I publish the fix to this small but certain bug :)

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


1 Files Affected:

- (modified) clang/lib/CodeGen/CGCall.h (+2-2) 


``````````diff
diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index 6fa65e1916183a..21cc8504bf25cc 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -450,12 +450,12 @@ inline FnInfoOpts operator&(FnInfoOpts A, FnInfoOpts B) {
                                  llvm::to_underlying(B));
 }
 
-inline FnInfoOpts operator|=(FnInfoOpts A, FnInfoOpts B) {
+inline FnInfoOpts& operator|=(FnInfoOpts &A, FnInfoOpts B) {
   A = A | B;
   return A;
 }
 
-inline FnInfoOpts operator&=(FnInfoOpts A, FnInfoOpts B) {
+inline FnInfoOpts& operator&=(FnInfoOpts &A, FnInfoOpts B) {
   A = A & B;
   return A;
 }

``````````

</details>


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


More information about the cfe-commits mailing list