summaryrefslogtreecommitdiff
path: root/lib/Support/CommandLine.cpp
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
* CommandLine: bail out when options get multiply registeredAlp Toker2014-06-19
| | | | | | | | | | These errors are strictly unrecoverable and indicate serious issues such as conflicting option names or an incorrectly linked LLVM distribution. With this change, the errors actually get detected so tests don't pass silently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211260 91177308-0d34-0410-b5e6-96231b3b80d8
* tools: Add a space between package version and LLVM_VERSION_INFOJustin Bogner2014-06-17
| | | | | | This reads a little strangely. Add a space to clean it up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211090 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove system_error.h.Rafael Espindola2014-06-12
| | | | | | | This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210803 91177308-0d34-0410-b5e6-96231b3b80d8
* cl::ParseCommandLineOptions(): Use StringRef to receive ↵NAKAMURA Takumi2014-04-23
| | | | | | sys::path::filename() instead of std::string. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206990 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Make Support/Debug.h modular. This requires it to not changeChandler Carruth2014-04-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | behavior based on other files defining DEBUG_TYPE, which means it cannot define DEBUG_TYPE at all. This is actually better IMO as it forces folks to define relevant DEBUG_TYPEs for their files. However, it requires all files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't already. I've updated all such files in LLVM and will do the same for other upstream projects. This still leaves one important change in how LLVM uses the DEBUG_TYPE macro going forward: we need to only define the macro *after* header files have been #include-ed. Previously, this wasn't possible because Debug.h required the macro to be pre-defined. This commit removes that. By defining DEBUG_TYPE after the includes two things are fixed: - Header files that need to provide a DEBUG_TYPE for some inline code can do so by defining the macro before their inline code and undef-ing it afterward so the macro does not escape. - We no longer have rampant ODR violations due to including headers with different DEBUG_TYPE definitions. This may be mostly an academic violation today, but with modules these types of violations are easy to check for and potentially very relevant. Where necessary to suppor headers with DEBUG_TYPE, I have moved the definitions below the includes in this commit. I plan to move the rest of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big enough. The comments in Debug.h, which were hilariously out of date already, have been updated to reflect the recommended practice going forward. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206822 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
* [C++11] Replace some comparisons with 'nullptr' with simple boolean checks ↵Craig Topper2014-04-09
| | | | | | to reduce verbosity. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205829 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Make use of 'nullptr' in the Support library.Craig Topper2014-04-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205697 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-06
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
* [C+11] Add 'override' keyword to methods in the support library.Craig Topper2014-03-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202791 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper2014-03-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202621 91177308-0d34-0410-b5e6-96231b3b80d8
* Now that we have C++11, turn simple functors into lambdas and remove a ton ↵Benjamin Kramer2014-03-01
| | | | | | | | of boilerplate. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202588 91177308-0d34-0410-b5e6-96231b3b80d8
* CommandLine: Exit successfully for -version and -helpJustin Bogner2014-02-28
| | | | | | | | | | | Tools that use the CommandLine library currently exit with an error when invoked with -version or -help. This is unusual and non-standard, so we'll fix them to exit successfully instead. I don't expect that anyone relies on the current behaviour, so this should be a fairly safe change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202530 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply r200853, which should not crash after Clang plugins were converted ↵Alexander Kornienko2014-02-27
| | | | | | to loadable modules in r201256. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202404 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an invalid check for duplicate option categories.Alexander Kornienko2014-02-07
| | | | | | | | An intermediate solution until the problems with analyzer plugins linking with llvm/Support and causing assertions due to duplicate GeneralCategory are solved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200981 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Fix an invalid check for duplicate option categories."Rafael Espindola2014-02-05
| | | | | | | | This reverts commit r200853. It was causing clang/Analysis/checker-plugins.c to crash. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200858 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an invalid check for duplicate option categories.Alexander Kornienko2014-02-05
| | | | | | | | | | | | | | | | | | | | Summary: The check performed in the comparator is invalid, as some STL implementations enforce strict weak ordering by calling the comparator with the same value. This check was also in a wrong place: the assertion would only fire when -help was used. The new check is performed each time the category is registered (we are not going to have thousands of them, so it's fine to do it in O(N^2)). Reviewers: jordan_rose Reviewed By: jordan_rose CC: cfe-commits, alexmc Differential Revision: http://llvm-reviews.chandlerc.com/D2699 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200853 91177308-0d34-0410-b5e6-96231b3b80d8
* [CommandLine] Aliases require an value if their target requires a value.Jordan Rose2014-01-29
| | | | | | | | | This can still be overridden by explicitly setting a value requirement on the alias option, but by default it should be the same. PR18649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200407 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix known typosAlp Toker2014-01-24
| | | | | | | Sweep the codebase for common typos. Includes some changes to visible function names that were misspelt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200018 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: Fix handling of args that begin with @ but aren't filesJustin Bogner2013-12-06
| | | | | | | | | | | | | | | Command line arguments that begin with @ but aren't a path to an existing file currently cause later @file arguments to be ignored. Correctly skip over these arguments instead of trying to read a non-existent file 20 times and giving up. Since the problem manifests in the clang driver, the test is in that repository. Fixes rdar://problem/15590906 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196620 91177308-0d34-0410-b5e6-96231b3b80d8
* Return true on success in cl::ExpandResponseFilesReid Kleckner2013-12-03
| | | | | | | | | | | | This fixes a logic bug pointed out by Juraj Ivancic. No behavior change because none of the in-tree clients of cl::ExpandResponseFiles check the return value. In this case, the @prefixed arguments are left in the command line. Downstream command line processing has the opportunity to emit errors about it, so this isn't that bad. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196306 91177308-0d34-0410-b5e6-96231b3b80d8
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-19
| | | | | | | | | | | | This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. The memory leaks in this version have been fixed. Thanks Alexey for pointing them out. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195064 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r194865 and r194874.Alexey Samsonov2013-11-18
| | | | | | | | | | | | | This change is incorrect. If you delete virtual destructor of both a base class and a subclass, then the following code: Base *foo = new Child(); delete foo; will not cause the destructor for members of Child class. As a result, I observe plently of memory leaks. Notable examples I investigated are: ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-15
| | | | | | | | | | | This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement TokenizeWindowsCommandLine.Rui Ueyama2013-07-30
| | | | | | | | | | This is a follow up patch for r187390 to implement the parser for the Windows-style command line. This should follow the rule as described at http://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft(v=vs.85).aspx Differential Revision: http://llvm-reviews.chandlerc.com/D1235 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187430 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't leak when expanding response files.Rafael Espindola2013-07-24
| | | | | | | | | | | | | | Before this patch we would strdup each argument. If one was a response file, we would replace it with the response file contents, leaking the original strdup result. We now don't strdup the originals and let StringSaver free any memory it allocated. This also saves a bit of malloc traffic when response files are not used. Leak found by the valgrind build bot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187042 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Beef up and expose the response file parsing in llvm::clReid Kleckner2013-07-18
| | | | | | | | | | | | | | | | | | | The plan is to use it for clang and lld. Major behavior changes: - We can now parse UTF-16 files that have a byte order mark. - PR16209: Don't drop backslashes on the floor if they don't escape anything. The actual parsing loop was based on code from Clang's driver.cpp, although it's been rewritten to track its state with control flow rather than state variables. Reviewers: hans Differential Revision: http://llvm-reviews.chandlerc.com/D1170 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186587 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use PathV1 in CommandLine.cpp.Rafael Espindola2013-06-12
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183842 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix 'gcc -flto' builds for unittest binaries (undefined reference toPatrik Hagglund2013-06-12
| | | | | | | | | `typeinfo for llvm::cl::GenericOptionValue'). Remove an "anchor" method for an abstract class. (This does not increase the number of vtables.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183830 91177308-0d34-0410-b5e6-96231b3b80d8
* Include PathV1.h in files that use it.Rafael Espindola2013-06-11
| | | | | | This is preparation for replacing Path.h with PathV2.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183782 91177308-0d34-0410-b5e6-96231b3b80d8
* Better output for long help strings for command-line options.Alexander Kornienko2013-05-10
| | | | | | | | | | | | | | | | | | | | | Summary: This patch allows using \n inside long help strings for command-line options, so that all lines are equally indented. This is not a perfect solution, as we don't (and probably don't want to) know about terminal width, but it allows to format long help strings somehow readable without manually padding them with spaces. A motivating example is -help output from clang-format (source code in tools/clang-format/ClangFormat.cpp, see cl options offset, length, style, and dump-config). Reviewers: atrick, alexfh Reviewed By: alexfh CC: llvm-commits, rafael Differential Revision: http://llvm-reviews.chandlerc.com/D779 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181608 91177308-0d34-0410-b5e6-96231b3b80d8
* Implemented public interface for modifying registered (not positional or ↵Andrew Trick2013-05-06
| | | | | | | | sink options) command line options at runtime. Patch by Dan Liew! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181254 91177308-0d34-0410-b5e6-96231b3b80d8
* Support command line option categories.Andrew Trick2013-05-06
| | | | | | Patch by Dan Liew! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181253 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unused member variable from HelpPrinter. Move another member ↵Craig Topper2013-03-09
| | | | | | variable to be a local variable in the only method that uses it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176778 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable response files in all tools. Patch by Liu, Yaxun (Sam). I have simplifiedRafael Espindola2012-10-09
| | | | | | the test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165535 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove tabs.Bill Wendling2012-07-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160479 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't cast away constant qualifier.Duncan Sands2012-03-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152553 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct use of const in ParseCommandLineOptionsDavid Blaikie2012-02-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149999 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy up. s/Low Level Virtual Machine/LLVM/.Jim Grosbach2012-01-25
| | | | | | LLVM isn't an acronym anymore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148985 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove dead default.David Blaikie2012-01-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148738 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing unused default switch cases in switches over enums that already ↵David Blaikie2012-01-16
| | | | | | | | account for all enumeration values explicitly. (This time I believe I've checked all the -Wreturn-type warnings from GCC & added the couple of llvm_unreachables necessary to silence them. If I've missed any, I'll happily fix them as soon as I know about them) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148262 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r147542 after comments from Joerg SonnenbergerSebastian Pop2012-01-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147608 91177308-0d34-0410-b5e6-96231b3b80d8
* use getHostTriple instead of getDefaultTargetTriple in getClosestTargetForJITSebastian Pop2012-01-04
| | | | | | | | | | Get back getHostTriple. For JIT compilation, use the host triple instead of the default target: this fixes some JIT testcases that used to fail when the compiler has been configured as a cross compiler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147542 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some missing anchors.David Blaikie2011-12-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145578 91177308-0d34-0410-b5e6-96231b3b80d8
* rename getHostTriple into getDefaultTargetTripleSebastian Pop2011-11-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143502 91177308-0d34-0410-b5e6-96231b3b80d8
* CommandLine: Add support for 64 bit unsigned integer options.Benjamin Kramer2011-09-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139848 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the registered target printing in version strings completely out ofChandler Carruth2011-07-22
| | | | | | | | | | | | | | | | | the Support library. Now its part of the TargetRegistry, and the three commands that care about this explicitly register this extra bit of version information. The set of commands which care was computed by intersecting those which use the Support library's version string printing and those that initialize all the registered targets in a way that produces a meaningful list. The only odd ball out is that 'clang -cc1as -version' no longer prints the registered targets. I don't think anyone is really interested in that (especially as the fact that llvm-mc does so is under a FIXME), but if someone really does want this back I'll happily apply the same patch there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135757 91177308-0d34-0410-b5e6-96231b3b80d8