aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Option/Option.h
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2013-07-31 22:44:41 +0000
committerHans Wennborg <hans@hanshq.net>2013-07-31 22:44:41 +0000
commit9dd8c0cffe7de82900823c05159bba765120f1e3 (patch)
tree79572820d2cf0d73ef30d9a6b90c2c3302ac57bb /include/llvm/Option/Option.h
parent03fb46bed1a1489725e0da3dea4608d6ef6e6e4b (diff)
downloadexternal_llvm-9dd8c0cffe7de82900823c05159bba765120f1e3.zip
external_llvm-9dd8c0cffe7de82900823c05159bba765120f1e3.tar.gz
external_llvm-9dd8c0cffe7de82900823c05159bba765120f1e3.tar.bz2
Option parsing: add support for alias arguments.
This makes option aliases more powerful by enabling them to pass along arguments to the option they're aliasing. For example, if we have a joined option "-foo=", we can now specify a flag option "-bar" to be an alias of that, with the argument "baz". This is especially useful for the cl.exe compatible clang driver, where many options are aliases. For example, this patch enables us to alias "/Ox" to "-O3" (-O is a joined option), and "/WX" to "-Werror" (again, -W is a joined option). Differential Revision: http://llvm-reviews.chandlerc.com/D1245 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Option/Option.h')
-rw-r--r--include/llvm/Option/Option.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/Option/Option.h b/include/llvm/Option/Option.h
index 4861b59..47fd817 100644
--- a/include/llvm/Option/Option.h
+++ b/include/llvm/Option/Option.h
@@ -103,6 +103,16 @@ public:
return Owner->getOption(Info->AliasID);
}
+ /// \brief Get the alias arguments as a \0 separated list.
+ /// E.g. ["foo", "bar"] would be returned as "foo\0bar\0".
+ const char *getAliasArgs() const {
+ assert(Info && "Must have a valid info!");
+ assert((!Info->AliasArgs || Info->AliasArgs[0] != 0) &&
+ "AliasArgs should be either 0 or non-empty.");
+
+ return Info->AliasArgs;
+ }
+
/// \brief Get the default prefix for this option.
StringRef getPrefix() const {
const char *Prefix = *Info->Prefixes;