[cfe-commits] r82910 - in /cfe/trunk/lib/CodeGen: CGCXX.cpp CGStmt.cpp CodeGenFunction.h

Daniel Dunbar daniel at zuster.org
Fri Oct 16 18:57:17 PDT 2009


Hi Anders,

On Sun, Sep 27, 2009 at 11:58 AM, Anders Carlsson <andersca at mac.com> wrote:
> Author: andersca
> Date: Sun Sep 27 13:58:34 2009
> New Revision: 82910
>
> URL: http://llvm.org/viewvc/llvm-project?rev=82910&view=rev
> Log:
> CodeGen for try statements. (We just emit the body for now).

I just want to go on record as stating I'm not very fond of this.
While we aren't likely to forget about this particular case, in
general I would prefer to error unsupported until it works. If we
absolutely want it to work for some near term gain, I guess its ok,
but we should try to make sure that such issues are tracked by a PR
then, instead of just a FIXME.

 - Daniel

> Modified:
>    cfe/trunk/lib/CodeGen/CGCXX.cpp
>    cfe/trunk/lib/CodeGen/CGStmt.cpp
>    cfe/trunk/lib/CodeGen/CodeGenFunction.h
>
> Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=82910&r1=82909&r2=82910&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGCXX.cpp Sun Sep 27 13:58:34 2009
> @@ -21,6 +21,7 @@
>  #include "clang/AST/Decl.h"
>  #include "clang/AST/DeclCXX.h"
>  #include "clang/AST/DeclObjC.h"
> +#include "clang/AST/StmtCXX.h"
>  #include "llvm/ADT/StringExtras.h"
>  using namespace clang;
>  using namespace CodeGen;
> @@ -28,10 +29,8 @@
>  void
>  CodeGenFunction::EmitCXXGlobalDtorRegistration(const CXXDestructorDecl *Dtor,
>                                                llvm::Constant *DeclPtr) {
> -  // FIXME: This is ABI dependent and we use the Itanium ABI.
> -
> -  const llvm::Type *Int8PtrTy =
> -    llvm::PointerType::getUnqual(llvm::Type::getInt8Ty(VMContext));
> +  const llvm::Type *Int8PtrTy =
> +    llvm::Type::getInt8Ty(VMContext)->getPointerTo();
>
>   std::vector<const llvm::Type *> Params;
>   Params.push_back(Int8PtrTy);
> @@ -1939,3 +1938,9 @@
>   EmitDtorEpilogue(Dtor, DtorType);
>   FinishFunction();
>  }
> +
> +// FIXME: Move this to CGCXXStmt.cpp
> +void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
> +  // FIXME: We need to do more here.
> +  EmitStmt(S.getTryBlock());
> +}
>
> Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=82910&r1=82909&r2=82910&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sun Sep 27 13:58:34 2009
> @@ -114,6 +114,10 @@
>   case Stmt::ObjCForCollectionStmtClass:
>     EmitObjCForCollectionStmt(cast<ObjCForCollectionStmt>(*S));
>     break;
> +
> +  case Stmt::CXXTryStmtClass:
> +    EmitCXXTryStmt(cast<CXXTryStmt>(*S));
> +    break;
>   }
>  }
>
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=82910&r1=82909&r2=82910&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sun Sep 27 13:58:34 2009
> @@ -40,6 +40,7 @@
>  namespace clang {
>   class ASTContext;
>   class CXXDestructorDecl;
> +  class CXXTryStmt;
>   class Decl;
>   class EnumConstantDecl;
>   class FunctionDecl;
> @@ -711,6 +712,8 @@
>   void EmitObjCAtThrowStmt(const ObjCAtThrowStmt &S);
>   void EmitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt &S);
>
> +  void EmitCXXTryStmt(const CXXTryStmt &S);
> +
>   //===--------------------------------------------------------------------===//
>   //                         LValue Expression Emission
>   //===--------------------------------------------------------------------===//
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list