diff options
author | Anders Carlsson <andersca@mac.com> | 2008-08-25 01:38:19 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2008-08-25 01:38:19 +0000 |
commit | 4c03d98e4506d189afc30d4146ddecb68ee68fef (patch) | |
tree | e5b4a414fa3542199eaf93958078a0d4de35d6f3 /clang/lib/CodeGen/CGDecl.cpp | |
parent | 934b374bc8e5d17b68bb825e9d606764214f2377 (diff) | |
download | bcm5719-llvm-4c03d98e4506d189afc30d4146ddecb68ee68fef.tar.gz bcm5719-llvm-4c03d98e4506d189afc30d4146ddecb68ee68fef.zip |
Handle static variables inside obj-c methods.
llvm-svn: 55297
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index b60e20fda5a..c0ad1079bec 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -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 @@ CodeGenFunction::GenerateStaticBlockVarDecl(const VarDecl &D, 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, |