diff options
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 7a51814325..6ecc2cce53 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1962,38 +1962,6 @@ unsigned FunctionDecl::getMinRequiredArguments() const { return NumRequiredArgs; } -bool FunctionDecl::isInlined() const { - if (IsInline) - return true; - - if (isa<CXXMethodDecl>(this)) { - if (!isOutOfLine() || getCanonicalDecl()->isInlineSpecified()) - return true; - } - - switch (getTemplateSpecializationKind()) { - case TSK_Undeclared: - case TSK_ExplicitSpecialization: - return false; - - case TSK_ImplicitInstantiation: - case TSK_ExplicitInstantiationDeclaration: - case TSK_ExplicitInstantiationDefinition: - // Handle below. - break; - } - - const FunctionDecl *PatternDecl = getTemplateInstantiationPattern(); - bool HasPattern = false; - if (PatternDecl) - HasPattern = PatternDecl->hasBody(PatternDecl); - - if (HasPattern && PatternDecl) - return PatternDecl->isInlined(); - - return false; -} - static bool RedeclForcesDefC99(const FunctionDecl *Redecl) { // Only consider file-scope declarations in this test. if (!Redecl->getLexicalDeclContext()->isTranslationUnit()) @@ -2069,8 +2037,8 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const { return FoundBody; } -/// \brief For an inline function definition in C or C++, determine whether the -/// definition will be externally visible. +/// \brief For an inline function definition in C, or for a gnu_inline function +/// in C++, determine whether the definition will be externally visible. /// /// Inline function definitions are always available for inlining optimizations. /// However, depending on the language dialect, declaration specifiers, and @@ -2114,6 +2082,10 @@ bool FunctionDecl::isInlineDefinitionExternallyVisible() const { return false; } + // The rest of this function is C-only. + assert(!Context.getLangOpts().CPlusPlus && + "should not use C inline rules in C++"); + // C99 6.7.4p6: // [...] If all of the file scope declarations for a function in a // translation unit include the inline function specifier without extern, |