Skip to content

Commit e28b543

Browse files
author
MUSTAPHA BARKI
committed
[clang][AST] Add comment clarifying GNU inline visibility rules
1 parent cafc064 commit e28b543

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

clang/lib/AST/Decl.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4024,12 +4024,17 @@ bool FunctionDecl::isInlineDefinitionExternallyVisible() const {
40244024
ASTContext &Context = getASTContext();
40254025

40264026
if (Context.getLangOpts().GNUInline || hasAttr<GNUInlineAttr>()) {
4027+
// GNU inline semantics:
4028+
//
4029+
// A function defined 'inline' is externally visible.
4030+
// A function defined 'extern inline' is not externally visible.
4031+
//
4032+
// If any declaration is 'inline' but not 'extern', the definition is
4033+
// externally visible. This is the only case that matters for a function
4034+
// defined 'extern inline'.
4035+
//
40274036
// Note: If you change the logic here, please change
40284037
// doesDeclarationForceExternallyVisibleDefinition as well.
4029-
//
4030-
// If it's not the case that both 'inline' and 'extern' are
4031-
// specified on the definition, then this inline definition is
4032-
// externally visible.
40334038
if (Context.getLangOpts().CPlusPlus)
40344039
return false;
40354040
if (!(isInlineSpecified() && getStorageClass() == SC_Extern))

0 commit comments

Comments
 (0)