summaryrefslogtreecommitdiffstats
path: root/clang/lib/Edit/EditedSource.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-3/+3
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* PR37189 Fix incorrect end source location and spelling for a split '>>' token.Richard Smith2018-04-301-3/+5
| | | | | | | | | | | | | | | | | | When a '>>' token is split into two '>' tokens (in C++11 onwards), or (as an extension) when we do the same for other tokens starting with a '>', we can't just use a location pointing to the first '>' as the location of the split token, because that would result in our miscomputing the length and spelling for the token. As a consequence, for example, a refactoring replacing 'A<X>' with something else would sometimes replace one character too many, and similarly diagnostics highlighting a template-id source range would highlight one character too many. Fix this by creating an expansion range covering the first character of the '>>' token, whose spelling is '>'. For this to work, we generalize the expansion range of a macro FileID to be either a token range (the common case) or a character range (used in this new case). llvm-svn: 331155
* [Edit, Rewrite] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2018-03-271-1/+12
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 328597
* [clang] Fix format specifiers fixits for nested macrosAlexander Shaposhnikov2017-06-201-11/+16
| | | | | | | | | | | | | | ExpansionLoc was previously calculated incorrectly in the case of nested macros expansions. In this diff we build the stack of expansions where the last one is the actual expansion which should be used for grouping together the edits. The definition of MacroArgUse is adjusted accordingly. Test plan: make check-all Differential revision: https://reviews.llvm.org/D34268 llvm-svn: 305845
* [clang] Fix format specifiers fixitsAlexander Shaposhnikov2017-06-081-18/+19
| | | | | | | | | | | | | | | | | | | | | | | | | This diff fixes printf "fixits" in the case when there is a wrapping macro and the format string needs multiple replacements. In the presence of a macro there is an extra logic in EditedSource.cpp to handle multiple uses of the same macro argument (see the old comment inside EditedSource::canInsertInOffset) which was mistriggerred when the argument was used only once but required multiple adjustments), as a result the "fixit" was breaking down the format string by dropping the second format specifier, i.e. Log1("test 4: %s %s", getNSInteger(), getNSInteger()) was getting replaced with Log1("test 4: %ld ", (long)getNSInteger(), (long)getNSInteger()) (if one removed the macro and used printf directly it would work fine). In this diff we track the location where the macro argument is used and (as it was before) the modifications originating from all the locations except the first one are rejected, but multiple changes are allowed. Test plan: make check-all Differential revision: https://reviews.llvm.org/D33976 llvm-svn: 305018
* [ARCMigrate] When applying changes from remap files, disable the ↵Argyrios Kyrtzidis2017-04-281-5/+9
| | | | | | | | | 'adjustRemovals' functionality of EditedSource 'adjustRemovals' is used to avoid situation when removing a range inadvertently causes 2 separate identifiers to get joined into one. But it is not useful when the edits are character precise, as is the case with the remap files. llvm-svn: 301602
* Replace double negation of !FileID.isInvalid() with FileID.isValid().Yaron Keren2015-10-031-1/+1
| | | | | | +couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228. llvm-svn: 249235
* [Edit] Fix issue with tracking what macro argument inputs have been edited.Argyrios Kyrtzidis2015-09-111-14/+66
| | | | | | This was not working correctly, leading to erroneously rejecting valid edits. llvm-svn: 247462
* [edit] Don't hit an assert when trying to delete a trailing space at EOFBenjamin Kramer2015-03-291-1/+3
| | | | | | | The buffer is guaranteed to be zero-terminated so we can just circumvent the check. Found by afl-fuzz. llvm-svn: 233496
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-181-3/+3
| | | | | | | | | | | | | | | Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
* Edit: Do not extend a removal to include trailing whitespace if we're at the endBenjamin Kramer2014-09-151-0/+6
| | | | | | | | | | of the file. This would run past the end of the buffer. Sadly I don't have a great way to test it, the only way to trigger the bug is having a removal fix it at the end of the file, which none of our current warnings can generate. llvm-svn: 217766
* [C++11] Use 'nullptr'.Craig Topper2014-05-091-1/+1
| | | | llvm-svn: 208392
* Avoid a local Twine variable.Benjamin Kramer2014-03-291-4/+2
| | | | | | Harmless in this case but potentially dangerous if it gets extended some day. llvm-svn: 205107
* [objcmt] Fix a mishandled conversion to objc directory literal.Argyrios Kyrtzidis2013-04-061-0/+2
| | | | | | rdar://13181413 llvm-svn: 178942
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-9/+5
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-3/+3
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* EditedSource.cpp: Appease msvc, to add <cctype>.NAKAMURA Takumi2012-12-211-0/+1
| | | | llvm-svn: 170817
* Use some heuristics so that when a fixit removes a source range, we tryArgyrios Kyrtzidis2012-12-201-3/+72
| | | | | | | | | | | | | | | | | | | | to also remove a trailing space if possible. For example, removing '__bridge' from: i = (__bridge I*)p; should result in: i = (I*)p; not: i = ( I*)p; rdar://11314821 llvm-svn: 170764
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* [objcmt] When rewriting to array/dictionary literals, add an explicitArgyrios Kyrtzidis2012-05-141-1/+4
| | | | | | | | cast to 'id' for any argument that requires it. Part of rdar://11438360. llvm-svn: 156782
* Add new code migrator support for migrating existing Objective-C code to useTed Kremenek2012-03-061-0/+329
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax. This introduces a new library, libEdit, which provides a new way to support migration of code that improves on the original ARC migrator. We now believe that most of its functionality can be refactored into the existing libraries, and thus this new library may shortly disappear. llvm-svn: 152141
OpenPOWER on IntegriCloud