diff --git a/clang/include/clang/Driver/Multilib.h b/clang/include/clang/Driver/Multilib.h --- a/clang/include/clang/Driver/Multilib.h +++ b/clang/include/clang/Driver/Multilib.h @@ -58,7 +58,7 @@ const std::string &includeSuffix() const { return IncludeSuffix; } /// Get the flags that indicate or contraindicate this multilib's use - /// All elements begin with either '+' or '-' + /// All elements begin with either '-' or '!' const flags_list &flags() const { return Flags; } LLVM_DUMP_METHOD void dump() const; diff --git a/clang/include/clang/Driver/MultilibBuilder.h b/clang/include/clang/Driver/MultilibBuilder.h --- a/clang/include/clang/Driver/MultilibBuilder.h +++ b/clang/include/clang/Driver/MultilibBuilder.h @@ -70,7 +70,7 @@ MultilibBuilder &includeSuffix(StringRef S); /// Get the flags that indicate or contraindicate this multilib's use - /// All elements begin with either '+' or '-' + /// All elements begin with either '-' or '!' const flags_list &flags() const { return Flags; } flags_list &flags() { return Flags; } diff --git a/clang/lib/Driver/Multilib.cpp b/clang/lib/Driver/Multilib.cpp --- a/clang/lib/Driver/Multilib.cpp +++ b/clang/lib/Driver/Multilib.cpp @@ -49,7 +49,7 @@ } OS << ";"; for (StringRef Flag : Flags) { - if (Flag.front() == '+') + if (Flag.front() == '-') OS << "@" << Flag.substr(1); } } diff --git a/clang/lib/Driver/MultilibBuilder.cpp b/clang/lib/Driver/MultilibBuilder.cpp --- a/clang/lib/Driver/MultilibBuilder.cpp +++ b/clang/lib/Driver/MultilibBuilder.cpp @@ -76,7 +76,7 @@ StringRef Flag(Flags[I]); llvm::StringMap::iterator SI = FlagSet.find(Flag.substr(1)); - assert(StringRef(Flag).front() == '+' || StringRef(Flag).front() == '-'); + assert(StringRef(Flag).front() == '-' || StringRef(Flag).front() == '!'); if (SI == FlagSet.end()) FlagSet[Flag.substr(1)] = I; @@ -97,10 +97,10 @@ MultilibSetBuilder &MultilibSetBuilder::Maybe(const MultilibBuilder &M) { MultilibBuilder Opposite; - // Negate any '+' flags + // Negate positive flags for (StringRef Flag : M.flags()) { - if (Flag.front() == '+') - Opposite.flags().push_back(("-" + Flag.substr(1)).str()); + if (Flag.front() == '-') + Opposite.flags().push_back(("!" + Flag.substr(1)).str()); } return Either(M, Opposite); } diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1921,9 +1921,9 @@ Multilib::flags_list &Flags) { assert(Flag.front() == '-'); if (Enabled) { - Flags.push_back(("+" + Flag.substr(1)).str()); - } else { Flags.push_back(Flag.str()); + } else { + Flags.push_back(("!" + Flag.substr(1)).str()); } } diff --git a/clang/lib/Driver/ToolChains/OHOS.cpp b/clang/lib/Driver/ToolChains/OHOS.cpp --- a/clang/lib/Driver/ToolChains/OHOS.cpp +++ b/clang/lib/Driver/ToolChains/OHOS.cpp @@ -40,15 +40,15 @@ // -mfloat-abi=soft -mfloat-abi=softfp -mfloat-abi=hard // -mfpu=neon-vfpv4 Multilibs.push_back( - Multilib("/a7_soft", {}, {}, {"+mcpu=cortex-a7", "+mfloat-abi=soft"})); + Multilib("/a7_soft", {}, {}, {"-mcpu=cortex-a7", "-mfloat-abi=soft"})); Multilibs.push_back( Multilib("/a7_softfp_neon-vfpv4", {}, {}, - {"+mcpu=cortex-a7", "+mfloat-abi=softfp", "+mfpu=neon-vfpv4"})); + {"-mcpu=cortex-a7", "-mfloat-abi=softfp", "-mfpu=neon-vfpv4"})); Multilibs.push_back( Multilib("/a7_hard_neon-vfpv4", {}, {}, - {"+mcpu=cortex-a7", "+mfloat-abi=hard", "+mfpu=neon-vfpv4"})); + {"-mcpu=cortex-a7", "-mfloat-abi=hard", "-mfpu=neon-vfpv4"})); if (Multilibs.select(Flags, Result.SelectedMultilib)) { Result.Multilibs = Multilibs;