diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-10 00:22:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-10 00:22:34 +0000 |
commit | 94da1587f7d584fc61df793229d197969f204cd9 (patch) | |
tree | 1f09c2f52a72685507e78317b5167f66aa0f66ff /lib/AST/ASTContext.cpp | |
parent | d1fe529b1a17a2422f28f1b938ee70453dc7199d (diff) |
Clean up our handling of Objective-C definitions in AST files. Rather
than having CodeGen check whether a declaration comes from an AST file
(which it shouldn't know or care about), make sure that the AST writer and
reader pass along "interesting" declarations that CodeGen needs to
know about.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139441 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 5fa6704dba..e3a6f4a86f 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -6387,7 +6387,7 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { if (const VarDecl *VD = dyn_cast<VarDecl>(D)) { if (!VD->isFileVarDecl()) return false; - } else if (!isa<FunctionDecl>(D)) + } else if (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)) return false; // Weak references don't produce any output by themselves. @@ -6428,6 +6428,9 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { return true; } + if (const ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(D)) + return Method->hasBody(); + const VarDecl *VD = cast<VarDecl>(D); assert(VD->isFileVarDecl() && "Expected file scoped var"); |