[llvm] r266259 - Revert "Add LLVMGetAttrKindIDInContext in the C API in order to facilitate migration away from LLVMAttribute"

Amaury Sechet via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 16:01:39 PDT 2016


Author: deadalnix
Date: Wed Apr 13 18:01:39 2016
New Revision: 266259

URL: http://llvm.org/viewvc/llvm-project?rev=266259&view=rev
Log:
Revert "Add LLVMGetAttrKindIDInContext in the C API in order to facilitate migration away from LLVMAttribute"

This reverts commit 0bcfd95c268bcb180a525e1837e84475df8acdc7.

Modified:
    llvm/trunk/include/llvm-c/Core.h
    llvm/trunk/lib/IR/Core.cpp
    llvm/trunk/utils/TableGen/Attributes.cpp

Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=266259&r1=266258&r2=266259&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Wed Apr 13 18:01:39 2016
@@ -476,9 +476,6 @@ unsigned LLVMGetMDKindIDInContext(LLVMCo
                                   unsigned SLen);
 unsigned LLVMGetMDKindID(const char *Name, unsigned SLen);
 
-unsigned LLVMGetAttrKindIDInContext(LLVMContextRef C, const char *Name,
-                                    size_t SLen);
-
 /**
  * @}
  */

Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=266259&r1=266258&r2=266259&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Wed Apr 13 18:01:39 2016
@@ -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"
@@ -121,16 +119,6 @@ unsigned LLVMGetMDKindID(const char *Nam
   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);

Modified: llvm/trunk/utils/TableGen/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Attributes.cpp?rev=266259&r1=266258&r2=266259&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Attributes.cpp (original)
+++ llvm/trunk/utils/TableGen/Attributes.cpp Wed Apr 13 18:01:39 2016
@@ -27,7 +27,6 @@ public:
 
 private:
   void emitTargetIndependentEnums(raw_ostream &OS);
-  void emitConversionFn(raw_ostream &OS);
   void emitFnAttrCompatCheck(raw_ostream &OS, bool IsStringAttr);
 
   void printEnumAttrClasses(raw_ostream &OS,
@@ -53,27 +52,6 @@ void Attributes::emitTargetIndependentEn
   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";
@@ -166,7 +144,6 @@ void Attributes::printStrBoolAttrClasses
 
 void Attributes::emit(raw_ostream &OS) {
   emitTargetIndependentEnums(OS);
-  emitConversionFn(OS);
   emitFnAttrCompatCheck(OS, false);
 }
 




More information about the llvm-commits mailing list