michaelplatings updated this revision to Diff 503913.
michaelplatings added a comment.

Tiny tweak: undo an unnecessary change to a test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145567/new/

https://reviews.llvm.org/D145567

Files:
  clang/include/clang/Driver/Multilib.h
  clang/lib/Driver/Multilib.cpp
  clang/lib/Driver/MultilibBuilder.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/unittests/Driver/MultilibBuilderTest.cpp
  clang/unittests/Driver/MultilibTest.cpp

Index: clang/unittests/Driver/MultilibTest.cpp
===================================================================
--- clang/unittests/Driver/MultilibTest.cpp
+++ clang/unittests/Driver/MultilibTest.cpp
@@ -35,21 +35,21 @@
 TEST(MultilibTest, OpEqReflexivity3) {
   Multilib M1({}, {}, {}, {"+foo"});
   Multilib M2({}, {}, {}, {"+foo"});
-  ASSERT_TRUE(M1 == M2) << "Multilibs with the same flag should be the same";
+  ASSERT_TRUE(M1 == M2) << "Multilibs with the same tag should be the same";
 }
 
 TEST(MultilibTest, OpEqInequivalence1) {
   Multilib M1({}, {}, {}, {"+foo"});
   Multilib M2({}, {}, {}, {"-foo"});
-  ASSERT_FALSE(M1 == M2) << "Multilibs with conflicting flags are not the same";
+  ASSERT_FALSE(M1 == M2) << "Multilibs with conflicting tags are not the same";
   ASSERT_FALSE(M2 == M1)
-      << "Multilibs with conflicting flags are not the same (commuted)";
+      << "Multilibs with conflicting tags are not the same (commuted)";
 }
 
 TEST(MultilibTest, OpEqInequivalence2) {
   Multilib M1;
   Multilib M2({}, {}, {}, {"+foo"});
-  ASSERT_FALSE(M1 == M2) << "Flags make Multilibs different";
+  ASSERT_FALSE(M1 == M2) << "Tags make Multilibs different";
 }
 
 TEST(MultilibTest, OpEqEquivalence2) {
@@ -125,8 +125,8 @@
 
 TEST(MultilibTest, Construction3) {
   Multilib M({}, {}, {}, {"+f1", "+f2", "-f3"});
-  for (Multilib::flag_set::const_iterator I = M.flags().begin(),
-                                          E = M.flags().end();
+  for (Multilib::tag_set::const_iterator I = M.tags().begin(),
+                                         E = M.tags().end();
        I != E; ++I) {
     ASSERT_TRUE(llvm::StringSwitch<bool>(*I)
                     .Cases("+f1", "+f2", "-f3", true)
@@ -152,17 +152,17 @@
       Multilib("/foo", {}, {}, {"+foo"}),
       Multilib("/bar", {}, {}, {"+bar"}),
   });
-  Multilib::flag_set Flags1 = {"+foo", "-bar"};
+  Multilib::tag_set Tags1 = {"+foo", "-bar"};
   Multilib Selection1;
-  ASSERT_TRUE(MS.select(Flags1, Selection1))
-      << "Flag set was {\"+foo\"}, but selection not found";
+  ASSERT_TRUE(MS.select(Tags1, Selection1))
+      << "Tag set was {\"+foo\"}, but selection not found";
   ASSERT_TRUE(Selection1.gccSuffix() == "/foo")
       << "Selection picked " << Selection1 << " which was not expected";
 
-  Multilib::flag_set Flags2 = {"+foo", "+bar"};
+  Multilib::tag_set Tags2 = {"+foo", "+bar"};
   Multilib Selection2;
-  ASSERT_TRUE(MS.select(Flags2, Selection2))
-      << "Flag set was {\"+bar\"}, but selection not found";
+  ASSERT_TRUE(MS.select(Tags2, Selection2))
+      << "Tag set was {\"+bar\"}, but selection not found";
   ASSERT_TRUE(Selection2.gccSuffix() == "/bar")
       << "Selection picked " << Selection2 << " which was not expected";
 }
Index: clang/unittests/Driver/MultilibBuilderTest.cpp
===================================================================
--- clang/unittests/Driver/MultilibBuilderTest.cpp
+++ clang/unittests/Driver/MultilibBuilderTest.cpp
@@ -68,9 +68,9 @@
   ASSERT_TRUE(MS.size() == 2);
   for (MultilibSet::const_iterator I = MS.begin(), E = MS.end(); I != E; ++I) {
     if (I->gccSuffix() == "/64")
-      ASSERT_TRUE(*I->flags().begin() == "+m64");
+      ASSERT_TRUE(*I->tags().begin() == "+m64");
     else if (I->gccSuffix() == "")
-      ASSERT_TRUE(*I->flags().begin() == "-m64");
+      ASSERT_TRUE(*I->tags().begin() == "-m64");
     else
       FAIL() << "Unrecognized gccSufix: " << I->gccSuffix();
   }
@@ -89,17 +89,17 @@
                     .Default(false))
         << "Multilib " << *I << " wasn't expected";
     ASSERT_TRUE(llvm::StringSwitch<bool>(I->gccSuffix())
-                    .Case("", is_contained(I->flags(), "-sof"))
-                    .Case("/sof", is_contained(I->flags(), "+sof"))
-                    .Case("/el", is_contained(I->flags(), "-sof"))
-                    .Case("/sof/el", is_contained(I->flags(), "+sof"))
+                    .Case("", is_contained(I->tags(), "-sof"))
+                    .Case("/sof", is_contained(I->tags(), "+sof"))
+                    .Case("/el", is_contained(I->tags(), "-sof"))
+                    .Case("/sof/el", is_contained(I->tags(), "+sof"))
                     .Default(false))
         << "Multilib " << *I << " didn't have the appropriate {+,-}sof flag";
     ASSERT_TRUE(llvm::StringSwitch<bool>(I->gccSuffix())
-                    .Case("", is_contained(I->flags(), "-EL"))
-                    .Case("/sof", is_contained(I->flags(), "-EL"))
-                    .Case("/el", is_contained(I->flags(), "+EL"))
-                    .Case("/sof/el", is_contained(I->flags(), "+EL"))
+                    .Case("", is_contained(I->tags(), "-EL"))
+                    .Case("/sof", is_contained(I->tags(), "-EL"))
+                    .Case("/el", is_contained(I->tags(), "+EL"))
+                    .Case("/sof/el", is_contained(I->tags(), "+EL"))
                     .Default(false))
         << "Multilib " << *I << " didn't have the appropriate {+,-}EL flag";
   }
@@ -157,14 +157,14 @@
                         .Maybe(MultilibBuilder("64").flag("+m64"))
                         .makeMultilibSet();
 
-  Multilib::flag_set FlagM64 = {"+m64"};
+  Multilib::tag_set FlagM64 = {"+m64"};
   Multilib SelectionM64;
   ASSERT_TRUE(MS1.select(FlagM64, SelectionM64))
       << "Flag set was {\"+m64\"}, but selection not found";
   ASSERT_TRUE(SelectionM64.gccSuffix() == "/64")
       << "Selection picked " << SelectionM64 << " which was not expected";
 
-  Multilib::flag_set FlagNoM64 = {"-m64"};
+  Multilib::tag_set FlagNoM64 = {"-m64"};
   Multilib SelectionNoM64;
   ASSERT_TRUE(MS1.select(FlagNoM64, SelectionNoM64))
       << "Flag set was {\"-m64\"}, but selection not found";
@@ -181,7 +181,7 @@
   for (unsigned I = 0; I < 4; ++I) {
     bool IsEL = I & 0x1;
     bool IsSF = I & 0x2;
-    Multilib::flag_set Flags;
+    Multilib::tag_set Flags;
     if (IsEL)
       Flags.insert("+EL");
     else
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1046,7 +1046,7 @@
   return Arch == llvm::Triple::msp430;
 }
 
-static bool findMipsCsMultilibs(const Multilib::flag_set &Flags,
+static bool findMipsCsMultilibs(const Multilib::tag_set &Flags,
                                 FilterNonExistent &NonExistent,
                                 DetectedMultilibs &Result) {
   // Check for Code Sourcery toolchain multilibs
@@ -1144,7 +1144,7 @@
 }
 
 static bool findMipsAndroidMultilibs(llvm::vfs::FileSystem &VFS, StringRef Path,
-                                     const Multilib::flag_set &Flags,
+                                     const Multilib::tag_set &Flags,
                                      FilterNonExistent &NonExistent,
                                      DetectedMultilibs &Result) {
 
@@ -1189,7 +1189,7 @@
   return false;
 }
 
-static bool findMipsMuslMultilibs(const Multilib::flag_set &Flags,
+static bool findMipsMuslMultilibs(const Multilib::tag_set &Flags,
                                   FilterNonExistent &NonExistent,
                                   DetectedMultilibs &Result) {
   // Musl toolchain multilibs
@@ -1223,7 +1223,7 @@
   return false;
 }
 
-static bool findMipsMtiMultilibs(const Multilib::flag_set &Flags,
+static bool findMipsMtiMultilibs(const Multilib::tag_set &Flags,
                                  FilterNonExistent &NonExistent,
                                  DetectedMultilibs &Result) {
   // CodeScape MTI toolchain v1.2 and early.
@@ -1404,7 +1404,7 @@
   return false;
 }
 
-static bool findMipsImgMultilibs(const Multilib::flag_set &Flags,
+static bool findMipsImgMultilibs(const Multilib::tag_set &Flags,
                                  FilterNonExistent &NonExistent,
                                  DetectedMultilibs &Result) {
   // CodeScape IMG toolchain v1.2 and early.
@@ -1517,7 +1517,7 @@
 
   llvm::Triple::ArchType TargetArch = TargetTriple.getArch();
 
-  Multilib::flag_set Flags;
+  Multilib::tag_set Flags;
   addMultilibFlag(TargetTriple.isMIPS32(), "m32", Flags);
   addMultilibFlag(TargetTriple.isMIPS64(), "m64", Flags);
   addMultilibFlag(isMips16(Args), "mips16", Flags);
@@ -1599,7 +1599,7 @@
           .makeMultilibSet()
           .FilterOut(NonExistent);
 
-  Multilib::flag_set Flags;
+  Multilib::tag_set Flags;
   llvm::StringRef Arch = Args.getLastArgValue(options::OPT_march_EQ);
   bool IsArmArch = TargetTriple.getArch() == llvm::Triple::arm;
   bool IsThumbArch = TargetTriple.getArch() == llvm::Triple::thumb;
@@ -1635,7 +1635,7 @@
   Result.Multilibs.push_back(WithExceptions.makeMultilib());
   Result.Multilibs.FilterOut(NonExistent);
 
-  Multilib::flag_set Flags;
+  Multilib::tag_set Flags;
   addMultilibFlag(Args.hasFlag(options::OPT_fexceptions,
                                options::OPT_fno_exceptions, false),
                   "exceptions", Flags);
@@ -1658,7 +1658,7 @@
     return;
   auto ARCHName = *Res;
 
-  Multilib::flag_set Flags;
+  Multilib::tag_set Flags;
   addMultilibFlag(TheFloatABI == tools::csky::FloatABI::Hard, "hard-fp", Flags);
   addMultilibFlag(TheFloatABI == tools::csky::FloatABI::SoftFP, "soft-fp",
                   Flags);
@@ -1746,7 +1746,7 @@
                  "/../../../../riscv32-unknown-elf/lib" + M.gccSuffix()});
           });
 
-  Multilib::flag_set Flags;
+  Multilib::tag_set Flags;
   llvm::StringSet<> Added_ABIs;
   StringRef ABIName = tools::riscv::getRISCVABI(Args, TargetTriple);
   StringRef MArch = tools::riscv::getRISCVArch(Args, TargetTriple);
@@ -1789,7 +1789,7 @@
           .makeMultilibSet()
           .FilterOut(NonExistent);
 
-  Multilib::flag_set Flags;
+  Multilib::tag_set Flags;
   bool IsRV64 = TargetTriple.getArch() == llvm::Triple::riscv64;
   StringRef ABIName = tools::riscv::getRISCVABI(Args, TargetTriple);
 
@@ -1900,7 +1900,7 @@
 
   Result.Multilibs.FilterOut(NonExistent);
 
-  Multilib::flag_set Flags;
+  Multilib::tag_set Flags;
   addMultilibFlag(TargetTriple.isArch64Bit() && !IsX32, "m64", Flags);
   addMultilibFlag(TargetTriple.isArch32Bit(), "m32", Flags);
   addMultilibFlag(TargetTriple.isArch64Bit() && IsX32, "mx32", Flags);
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -298,7 +298,7 @@
     return llvm::all_of(RD, [&](std::string P) { return !getVFS().exists(P); });
   });
 
-  Multilib::flag_set Flags;
+  Multilib::tag_set Flags;
   bool Exceptions =
       Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, true);
   addMultilibFlag(Exceptions, "fexceptions", Flags);
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -198,7 +198,7 @@
 /// \p Flag must be a flag accepted by the driver with its leading '-' removed,
 //     otherwise '-print-multi-lib' will not emit them correctly.
 void addMultilibFlag(bool Enabled, const char *const Flag,
-                     Multilib::flag_set &Flags);
+                     Multilib::tag_set &Flags);
 
 void addX86AlignBranchArgs(const Driver &D, const llvm::opt::ArgList &Args,
                            llvm::opt::ArgStringList &CmdArgs, bool IsLTO,
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1786,7 +1786,7 @@
 }
 
 void tools::addMultilibFlag(bool Enabled, const char *const Flag,
-                            Multilib::flag_set &Flags) {
+                            Multilib::tag_set &Flags) {
   Flags.insert(std::string(Enabled ? "+" : "-") + Flag);
 }
 
Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===================================================================
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -32,7 +32,7 @@
 static bool findRISCVMultilibs(const Driver &D,
                                const llvm::Triple &TargetTriple,
                                const ArgList &Args, DetectedMultilibs &Result) {
-  Multilib::flag_set Flags;
+  Multilib::tag_set Flags;
   StringRef Arch = riscv::getRISCVArch(Args, TargetTriple);
   StringRef Abi = tools::riscv::getRISCVABI(Args, TargetTriple);
 
Index: clang/lib/Driver/MultilibBuilder.cpp
===================================================================
--- clang/lib/Driver/MultilibBuilder.cpp
+++ clang/lib/Driver/MultilibBuilder.cpp
@@ -87,7 +87,7 @@
 
 Multilib MultilibBuilder::makeMultilib() const {
   // Derive print options from flags.
-  // In general, flags in the Multilib class are not required to be valid
+  // In general, tags in the Multilib class are not required to be valid
   // command line options, but for the MultilibBuilder class flags are expected
   // to form valid command line options when their first character is replaced
   // with '-'.
@@ -97,7 +97,7 @@
       PrintOptions.push_back(("-" + Flag.substr(1)).str());
   }
   return Multilib(GCCSuffix, OSSuffix, IncludeSuffix,
-                  Multilib::flag_set(Flags.begin(), Flags.end()), PrintOptions);
+                  Multilib::tag_set(Flags.begin(), Flags.end()), PrintOptions);
 }
 
 MultilibSetBuilder &MultilibSetBuilder::Maybe(const MultilibBuilder &M) {
Index: clang/lib/Driver/Multilib.cpp
===================================================================
--- clang/lib/Driver/Multilib.cpp
+++ clang/lib/Driver/Multilib.cpp
@@ -26,10 +26,10 @@
 using namespace llvm::sys;
 
 Multilib::Multilib(StringRef GCCSuffix, StringRef OSSuffix,
-                   StringRef IncludeSuffix, const flag_set &Flags,
+                   StringRef IncludeSuffix, const tag_set &Tags,
                    const option_list &PrintOptions)
     : GCCSuffix(GCCSuffix), OSSuffix(OSSuffix), IncludeSuffix(IncludeSuffix),
-      Flags(Flags), PrintOptions(PrintOptions) {
+      Tags(Tags), PrintOptions(PrintOptions) {
   assert(GCCSuffix.empty() ||
          (StringRef(GCCSuffix).front() == '/' && GCCSuffix.size() > 1));
   assert(OSSuffix.empty() ||
@@ -53,7 +53,7 @@
 }
 
 bool Multilib::operator==(const Multilib &Other) const {
-  if (Flags != Other.Flags)
+  if (Tags != Other.Tags)
     return false;
 
   if (osSuffix() != Other.osSuffix())
@@ -81,19 +81,19 @@
 void MultilibSet::push_back(const Multilib &M) { Multilibs.push_back(M); }
 
 MultilibSet::multilib_list
-MultilibSet::select(const Multilib::flag_set &Flags) const {
+MultilibSet::select(const Multilib::tag_set &Tags) const {
   multilib_list Result;
   llvm::copy_if(Multilibs, std::back_inserter(Result),
-                [&Flags](const Multilib &M) {
-                  return std::includes(Flags.begin(), Flags.end(),
-                                       M.flags().begin(), M.flags().end());
+                [&Tags](const Multilib &M) {
+                  return std::includes(Tags.begin(), Tags.end(),
+                                       M.tags().begin(), M.tags().end());
                 });
   return Result;
 }
 
-bool MultilibSet::select(const Multilib::flag_set &Flags,
+bool MultilibSet::select(const Multilib::tag_set &Tags,
                          Multilib &Selected) const {
-  multilib_list Result = select(Flags);
+  multilib_list Result = select(Tags);
   if (Result.empty())
     return false;
   Selected = Result.back();
Index: clang/include/clang/Driver/Multilib.h
===================================================================
--- clang/include/clang/Driver/Multilib.h
+++ clang/include/clang/Driver/Multilib.h
@@ -24,20 +24,19 @@
 namespace clang {
 namespace driver {
 
-/// This corresponds to a single GCC Multilib, or a segment of one controlled
-/// by a command line flag.
+/// This corresponds to a single GCC Multilib.
 /// See also MultilibBuilder for building a multilib by mutating it
 /// incrementally.
 class Multilib {
 public:
-  using flag_set = std::set<std::string>;
+  using tag_set = std::set<std::string>;
   using option_list = std::vector<std::string>;
 
 private:
   std::string GCCSuffix;
   std::string OSSuffix;
   std::string IncludeSuffix;
-  flag_set Flags;
+  tag_set Tags;
   option_list PrintOptions;
 
 public:
@@ -45,7 +44,7 @@
   /// sysroot string so they must either be empty or begin with a '/' character.
   /// This is enforced with an assert in the constructor.
   Multilib(StringRef GCCSuffix = {}, StringRef OSSuffix = {},
-           StringRef IncludeSuffix = {}, const flag_set &Flags = flag_set(),
+           StringRef IncludeSuffix = {}, const tag_set &Tags = tag_set(),
            const option_list &PrintOptions = option_list());
 
   /// Get the detected GCC installation path suffix for the multi-arch
@@ -60,11 +59,11 @@
   /// empty
   const std::string &includeSuffix() const { return IncludeSuffix; }
 
-  /// Get the set of flags that indicate this multilib's use.
-  /// Flags are arbitrary strings although typically they will look similar to
-  /// command line options. A multilib is considered compatible if its flags are
-  /// a subset of the flags derived from the Clang command line options.
-  const flag_set &flags() const { return Flags; }
+  /// Get the set of tags that indicate this multilib's use.
+  /// Tags are arbitrary strings although typically they will look similar to
+  /// command line options. A multilib is considered compatible if its tags are
+  /// a subset of the tags derived from the Clang command line options.
+  const tag_set &tags() const { return Tags; }
 
   /// Returns the options that should be used for clang -print-multi-lib
   const option_list &getPrintOptions() const { return PrintOptions; }
@@ -112,10 +111,10 @@
   const_iterator end() const { return Multilibs.end(); }
 
   /// Select compatible variants
-  multilib_list select(const Multilib::flag_set &Flags) const;
+  multilib_list select(const Multilib::tag_set &Tags) const;
 
   /// Pick the best multilib in the set, \returns false if none are compatible
-  bool select(const Multilib::flag_set &Flags, Multilib &M) const;
+  bool select(const Multilib::tag_set &Tags, Multilib &M) const;
 
   unsigned size() const { return Multilibs.size(); }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to