Ignore entries with blank names.
authorJim Laskey <jlaskey@mac.com>
Tue, 12 Dec 2006 20:55:58 +0000 (20:55 +0000)
committerJim Laskey <jlaskey@mac.com>
Tue, 12 Dec 2006 20:55:58 +0000 (20:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32491 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/SubtargetEmitter.cpp

index a70dbc972878020476b70d9ce442655f96054012..6cc28d7c7f9b41b6a2581a27d1423012b44bc4fb 100644 (file)
@@ -87,7 +87,7 @@ void SubtargetEmitter::FeatureKeyValues(std::ostream &OS) {
      << "static llvm::SubtargetFeatureKV FeatureKV[] = {\n";
   
   // For each feature
-  for (unsigned i = 0, N = FeatureList.size(); i < N;) {
+  for (unsigned i = 0, N = FeatureList.size(); i < N; ++i) {
     // Next feature
     Record *Feature = FeatureList[i];
 
@@ -95,6 +95,8 @@ void SubtargetEmitter::FeatureKeyValues(std::ostream &OS) {
     std::string CommandLineName = Feature->getValueAsString("Name");
     std::string Desc = Feature->getValueAsString("Desc");
     
+    if (CommandLineName.empty()) continue;
+    
     // Emit as { "feature", "decription", feactureEnum }
     OS << "  { "
        << "\"" << CommandLineName << "\", "
@@ -103,7 +105,7 @@ void SubtargetEmitter::FeatureKeyValues(std::ostream &OS) {
        << " }";
     
     // Depending on 'if more in the list' emit comma
-    if (++i < N) OS << ",";
+    if ((i + 1) < N) OS << ",";
     
     OS << "\n";
   }