[cfe-dev] Building clang with Visual Studio

lambda at niklas.org lambda at niklas.org
Sat Feb 28 10:17:22 PST 2009


I built LLVM with clang in VS2008 today, using CMake to generate the
project files. It went pretty smoothly, but it choked in a couple of
places. Below is the fixes I made to make it work, renaming a parameter
that it got hung up on, and restating an initialization it couldn't
handle. It works fine so far on my toy programs.

Niklas

Index: lib/Analysis/GRExprEngine.cpp

===================================================================

--- lib/Analysis/GRExprEngine.cpp	(revision 65689)

+++ lib/Analysis/GRExprEngine.cpp	(working copy)

@@ -1357,7 +1357,7 @@

 // Transfer function: Objective-C ivar references.
 //===----------------------------------------------------------------------===//

-static std::pair<const void*,const void*>
EagerlyAssumeTag(&EagerlyAssumeTag,0);
+static std::pair<const void*,const void*>
EagerlyAssumeTag=std::pair<const void*,const void*>(&EagerlyAssumeTag,0);

 void GRExprEngine::EvalEagerlyAssume(NodeSet &Dst, NodeSet &Src, Expr *Ex) {
   for (NodeSet::iterator I=Src.begin(), E=Src.end(); I!=E; ++I) {
Index: lib/CodeGen/CGBlocks.cpp

===================================================================

--- lib/CodeGen/CGBlocks.cpp	(revision 65689)

+++ lib/CodeGen/CGBlocks.cpp	(working copy)

@@ -472,17 +472,17 @@

   return Builder.CreateLoad(LocalDeclMap[getBlockStructDecl()], "self");
 }

-llvm::Function *CodeGenFunction::GenerateBlockFunction(const BlockExpr
*Expr,
+llvm::Function *CodeGenFunction::GenerateBlockFunction(const BlockExpr
*BExpr,
                                                        const BlockInfo&
Info,
                                                        uint64_t &Size,
                                                        uint64_t &Align,
                          llvm::SmallVector<const Expr *, 8>
&subBlockDeclRefDecls) {
   const FunctionProtoType *FTy =
-    cast<FunctionProtoType>(Expr->getFunctionType());
+    cast<FunctionProtoType>(BExpr->getFunctionType());

   FunctionArgList Args;

-  const BlockDecl *BD = Expr->getBlockDecl();
+  const BlockDecl *BD = BExpr->getBlockDecl();

   // FIXME: This leaks
   ImplicitParamDecl *SelfDecl =
@@ -510,9 +510,9 @@

                            &CGM.getModule());

   StartFunction(BD, FTy->getResultType(), Fn, Args,
-                Expr->getBody()->getLocEnd());
-  EmitStmt(Expr->getBody());
-  FinishFunction(cast<CompoundStmt>(Expr->getBody())->getRBracLoc());
+                BExpr->getBody()->getLocEnd());
+  EmitStmt(BExpr->getBody());
+  FinishFunction(cast<CompoundStmt>(BExpr->getBody())->getRBracLoc());

   // The runtime needs a minimum alignment of a void *.
   uint64_t MinAlign = getContext().getTypeAlign(getContext().VoidPtrTy) / 8;
Index: lib/CodeGen/CodeGenFunction.h

===================================================================

--- lib/CodeGen/CodeGenFunction.h	(revision 65689)

+++ lib/CodeGen/CodeGenFunction.h	(working copy)

@@ -279,7 +279,7 @@

       : BlockLiteralTy(blt), Name(n) {}
   };

-  llvm::Function *GenerateBlockFunction(const BlockExpr *Expr,
+  llvm::Function *GenerateBlockFunction(const BlockExpr *BExpr,
                                         const BlockInfo& Info,
                                         uint64_t &Size, uint64_t &Align,
                                         llvm::SmallVector<const Expr *,
8> &subBlockDeclRefDecls);





More information about the cfe-dev mailing list