diff options
author | Bill Wendling <isanbard@gmail.com> | 2009-06-28 07:36:13 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2009-06-28 07:36:13 +0000 |
commit | d63bbadbef6d8b1b9dbc9a5e024c275b0a9897e9 (patch) | |
tree | 1b5305469985b27a4317fd886765b1ffbdea5424 /clang/lib/Driver/ArgList.cpp | |
parent | bd956c429040a41c7e9e4fdd3063ec0ab98457cb (diff) | |
download | bcm5719-llvm-d63bbadbef6d8b1b9dbc9a5e024c275b0a9897e9.tar.gz bcm5719-llvm-d63bbadbef6d8b1b9dbc9a5e024c275b0a9897e9.zip |
Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.
llvm-svn: 74405
Diffstat (limited to 'clang/lib/Driver/ArgList.cpp')
-rw-r--r-- | clang/lib/Driver/ArgList.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/lib/Driver/ArgList.cpp b/clang/lib/Driver/ArgList.cpp index 593694cfbbf..54dd4bb7753 100644 --- a/clang/lib/Driver/ArgList.cpp +++ b/clang/lib/Driver/ArgList.cpp @@ -49,6 +49,35 @@ Arg *ArgList::getLastArg(options::ID Id0, options::ID Id1, bool Claim) const { return Res; } +Arg *ArgList::getLastArg(options::ID Id0, options::ID Id1, options::ID Id2, + bool Claim) const { + Arg *Res = 0; + Arg *A0 = getLastArg(Id0, false); + Arg *A1 = getLastArg(Id1, false); + Arg *A2 = getLastArg(Id2, false); + + int A0Idx = A0 ? A0->getIndex() : -1; + int A1Idx = A1 ? A1->getIndex() : -1; + int A2Idx = A2 ? A2->getIndex() : -1; + + if (A0Idx > A1Idx) { + if (A0Idx > A2Idx) + Res = A0; + else if (A2Idx != -1) + Res = A2; + } else { + if (A1Idx > A2Idx) + Res = A1; + else if (A2Idx != -1) + Res = A2; + } + + if (Claim && Res) + Res->claim(); + + return Res; +} + bool ArgList::hasFlag(options::ID Pos, options::ID Neg, bool Default) const { if (Arg *A = getLastArg(Pos, Neg)) return A->getOption().matches(Pos); |