Skip to content

[CIR][CodeGen] Support static references to temporaries #872

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

Conversation

lanza
Copy link
Member

@lanza lanza commented Sep 20, 2024

No description provided.

Created using spr 1.3.5
Created using spr 1.3.5
@lanza lanza requested a review from bcardosolopes October 2, 2024 18:57
Copy link

github-actions bot commented Oct 2, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link

github-actions bot commented Oct 2, 2024

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

You can test this locally with the following command:
git-clang-format --diff 3ec8a752d50d2027969786b903423f2e059d20c9 f40fdeacc750aac5edcea206ae2a076ceb8d9b51 --extensions h,cpp -- clang/test/CIR/CodeGen/tempref.cpp clang/lib/CIR/CodeGen/CIRGenCXX.cpp clang/lib/CIR/CodeGen/CIRGenCXXABI.h clang/lib/CIR/CodeGen/CIRGenDeclCXX.cpp clang/lib/CIR/CodeGen/CIRGenExpr.cpp clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp clang/lib/CIR/CodeGen/CIRGenModule.cpp clang/lib/CIR/CodeGen/CIRGenModule.h clang/test/CIR/CodeGen/temporaries.cpp
View the diff from clang-format here.
diff --git a/clang/lib/CIR/CodeGen/CIRGenCXXABI.h b/clang/lib/CIR/CodeGen/CIRGenCXXABI.h
index d88bbbb3b8..7b0acae564 100644
--- a/clang/lib/CIR/CodeGen/CIRGenCXXABI.h
+++ b/clang/lib/CIR/CodeGen/CIRGenCXXABI.h
@@ -170,8 +170,7 @@ public:
   /// \param Dtor - a function taking a single pointer argument
   /// \param Addr - a pointer to pass to the destructor function.
   virtual void registerGlobalDtor(CIRGenFunction &CGF, const VarDecl *D,
-                                  mlir::cir::FuncOp dtor,
-                                  mlir::Value Addr) = 0;
+                                  mlir::cir::FuncOp dtor, mlir::Value Addr) = 0;
 
   virtual size_t getSrcArgforCopyCtor(const CXXConstructorDecl *,
                                       FunctionArgList &Args) const = 0;
diff --git a/clang/lib/CIR/CodeGen/CIRGenDeclCXX.cpp b/clang/lib/CIR/CodeGen/CIRGenDeclCXX.cpp
index 12c0e8ec2e..d508668533 100644
--- a/clang/lib/CIR/CodeGen/CIRGenDeclCXX.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenDeclCXX.cpp
@@ -51,4 +51,3 @@ void CIRGenModule::buildCXXGlobalVarDeclInitFunc(const VarDecl *D,
 
   buildCXXGlobalVarDeclInit(D, Addr, PerformInit);
 }
-
diff --git a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
index d73483fee5..5cf2e27b0d 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
@@ -1955,7 +1955,7 @@ LValue CIRGenFunction::buildCastLValue(const CastExpr *E) {
     LValue LV = buildLValue(E->getSubExpr());
     // Propagate the volatile qualifier to LValue, if exists in E.
     if (E->changesVolatileQualification())
-        llvm_unreachable("NYI");
+      llvm_unreachable("NYI");
     if (LV.isSimple()) {
       Address V = LV.getAddress();
       if (V.isValid()) {
diff --git a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
index f6d53f6715..d83d827e69 100644
--- a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
@@ -173,8 +173,7 @@ public:
                            bool Delegating, Address This,
                            QualType ThisTy) override;
   void registerGlobalDtor(CIRGenFunction &CGF, const VarDecl *D,
-                          mlir::cir::FuncOp dtor,
-                          mlir::Value Addr) override;
+                          mlir::cir::FuncOp dtor, mlir::Value Addr) override;
   virtual void buildRethrow(CIRGenFunction &CGF, bool isNoReturn) override;
   virtual void buildThrow(CIRGenFunction &CGF, const CXXThrowExpr *E) override;
   CatchTypeInfo

Created using spr 1.3.5
@bcardosolopes
Copy link
Member

@lanza some formatting errors still

@lanza
Copy link
Member Author

lanza commented Oct 2, 2024

@lanza some formatting errors still

Fixed before you replied :p

lanza added 2 commits October 2, 2024 15:34
Created using spr 1.3.5
Created using spr 1.3.5
Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

LGTM

@bcardosolopes bcardosolopes merged commit 3718d2d into users/lanza/sprmain.circodegen-support-static-references-to-temporaries Oct 8, 2024
6 checks passed
lanza added a commit that referenced this pull request Oct 11, 2024
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
lanza added a commit that referenced this pull request Nov 5, 2024
lanza added a commit that referenced this pull request Mar 18, 2025
xlauko pushed a commit to trailofbits/instafix-llvm that referenced this pull request Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants