[cfe-commits] r55297 - /cfe/trunk/lib/CodeGen/CGDecl.cpp
Anders Carlsson
andersca at mac.com
Sun Aug 24 18:38:20 PDT 2008
Author: andersca
Date: Sun Aug 24 20:38:19 2008
New Revision: 55297
URL: http://llvm.org/viewvc/llvm-project?rev=55297&view=rev
Log:
Handle static variables inside obj-c methods.
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=55297&r1=55296&r2=55297&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Sun Aug 24 20:38:19 2008
@@ -16,6 +16,7 @@
#include "CodeGenModule.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/GlobalVariable.h"
@@ -98,10 +99,13 @@
assert(Init && "Unable to create initialiser for static decl");
std::string ContextName;
- if (const FunctionDecl * FD = dyn_cast<FunctionDecl>(CurFuncDecl))
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurFuncDecl))
ContextName = FD->getName();
+ else if (isa<ObjCMethodDecl>(CurFuncDecl))
+ ContextName = std::string(CurFn->getNameStart(),
+ CurFn->getNameStart() + CurFn->getNameLen());
else
- assert(0 && "Unknown context for block var decl"); // FIXME Handle objc.
+ assert(0 && "Unknown context for block var decl");
llvm::GlobalValue *GV =
new llvm::GlobalVariable(Init->getType(), false,
More information about the cfe-commits
mailing list