mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-10 22:55:57 +00:00
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;
|
|
}
|
|
|
|
}
|