[PATCH] D21641: Use ArgList::hasFlag to check if -miamcu/-mno-iamcu is passed. NFC.
Andrey Turetskiy via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 29 04:04:20 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274119: Use ArgList::hasFlag to check if -miamcu/-mno-iamcu is passed. NFC. (authored by aturetsk).
Changed prior to commit:
http://reviews.llvm.org/D21641?vs=61662&id=62203#toc
Repository:
rL LLVM
http://reviews.llvm.org/D21641
Files:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/Tools.cpp
Index: cfe/trunk/lib/Driver/Tools.cpp
===================================================================
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -2247,12 +2247,10 @@
}
// Set flags to support MCU ABI.
- if (Arg *A = Args.getLastArg(options::OPT_miamcu, options::OPT_mno_iamcu)) {
- if (A->getOption().matches(options::OPT_miamcu)) {
- CmdArgs.push_back("-mfloat-abi");
- CmdArgs.push_back("soft");
- CmdArgs.push_back("-mstack-alignment=4");
- }
+ if (Args.hasFlag(options::OPT_miamcu, options::OPT_mno_iamcu, false)) {
+ CmdArgs.push_back("-mfloat-abi");
+ CmdArgs.push_back("soft");
+ CmdArgs.push_back("-mstack-alignment=4");
}
}
Index: cfe/trunk/lib/Driver/Driver.cpp
===================================================================
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -280,9 +280,8 @@
}
// Enforce -static if -miamcu is present.
- if (Arg *Ar = Args.getLastArg(options::OPT_miamcu, options::OPT_mno_iamcu))
- if (Ar->getOption().matches(options::OPT_miamcu))
- DAL->AddFlagArg(0, Opts->getOption(options::OPT_static));
+ if (Args.hasFlag(options::OPT_miamcu, options::OPT_mno_iamcu, false))
+ DAL->AddFlagArg(0, Opts->getOption(options::OPT_static));
// Add a default value of -mlinker-version=, if one was given and the user
// didn't specify one.
@@ -376,24 +375,22 @@
}
// Handle -miamcu flag.
- if (Arg *Ar = Args.getLastArg(options::OPT_miamcu, options::OPT_mno_iamcu)) {
- if (Ar->getOption().matches(options::OPT_miamcu)) {
- if (Target.get32BitArchVariant().getArch() != llvm::Triple::x86)
- D.Diag(diag::err_drv_unsupported_opt_for_target) << "-miamcu"
- << Target.str();
-
- if (A && !A->getOption().matches(options::OPT_m32))
- D.Diag(diag::err_drv_argument_not_allowed_with)
- << "-miamcu" << A->getBaseArg().getAsString(Args);
-
- Target.setArch(llvm::Triple::x86);
- Target.setArchName("i586");
- Target.setEnvironment(llvm::Triple::UnknownEnvironment);
- Target.setEnvironmentName("");
- Target.setOS(llvm::Triple::ELFIAMCU);
- Target.setVendor(llvm::Triple::UnknownVendor);
- Target.setVendorName("intel");
- }
+ if (Args.hasFlag(options::OPT_miamcu, options::OPT_mno_iamcu, false)) {
+ if (Target.get32BitArchVariant().getArch() != llvm::Triple::x86)
+ D.Diag(diag::err_drv_unsupported_opt_for_target) << "-miamcu"
+ << Target.str();
+
+ if (A && !A->getOption().matches(options::OPT_m32))
+ D.Diag(diag::err_drv_argument_not_allowed_with)
+ << "-miamcu" << A->getBaseArg().getAsString(Args);
+
+ Target.setArch(llvm::Triple::x86);
+ Target.setArchName("i586");
+ Target.setEnvironment(llvm::Triple::UnknownEnvironment);
+ Target.setEnvironmentName("");
+ Target.setOS(llvm::Triple::ELFIAMCU);
+ Target.setVendor(llvm::Triple::UnknownVendor);
+ Target.setVendorName("intel");
}
return Target;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21641.62203.patch
Type: text/x-patch
Size: 3112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160629/9ee90b37/attachment-0001.bin>
More information about the cfe-commits
mailing list