[cfe-commits] r127877 - /cfe/trunk/lib/Sema/SemaDecl.cpp
Abramo Bagnara
abramo.bagnara at gmail.com
Fri Mar 18 08:21:59 PDT 2011
Author: abramo
Date: Fri Mar 18 10:21:59 2011
New Revision: 127877
URL: http://llvm.org/viewvc/llvm-project?rev=127877&view=rev
Log:
Defined friend functions are *implicitly* inlined, unless the inline specifier occurs explicitly.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=127877&r1=127876&r2=127877&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Mar 18 10:21:59 2011
@@ -3669,14 +3669,6 @@
AbstractReturnType))
D.setInvalidType();
-
- if (isFriend) {
- // C++ [class.friend]p5
- // A function can be defined in a friend declaration of a
- // class . . . . Such a function is implicitly inline.
- isInline |= IsFunctionDefinition;
- }
-
if (Name.getNameKind() == DeclarationName::CXXConstructorName) {
// This is a C++ constructor declaration.
assert(DC->isRecord() &&
@@ -3774,6 +3766,14 @@
NameInfo, R, TInfo, SC, SCAsWritten, isInline,
true/*HasPrototype*/);
}
+
+ if (isFriend && !isInline && IsFunctionDefinition) {
+ // C++ [class.friend]p5
+ // A function can be defined in a friend declaration of a
+ // class . . . . Such a function is implicitly inline.
+ NewFD->setImplicitlyInline();
+ }
+
SetNestedNameSpecifier(NewFD, D);
isExplicitSpecialization = false;
isFunctionTemplateSpecialization = false;
More information about the cfe-commits
mailing list