]> granicus.if.org Git - clang/commitdiff
Method who have definitions in structs/classes are semantically inline.
authorChris Lattner <sabre@nondot.org>
Tue, 12 May 2009 20:55:07 +0000 (20:55 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 12 May 2009 20:55:07 +0000 (20:55 +0000)
Per the FIXME, it might be interesting to track whether the inline keyword
was also used on the method, but for now we don't do this.  Testcase pending.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71589 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index c778ca6c2925e7c0166e48822d22ad201d9f7624..d8b6f45e37a9d44fb924b939b95a23aeeea85612 100644 (file)
@@ -2067,6 +2067,13 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
     }
     
     // This is a C++ method declaration.
+    
+    // FIXME: All inline method declarations are semantically inline.  We
+    // should add a new bit to keep track of whether they were declared with an
+    // inline keyword as well.
+    if (CurContext == DC && IsFunctionDefinition)
+      isInline = true;
+    
     NewFD = CXXMethodDecl::Create(Context, cast<CXXRecordDecl>(DC),
                                   D.getIdentifierLoc(), Name, R,
                                   (SC == FunctionDecl::Static), isInline);