Commit a03fd3f2 authored by Reid Kleckner's avatar Reid Kleckner
Browse files

Reverting r182337, which merged r182266, __declspec(selectany)

Was "Implement __declspec(selectany) under -fms-extensions ..."

llvm-svn: 182381
parent 8703cc62
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -948,10 +948,6 @@ def ForceInline : InheritableAttr {
  let Spellings = [Keyword<"__forceinline">];
}

def SelectAny : InheritableAttr {
  let Spellings = [Declspec<"selectany">];
}

def Win64 : InheritableAttr {
  let Spellings = [Keyword<"__w64">];
}
+0 −2
Original line number Diff line number Diff line
@@ -1948,8 +1948,6 @@ def warn_weak_identifier_undeclared : Warning<
  "weak identifier %0 never declared">;
def err_attribute_weak_static : Error<
  "weak declaration cannot have internal linkage">;
def err_attribute_selectany_non_extern_data : Error<
  "'selectany' can only be applied to data items with external linkage">;
def warn_attribute_weak_import_invalid_on_definition : Warning<
  "'weak_import' attribute cannot be specified on a definition">,
  InGroup<IgnoredAttributes>;
+1 −7
Original line number Diff line number Diff line
@@ -1900,13 +1900,7 @@ CodeGenModule::GetLLVMLinkageVarDefinition(const VarDecl *D,
    return llvm::Function::DLLImportLinkage;
  else if (D->hasAttr<DLLExportAttr>())
    return llvm::Function::DLLExportLinkage;
  else if (D->hasAttr<SelectAnyAttr>()) {
    // selectany symbols are externally visible, so use weak instead of
    // linkonce.  MSVC optimizes away references to const selectany globals, so
    // all definitions should be the same and ODR linkage should be used.
    // http://msdn.microsoft.com/en-us/library/5tkz6s71.aspx
    return llvm::GlobalVariable::WeakODRLinkage;
  } else if (D->hasAttr<WeakAttr>()) {
  else if (D->hasAttr<WeakAttr>()) {
    if (GV->isConstant())
      return llvm::GlobalVariable::WeakODRLinkage;
    else
+0 −9
Original line number Diff line number Diff line
@@ -4638,15 +4638,6 @@ static void checkAttributesAfterMerging(Sema &S, NamedDecl &ND) {
      ND.dropAttr<WeakRefAttr>();
    }
  }

  // 'selectany' only applies to externally visible varable declarations.
  // It does not apply to functions.
  if (SelectAnyAttr *Attr = ND.getAttr<SelectAnyAttr>()) {
    if (isa<FunctionDecl>(ND) || !ND.isExternallyVisible()) {
      S.Diag(Attr->getLocation(), diag::err_attribute_selectany_non_extern_data);
      ND.dropAttr<SelectAnyAttr>();
    }
  }
}

/// Given that we are within the definition of the given function,
+0 −13
Original line number Diff line number Diff line
@@ -4683,16 +4683,6 @@ static void handleForceInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) {
    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
}

static void handleSelectAnyAttr(Sema &S, Decl *D, const AttributeList &Attr) {
  if (!checkMicrosoftExt(S, Attr))
    return;
  // Check linkage after possibly merging declaratinos.  See
  // checkAttributesAfterMerging().
  D->addAttr(::new (S.Context)
             SelectAnyAttr(Attr.getRange(), S.Context,
                           Attr.getAttributeSpellingListIndex()));
}

//===----------------------------------------------------------------------===//
// Top Level Sema Entry Points
//===----------------------------------------------------------------------===//
@@ -4919,9 +4909,6 @@ static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
  case AttributeList::AT_ForceInline:
    handleForceInlineAttr(S, D, Attr);
    break;
  case AttributeList::AT_SelectAny:
    handleSelectAnyAttr(S, D, Attr);
    break;

  // Thread safety attributes:
  case AttributeList::AT_GuardedVar:
Loading