llvm-project/llvm/test/TableGen/SubtargetFeatureUniqueNames.td
Rahul Joshi 8ce5a32f02
[TableGen] Rework error reporting for duplicate Feature/Processor (#102257)
- Extract code for sorting and checking duplicate Records into a helper
  function and update `collectProcModels` to use the helper.
- Update `FeatureKeyValues` to:
  (a) Remove code for duplicate checks and use the helper.
  (b) Trim features with empty name explicitly to be able to use
      the helper.
- Make the sorting deterministic by using record name as a secondary
  key for sorting, and re-enable SubtargetFeatureUniqueNames.td test
  that was disabled due to the non-determinism of the error messages.
- Change wording of error message when duplicate records are found to
  be source code position agnostic, since `First` may not be before
  `Second` lexically.
2024-08-08 02:00:36 +03:00

13 lines
472 B
TableGen

// RUN: not llvm-tblgen -gen-subtarget -I %p/../../include %s 2>&1 | FileCheck %s -DFILE=%s
// Verify that subtarget features with same names result in an error.
include "llvm/Target/Target.td"
def MyTarget : Target;
def FeatureB : SubtargetFeature<"NameA", "", "", "">;
// CHECK: [[FILE]]:[[@LINE+2]]:5: error: Feature `NameA` is already defined.
// CHECK: [[FILE]]:[[@LINE-3]]:5: note: Previous definition here.
def FeatureA : SubtargetFeature<"NameA", "", "", "">;