Skip to content

Commit

Permalink
Revert "Add LLVMGetAttrKindIDInContext in the C API in order to facil…
Browse files Browse the repository at this point in the history
…itate migration away from LLVMAttribute"

This reverts commit 0bcfd95c268bcb180a525e1837e84475df8acdc7.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266259 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
deadalnix committed Apr 13, 2016
1 parent 4cd20e7 commit 609cf3b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 38 deletions.
3 changes: 0 additions & 3 deletions include/llvm-c/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,6 @@ unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name,
unsigned SLen);
unsigned LLVMGetMDKindID(const char *Name, unsigned SLen);

unsigned LLVMGetAttrKindIDInContext(LLVMContextRef C, const char *Name,
size_t SLen);

/**
* @}
*/
Expand Down
12 changes: 0 additions & 12 deletions lib/IR/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
//===----------------------------------------------------------------------===//

#include "llvm-c/Core.h"
#include "llvm/ADT/StringSwitch.h"
#include "AttributeImpl.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CallSite.h"
Expand Down Expand Up @@ -121,16 +119,6 @@ unsigned LLVMGetMDKindID(const char *Name, unsigned SLen) {
return LLVMGetMDKindIDInContext(LLVMGetGlobalContext(), Name, SLen);
}

#define GET_ATTR_KIND_FROM_NAME
#include "AttributesCompatFunc.inc"

unsigned LLVMGetAttrKindIDInContext(LLVMContextRef C, const char *Name,
size_t SLen) {
auto K = getAttrKindFromName(StringRef(Name, SLen));
assert(K != Attribute::None && "Invalid attribute");
return AttributeImpl::getAttrMask(K);
}

char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI) {
std::string MsgStorage;
raw_string_ostream Stream(MsgStorage);
Expand Down
23 changes: 0 additions & 23 deletions utils/TableGen/Attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class Attributes {

private:
void emitTargetIndependentEnums(raw_ostream &OS);
void emitConversionFn(raw_ostream &OS);
void emitFnAttrCompatCheck(raw_ostream &OS, bool IsStringAttr);

void printEnumAttrClasses(raw_ostream &OS,
Expand All @@ -53,27 +52,6 @@ void Attributes::emitTargetIndependentEnums(raw_ostream &OS) {
OS << "#endif\n";
}

void Attributes::emitConversionFn(raw_ostream &OS) {
OS << "#ifdef GET_ATTR_KIND_FROM_NAME\n";
OS << "#undef GET_ATTR_KIND_FROM_NAME\n";

std::vector<Record*> Attrs =
Records.getAllDerivedDefinitions("EnumAttr");

OS << "static Attribute::AttrKind getAttrKindFromName(StringRef AttrName) {\n";
OS << " return StringSwitch<Attribute::AttrKind>(AttrName)\n";

for (auto A : Attrs) {
OS << " .Case(\"" << A->getValueAsString("AttrString");
OS << "\", Attribute::" << A->getName() << ")\n";
}

OS << " .Default(Attribute::None);\n";
OS << "}\n\n";

OS << "#endif\n";
}

void Attributes::emitFnAttrCompatCheck(raw_ostream &OS, bool IsStringAttr) {
OS << "#ifdef GET_ATTR_COMPAT_FUNC\n";
OS << "#undef GET_ATTR_COMPAT_FUNC\n";
Expand Down Expand Up @@ -166,7 +144,6 @@ void Attributes::printStrBoolAttrClasses(raw_ostream &OS,

void Attributes::emit(raw_ostream &OS) {
emitTargetIndependentEnums(OS);
emitConversionFn(OS);
emitFnAttrCompatCheck(OS, false);
}

Expand Down

0 comments on commit 609cf3b

Please sign in to comment.