mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-26 22:26:16 +00:00
8461202767
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90771 91177308-0d34-0410-b5e6-96231b3b80d8
34 lines
623 B
C++
34 lines
623 B
C++
#include <string>
|
|
#include <vector>
|
|
|
|
namespace hooks {
|
|
typedef std::vector<std::string> StrVec;
|
|
|
|
/// ConvertToMAttr - Convert -m* and -mno-* to -mattr=+*,-*
|
|
std::string ConvertToMAttr(const StrVec& Opts) {
|
|
std::string out("-mattr=");
|
|
|
|
bool firstIter = true;
|
|
for (StrVec::const_iterator B = Opts.begin(), E = Opts.end(); B!=E; ++B) {
|
|
const std::string& Arg = *B;
|
|
|
|
if (firstIter)
|
|
firstIter = false;
|
|
else
|
|
out += ",";
|
|
|
|
if (Arg.find("no-") == 0 && Arg[3] != 0) {
|
|
out += '-';
|
|
out += Arg.c_str() + 3;
|
|
}
|
|
else {
|
|
out += '+';
|
|
out += Arg;
|
|
}
|
|
}
|
|
|
|
return out;
|
|
}
|
|
|
|
}
|