summaryrefslogtreecommitdiff
path: root/lib/Option
Commit message (Collapse)AuthorAge
* Revert "Introduce a string_ostream string builder facilty"Alp Toker2014-06-26
| | | | | | Temporarily back out commits r211749, r211752 and r211754. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211814 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a string_ostream string builder faciltyAlp Toker2014-06-26
| | | | | | | | | | | | | | | | | | | | string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211749 91177308-0d34-0410-b5e6-96231b3b80d8
* ArgList: use MakeArgList overloads in subclasses and clean up some calls.Justin Bogner2014-06-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211340 91177308-0d34-0410-b5e6-96231b3b80d8
* Options: Use erase_if to remove Args from the list.Benjamin Kramer2014-05-18
| | | | | | | While there make getOption return a const reference so we don't have to put it on the stack when calling methods on it. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209088 91177308-0d34-0410-b5e6-96231b3b80d8
* Protect the ArgList dtorDavid Blaikie2014-04-20
| | | | | | | | | | | | | It could even be made non-virtual if it weren't for bad compiler warnings. This demonstrates that ArgList objects aren't destroyed polymorphically and possibly that they aren't even used polymorphically. If that's the case, it might be possible to refactor the two ArgList types more separately and simplify the Arg ownership model. *continues experimenting* git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206727 91177308-0d34-0410-b5e6-96231b3b80d8
* Use unique_ptr to handle ownership of synthesized args in DerivedArgListDavid Blaikie2014-04-20
| | | | | | | | This might be able to be simplified further by using Arg as a value type in a linked list (to maintain pointer validity), but here's something simple to start with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206724 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-15
| | | | | | instead of comparing to nullptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206252 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid buffer copies when a Twine already is a StringRef.David Blaikie2013-12-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196301 91177308-0d34-0410-b5e6-96231b3b80d8
* Use startswith_lower() where possible.Jakub Staszak2013-11-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194007 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix another mistake in r190442.Eli Friedman2013-09-10
| | | | | | Sorry about that; I'll try to be more careful about DEBUG mode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190449 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused functions.Eli Friedman2013-09-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190442 91177308-0d34-0410-b5e6-96231b3b80d8
* Option parsing: support case-insensitive option matching.Rui Ueyama2013-08-28
| | | | | | Re-submitting r189416 with fix for Windows build on where strcasecmp is not defined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189501 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Option parsing: support case-insensitive option matching." as it ↵Rui Ueyama2013-08-28
| | | | | | | | broke Windows buildbot. This reverts r189416. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189424 91177308-0d34-0410-b5e6-96231b3b80d8
* Option parsing: support case-insensitive option matching.Rui Ueyama2013-08-27
| | | | | | | | | | | | | | Link.exe's command line options are case-insensitive. This patch adds a new attribute to OptTable to let the option parser to compare options, ignoring case. Command lines are generally case-insensitive on Windows. CL.exe is an exception. So this new attribute should be useful for other commands running on Windows. Differential Revision: http://llvm-reviews.chandlerc.com/D1485 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189416 91177308-0d34-0410-b5e6-96231b3b80d8
* Options: explicit handling of --Hans Wennborg2013-08-13
| | | | | | | | | | | Clients of the option parsing library should handle it explicitly using a KIND_REMAINING_ARGS option. Clang and lld have been updated in r188316 and r188318, respectively. Also fix -Wsign-compare warning in the option parsing test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188323 91177308-0d34-0410-b5e6-96231b3b80d8
* Options: Add new option kind that consumes remaining argumentsHans Wennborg2013-08-13
| | | | | | | | | | | | | | | | This adds KIND_REMAINING_ARGS, a class of options that consume all remaining arguments on the command line. This will be used to support /link in clang-cl, which is used to forward all remaining arguments to the linker. It also allows us to remove the hard-coded handling of "--", allowing clients (clang and lld) to implement that functionality themselves with this new option class. Differential Revision: http://llvm-reviews.chandlerc.com/D1387 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188314 91177308-0d34-0410-b5e6-96231b3b80d8
* Option/CMakeLists.txt: Don't use target_link_libraries. LLVMBuild knows ↵NAKAMURA Takumi2013-08-06
| | | | | | dependencies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187777 91177308-0d34-0410-b5e6-96231b3b80d8
* Option parsing: recognize the special -- tokenHans Wennborg2013-08-02
| | | | | | | | | | | | | | Everything that comes after -- should be treated as a filename. This enables passing in filenames that would otherwise be conflated with command-line options. This is especially important for clang-cl which supports options starting with /, which are easily conflatable with Unix-style path names. Differential Revision: http://llvm-reviews.chandlerc.com/D1274 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187675 91177308-0d34-0410-b5e6-96231b3b80d8
* Option parsing: add support for alias arguments.Hans Wennborg2013-07-31
| | | | | | | | | | | | | | | | | | 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
* Silence gcc warning.Richard Trieu2013-07-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186879 91177308-0d34-0410-b5e6-96231b3b80d8
* Option parsing: allow aliases in groupsHans Wennborg2013-07-22
| | | | | | | | | Option aliases in option groups were previously disallowed by an assert. As far as I can tell, there was no technical reason for this, and I would like to be able to put cl.exe compatible options in their own group for Clang, so let's change the assert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186838 91177308-0d34-0410-b5e6-96231b3b80d8
* [Option] Add inclusion and exclusion flags to option parsingReid Kleckner2013-07-19
| | | | | | | | | | | | | | | | | | | Summary: This allows the clang driver to put MSVC compatible options in the same enumerator space as its normal options but exclude them from normal option parsing. Also changes the standard ParseArgs() method to consider unknown arguments with a leading slash as being inputs rather than flags. High level discussion for clang-cl is here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-June/030404.html CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1049 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186703 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Option] Store arg strings in a set backed by a BumpPtrAllocator"Reid Kleckner2013-07-15
| | | | | | | | | This broke clang's crash-report.c test, and I haven't been able to figure it out yet. This reverts commit r186319. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186329 91177308-0d34-0410-b5e6-96231b3b80d8
* [Option] Store arg strings in a set backed by a BumpPtrAllocatorReid Kleckner2013-07-15
| | | | | | | | | | | No functionality change. This is preparing to move response file parsing into lib/Option so it can be shared between clang and lld. This change isn't just a micro-optimization. Clang's driver uses a std::set<std::string> to unique arguments while parsing response files, so this matches that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186319 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crash bug in dumping options with groupsReid Kleckner2013-06-26
| | | | | | | | Option groups don't have prefixes. Option dumping is basically dead code unless there is something wrong with the option table, so this isn't an important crasher. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185031 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge changes to clang's Driver code into LLVM's Option libraryReid Kleckner2013-06-13
| | | | | | | | | | | | This is in preparation for switching the clang driver over to using LLVM's Option library. Richard Smith introduced most of these changes to the clang driver in r167638. Reviewers: espindola on IRC Differential Revision: http://llvm-reviews.chandlerc.com/D970 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183925 91177308-0d34-0410-b5e6-96231b3b80d8
* Resort the #include lines in include/... and lib/... with theChandler Carruth2013-01-02
| | | | | | | | | | utils/sort_includes.py script. Most of these are updating the new R600 target and fixing up a few regressions that have creeped in since the last time I sorted the includes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171362 91177308-0d34-0410-b5e6-96231b3b80d8
* Copy clang/Driver/<Option parsing stuff> to llvm.Michael J. Spencer2012-12-05
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169344 91177308-0d34-0410-b5e6-96231b3b80d8