diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-27 21:11:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-27 21:11:48 +0000 |
commit | 7ced9c8529b734e313f62a3b81189d6f402f6713 (patch) | |
tree | 285e8d2f98859e136af57377a329d8ad8eb40ca3 /lib/AST/Decl.cpp | |
parent | 0130f3cc4ccd5f46361c48d5fe94133d74619424 (diff) |
Introduce FunctionDecl::isInlined() to tell whether a function should
be inlined.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85307 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 5dccb435a5..28d0a8357e 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -642,6 +642,10 @@ unsigned FunctionDecl::getMinRequiredArguments() const { return NumRequiredArgs; } +bool FunctionDecl::isInlined() const { + return isInlineSpecified() || (isa<CXXMethodDecl>(this) && !isOutOfLine()); +} + /// \brief For an inline function definition in C, determine whether the /// definition will be externally visible. /// @@ -661,7 +665,7 @@ unsigned FunctionDecl::getMinRequiredArguments() const { /// externally visible symbol. bool FunctionDecl::isInlineDefinitionExternallyVisible() const { assert(isThisDeclarationADefinition() && "Must have the function definition"); - assert(isInlineSpecified() && "Function must be inline"); + assert(isInlined() && "Function must be inline"); if (!getASTContext().getLangOptions().C99 || hasAttr<GNUInlineAttr>()) { // GNU inline semantics. Based on a number of examples, we came up with the @@ -786,8 +790,7 @@ bool FunctionDecl::isImplicitlyInstantiable() const { if (!Pattern || !PatternDecl) return true; - return PatternDecl->isInlineSpecified() || - (isa<CXXMethodDecl>(PatternDecl) && !PatternDecl->isOutOfLine()); + return PatternDecl->isInlined(); } FunctionDecl *FunctionDecl::getTemplateInstantiationPattern() const { |