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 | bfdcdc8e26097c9dbb4c40d78296f6ccc3e6684c (patch) | |
tree | 80b57258c03700b50172959830acf7fc36398940 /lib/Sema/SemaDecl.cpp | |
parent | bebbe0d9b7568ce43a464286bee49429489ef483 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3506456eb7..17a1a1badb 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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: |