r208850 - AST: Remove dead-code/update reference to standard

David Majnemer david.majnemer at gmail.com
Wed May 14 23:25:57 PDT 2014


Author: majnemer
Date: Thu May 15 01:25:57 2014
New Revision: 208850

URL: http://llvm.org/viewvc/llvm-project?rev=208850&view=rev
Log:
AST: Remove dead-code/update reference to standard

GetGVALinkageForFunction handles TSK_ExplicitInstantiationDeclaration
twice, remove the redundant code trying to handle it again.

While we are here, update the reference we make to the standard.  It
seems like another paragraph was added causing this text to get
renumbered.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=208850&r1=208849&r2=208850&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu May 15 01:25:57 2014
@@ -7756,6 +7756,12 @@ GVALinkage ASTContext::GetGVALinkageForF
   case TSK_ExplicitInstantiationDefinition:
     return GVA_StrongODR;
 
+  // C++11 [temp.explicit]p10:
+  //   [ Note: The intent is that an inline function that is the subject of
+  //   an explicit instantiation declaration will still be implicitly
+  //   instantiated when used so that the body can be considered for
+  //   inlining, but that no out-of-line copy of the inline function would be
+  //   generated in the translation unit. -- end note ]
   case TSK_ExplicitInstantiationDeclaration:
     return GVA_AvailableExternally;
 
@@ -7778,16 +7784,6 @@ GVALinkage ASTContext::GetGVALinkageForF
     return GVA_AvailableExternally;
   }
 
-  // C++0x [temp.explicit]p9:
-  //   [ Note: The intent is that an inline function that is the subject of 
-  //   an explicit instantiation declaration will still be implicitly 
-  //   instantiated when used so that the body can be considered for 
-  //   inlining, but that no out-of-line copy of the inline function would be
-  //   generated in the translation unit. -- end note ]
-  if (FD->getTemplateSpecializationKind() 
-                                       == TSK_ExplicitInstantiationDeclaration)
-    return GVA_AvailableExternally;
-
   // Functions specified with extern and inline in -fms-compatibility mode
   // forcibly get emitted.  While the body of the function cannot be later
   // replaced, the function definition cannot be discarded.
@@ -7910,7 +7906,8 @@ bool ASTContext::DeclMustBeEmitted(const
 
   // Variables that can be needed in other TUs are required.
   GVALinkage L = GetGVALinkageForVariable(VD);
-  if (L != GVA_Internal && L != GVA_DiscardableODR)
+  if (L != GVA_Internal && L != GVA_AvailableExternally &&
+      L != GVA_DiscardableODR)
     return true;
 
   // Variables that have destruction with side-effects are required.





More information about the cfe-commits mailing list