]> granicus.if.org Git - clang/commitdiff
Attr: Remove ForceInline
authorDavid Majnemer <david.majnemer@gmail.com>
Tue, 25 Feb 2014 09:53:29 +0000 (09:53 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Tue, 25 Feb 2014 09:53:29 +0000 (09:53 +0000)
The __forceinline keyword's semantics are now recast as AlwaysInline and
the kw___forceinline token has its language mode set for KEYMS.

This preserves the semantics of the previous implementation but with
less duplication of code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202131 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Attr.td
include/clang/Basic/TokenKinds.def
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenModule.cpp
lib/Sema/SemaDeclAttr.cpp

index 2daa8f1763371e8e246f8b1e2574dae6485f6185..b04aa46191cec9f9511b3ee27b289c1c65ecb665 100644 (file)
@@ -357,7 +357,7 @@ def AlignMac68k : InheritableAttr {
 }
 
 def AlwaysInline : InheritableAttr {
-  let Spellings = [GCC<"always_inline">];
+  let Spellings = [GCC<"always_inline">, Keyword<"__forceinline">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [Undocumented];
 }
@@ -1676,12 +1676,6 @@ def DLLImport : InheritableAttr, TargetSpecificAttr<TargetX86Win> {
   let Documentation = [Undocumented];
 }
 
-def ForceInline : InheritableAttr {
-  let Spellings = [Keyword<"__forceinline">];
-  let LangOpts = [MicrosoftExt];
-  let Documentation = [Undocumented];
-}
-
 def SelectAny : InheritableAttr {
   let Spellings = [Declspec<"selectany">];
   let LangOpts = [MicrosoftExt];
index eddfd7e4af97020201d1a6ce9cd88d5d9b4d1e91..b64ad05cd091cc8a692c85904beabd587422ebbc 100644 (file)
@@ -455,7 +455,7 @@ KEYWORD(__cdecl                     , KEYALL)
 KEYWORD(__stdcall                   , KEYALL)
 KEYWORD(__fastcall                  , KEYALL)
 KEYWORD(__thiscall                  , KEYALL)
-KEYWORD(__forceinline               , KEYALL)
+KEYWORD(__forceinline               , KEYMS)
 KEYWORD(__unaligned                 , KEYMS)
 
 // OpenCL address space qualifiers
index 409d1141b81a64ef1f049580f9ed1c758dd147fc..e81b1bccb1742d12823dec3f279e336864f7e2cf 100644 (file)
@@ -527,8 +527,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
           Fn->addFnAttr(llvm::Attribute::InlineHint);
           break;
         }
-    } else if (!FD->hasAttr<AlwaysInlineAttr>() &&
-               !FD->hasAttr<ForceInlineAttr>())
+    } else if (!FD->hasAttr<AlwaysInlineAttr>())
       Fn->addFnAttr(llvm::Attribute::NoInline);
   }
 
index e6798e49a85ac97a1ee2e16b409aff86db4dd7e9..f7b518abc57ba0e6cc6674b4c679bd2d30472613 100644 (file)
@@ -635,8 +635,7 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
     B.addAttribute(llvm::Attribute::NoDuplicate);
   } else if (D->hasAttr<NoInlineAttr>()) {
     B.addAttribute(llvm::Attribute::NoInline);
-  } else if ((D->hasAttr<AlwaysInlineAttr>() ||
-              D->hasAttr<ForceInlineAttr>()) &&
+  } else if (D->hasAttr<AlwaysInlineAttr>() &&
              !F->getAttributes().hasAttribute(llvm::AttributeSet::FunctionIndex,
                                               llvm::Attribute::NoInline)) {
     // (noinline wins over always_inline, and we can't specify both in IR)
@@ -1245,8 +1244,7 @@ CodeGenModule::shouldEmitFunction(GlobalDecl GD) {
   if (getFunctionLinkage(GD) != llvm::Function::AvailableExternallyLinkage)
     return true;
   const FunctionDecl *F = cast<FunctionDecl>(GD.getDecl());
-  if (CodeGenOpts.OptimizationLevel == 0 &&
-      !F->hasAttr<AlwaysInlineAttr>() && !F->hasAttr<ForceInlineAttr>())
+  if (CodeGenOpts.OptimizationLevel == 0 && !F->hasAttr<AlwaysInlineAttr>())
     return false;
   // PR9614. Avoid cases where the source code is lying to us. An available
   // externally function should have an equivalent function somewhere else,
index 7679fdb78973dca5cef91f91b06d89b2e27cf207..d61d63a9b9e203d249a496bf494d78260fe39e2e 100644 (file)
@@ -4269,8 +4269,6 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
     break;
   case AttributeList::AT_MSInheritance:
     handleMSInheritanceAttr(S, D, Attr); break;
-  case AttributeList::AT_ForceInline:
-    handleSimpleAttribute<ForceInlineAttr>(S, D, Attr); break;
   case AttributeList::AT_SelectAny:
     handleSimpleAttribute<SelectAnyAttr>(S, D, Attr); break;