diff options
| author | John McCall <rjmccall@apple.com> | 2010-12-15 04:00:32 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-12-15 04:00:32 +0000 |
| commit | 357d0f3cafc476578bdfa7c75e97a05b3f9ac1cd (patch) | |
| tree | 7de625ed2983d13352c442ce12bdbfcdc577ef41 /clang/lib/Sema/SemaDecl.cpp | |
| parent | 5d32b709678f74892fb5031930775b06ae1a3b50 (diff) | |
| download | bcm5719-llvm-357d0f3cafc476578bdfa7c75e97a05b3f9ac1cd.tar.gz bcm5719-llvm-357d0f3cafc476578bdfa7c75e97a05b3f9ac1cd.zip | |
Set the "implicitly inline" bit on a method as soon as we see a definition
within the class. Teach IR gen to look for function definitions in record
lexical contexts when deciding whether to emit a function whose address
was taken. Fixes PR8789.
llvm-svn: 121833
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 3506456eb75..17a1a1badb5 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3735,6 +3735,12 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, NewFD->setAccess(AS_public); } + if (isa<CXXMethodDecl>(NewFD) && DC == CurContext && IsFunctionDefinition) { + // A method is implicitly inline if it's defined in its class + // definition. + NewFD->setImplicitlyInline(); + } + if (SC == SC_Static && isa<CXXMethodDecl>(NewFD) && !CurContext->isRecord()) { // C++ [class.static]p1: |

