summaryrefslogtreecommitdiffstats
path: root/lib/ARCMigrate/TransformActions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix file headers. NFCFangrui Song2019-03-011-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355176 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST] Update the comments of the various Expr::Ignore* + Related cleanupsBruno Ricci2019-02-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The description of what the various Expr::Ignore* do has drifted from the actual implementation. Inspection reveals that IgnoreParenImpCasts() is not equivalent to doing IgnoreParens() + IgnoreImpCasts() until reaching a fixed point, but IgnoreParenCasts() is equivalent to doing IgnoreParens() + IgnoreCasts() until reaching a fixed point. There is also a fair amount of duplication in the various Expr::Ignore* functions which increase the chance of further future inconsistencies. In preparation for the next patch which will factor out the implementation of the various Expr::Ignore*, do the following cleanups: Remove Stmt::IgnoreImplicit, in favor of Expr::IgnoreImplicit. IgnoreImplicit is the only function among all of the Expr::Ignore* which is available in Stmt. There are only a few users of Stmt::IgnoreImplicit. They can just use instead Expr::IgnoreImplicit like they have to do for the other Ignore*. Move Expr::IgnoreImpCasts() from Expr.h to Expr.cpp. This made no difference in the run-time with my usual benchmark (-fsyntax-only on all of Boost). While we are at it, make IgnoreParenNoopCasts take a const reference to the ASTContext for const correctness. Update the comments to match what the Expr::Ignore* are actually doing. I am not sure that listing exactly what each Expr::Ignore* do is optimal, but it certainly looks better than the current state which is in my opinion between misleading and just plain wrong. The whole patch is NFC (if you count removing Stmt::IgnoreImplicit as NFC). Differential Revision: https://reviews.llvm.org/D57266 Reviewed By: aaron.ballman git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353006 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-1/+1
| | | | | | | | | | Reviewers: teemperor! Subscribers: jholewinski, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50350 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339385 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing spaceFangrui Song2018-07-301-3/+3
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338291 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-8/+8
| | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331834 91177308-0d34-0410-b5e6-96231b3b80d8
* PR37189 Fix incorrect end source location and spelling for a split '>>' token.Richard Smith2018-04-301-2/+6
| | | | | | | | | | | | | | | | | | | 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331155 91177308-0d34-0410-b5e6-96231b3b80d8
* Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova2017-06-031-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304640 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250827 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250822 91177308-0d34-0410-b5e6-96231b3b80d8
* Use llvm::reverse to make a bunch of loops use foreach. NFC.Pete Cooper2015-07-301-4/+3
| | | | | | | | | | | | | | | | In llvm commit r243581, a reverse range adapter was added which allows us to change code such as for (auto I = Fields.rbegin(), E = Fields.rend(); I != E; ++I) { in to for (const FieldDecl *I : llvm::reverse(Fields)) This commit changes a few of the places in clang which are eligible to use this new adapter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243663 91177308-0d34-0410-b5e6-96231b3b80d8
* Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie2014-11-191-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222306 91177308-0d34-0410-b5e6-96231b3b80d8
* ARCMigrate: simplify diagnostic handlingAlp Toker2014-07-021-12/+1
| | | | | | | | | | | | | Recent enhancements in the diagnostics engine mean that TransformActions::report() no longer needs to duplicate this suppression logic. That's great because the old code was flawed and would have attached notes to the wrong primary diagnostic in non-trivial use. With these changes it becomes safe to use reportNote() freely in the migration tool. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212191 91177308-0d34-0410-b5e6-96231b3b80d8
* ARCMigrate: Introduce proper diagnostics for TransformActionsAlp Toker2014-01-261-48/+23
| | | | | | | | | | | | | | | This starts to switch ARCMT to use proper diagnostic messages. The old use was based on incorrect example code from the documentation. The logic of the previous report() functions has been retained to support any external consumers that might be intercepting diagnostic messages through the old interface. Note that the change in test/Misc/warning-flags.c isn't a new warning without a flag, rather one that was previously invisible to the test. Adding a flag might be a good idea though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200124 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
* Drop the ASTContext.h include from Stmt.h and fix up transitive users.Benjamin Kramer2012-07-041-0/+1
| | | | | | | | | | | | | | This required moving the ctors for IntegerLiteral and FloatingLiteral out of line which shouldn't change anything as they are usually called through Create methods that are already out of line. ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector and make it independent from ASTContext.h Pass the StorageAllocator directly to AccessedEntity so it doesn't need to have a definition of ASTContext around. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159718 91177308-0d34-0410-b5e6-96231b3b80d8
* arc migrator: Provide infrastructure to add optionsFariborz Jahanian2012-01-251-0/+19
| | | | | | | | | | specific to migrator. Use its first option to warn migrating from GC to arc when NSAllocateCollectable/NSReallocateCollectable is used. // rdar://10532541 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148887 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] In GC, error out when there is a call that returns a pointer toArgyrios Kyrtzidis2011-11-041-0/+14
| | | | | | GC managed non-objc object memory. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143747 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.Argyrios Kyrtzidis2011-09-191-1/+1
| | | | | | It already works (and is useful with) macro locs as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140057 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename SourceManager::getInstantiationRange to getExpansionRange.Chandler Carruth2011-07-251-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135915 91177308-0d34-0410-b5e6-96231b3b80d8
* Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth2011-07-251-9/+9
| | | | | | | | FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135914 91177308-0d34-0410-b5e6-96231b3b80d8
* Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon ↵Chris Lattner2011-07-231-5/+5
| | | | | | Mulder! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135855 91177308-0d34-0410-b5e6-96231b3b80d8
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-23/+21
| | | | | | | | | LLVM.h imports them into the clang namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
* [arcmt] NSInvocation's [get/set]ReturnValue and [get/set]Argument are only safeArgyrios Kyrtzidis2011-07-181-1/+2
| | | | | | with __unsafe_unretained parameters. Emit error for strong/weak ones. rdar://9206226 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135381 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch comments about 'macro instantiation' to 'macro expansion' inChandler Carruth2011-07-151-2/+2
| | | | | | ARCMigrate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135223 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert terminology in the Lexer from 'instantiate' and variants toChandler Carruth2011-07-141-2/+2
| | | | | | | | | 'expand'. Also update the public API it provides to the new term, and propagate that update to the various clients. No functionality changed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135138 91177308-0d34-0410-b5e6-96231b3b80d8
* Move SourceManager::isAt[Start/End]OfMacroInstantiation functions to the ↵Argyrios Kyrtzidis2011-07-071-2/+2
| | | | | | Lexer, since they depend on it now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134644 91177308-0d34-0410-b5e6-96231b3b80d8
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-071-1/+1
| | | | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134605 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the Preprocessor more memory efficient and improve macro instantiation ↵Argyrios Kyrtzidis2011-07-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics. When a macro instantiation occurs, reserve a SLocEntry chunk with length the full length of the macro definition source. Set the spelling location of this chunk to point to the start of the macro definition and any tokens that are lexed directly from the macro definition will get a location from this chunk with the appropriate offset. For any tokens that come from argument expansion, '##' paste operator, etc. have their instantiation location point at the appropriate place in the instantiated macro definition (the argument identifier and the '##' token respectively). This improves macro instantiation diagnostics: Before: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:5:11: note: instantiated from: int y = M(/); ^ After: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:3:20: note: instantiated from: \#define M(op) (foo op 3); ~~~ ^ ~ t.c:5:11: note: instantiated from: int y = M(/); ^ The memory savings for a candidate boost library that abuses the preprocessor are: - 32% less SLocEntries (37M -> 25M) - 30% reduction in PCH file size (900M -> 635M) - 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134587 91177308-0d34-0410-b5e6-96231b3b80d8
* The ARC Migration Tool. All the credit goes to Argyrios and FariborzJohn McCall2011-06-151-0/+699
for this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133104 91177308-0d34-0410-b5e6-96231b3b80d8