aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Edit
AgeCommit message (Collapse)AuthorFilesLines
2017-06-20[clang] Fix format specifiers fixits for nested macrosAlexander Shaposhnikov1-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
2017-06-08[clang] Fix format specifiers fixitsAlexander Shaposhnikov1-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
2017-06-03Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova1-0/+4
llvm-svn: 304648
2017-04-28[ARCMigrate] When applying changes from remap files, disable the ↵Argyrios Kyrtzidis1-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
2016-12-23Fix problems in "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare ↵Egor Churaev1-0/+1
operand." Summary: Fixed warnings in commit: https://reviews.llvm.org/rL290171 Reviewers: djasper, Anastasia Subscribers: yaxunl, cfe-commits, bader Differential Revision: https://reviews.llvm.org/D27981 llvm-svn: 290431
2016-07-28[OpenCL] Generate opaque type for sampler_t and function call for the ↵Yaxun Liu1-0/+1
initializer Currently Clang use int32 to represent sampler_t, which have been a source of issue for some backends, because in some backends sampler_t cannot be represented by int32. They have to depend on kernel argument metadata and use IPA to find the sampler arguments and global variables and transform them to target specific sampler type. This patch uses opaque pointer type opencl.sampler_t* for sampler_t. For each use of file-scope sampler variable, it generates a function call of __translate_sampler_initializer. For each initialization of function-scope sampler variable, it generates a function call of __translate_sampler_initializer. Each builtin library can implement its own __translate_sampler_initializer(). Since the real sampler type tends to be architecture dependent, allowing it to be initialized by a library function simplifies backend design. A typical implementation of __translate_sampler_initializer could be a table lookup of real sampler literal values. Since its argument is always a literal, the returned pointer is known at compile time and easily optimized to finally become some literal values directly put into image read instructions. This patch is partially based on Alexey Sotkin's work in Khronos Clang (https://github.com/KhronosGroup/SPIR/commit/3d4eec61623502fc306e8c67c9868be2b136e42b). Differential Revision: https://reviews.llvm.org/D21567 llvm-svn: 277024
2016-01-26Remove autoconf supportChris Bieneman1-14/+0
Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
2016-01-13[Bugfix] Fix ICE on constexpr vector splat.George Burgess IV1-0/+3
In {CG,}ExprConstant.cpp, we weren't treating vector splats properly. This patch makes us treat splats more properly. Additionally, this patch adds a new cast kind which allows a bool->int cast to result in -1 or 0, instead of 1 or 0 (for true and false, respectively), so we can sanely model OpenCL bool->int casts in the AST. Differential Revision: http://reviews.llvm.org/D14877 llvm-svn: 257559
2015-10-03Replace double negation of !FileID.isInvalid() with FileID.isValid().Yaron Keren1-1/+1
+couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228. llvm-svn: 249235
2015-09-11[Edit] Fix issue with tracking what macro argument inputs have been edited.Argyrios Kyrtzidis1-14/+66
This was not working correctly, leading to erroneously rejecting valid edits. llvm-svn: 247462
2015-08-04[Edit] Use StringRef's copy method. No functional change intended.Benjamin Kramer1-1/+1
llvm-svn: 243968
2015-03-29[edit] Don't hit an assert when trying to delete a trailing space at EOFBenjamin Kramer1-1/+3
The buffer is guaranteed to be zero-terminated so we can just circumvent the check. Found by afl-fuzz. llvm-svn: 233496
2015-03-18Remove many superfluous SmallString::str() calls.Yaron Keren1-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
2014-09-15Edit: Do not extend a removal to include trailing whitespace if we're at the endBenjamin Kramer1-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
2014-08-25Objective-C modernization. Convert -initWithUTF8String messagingFariborz Jahanian1-1/+2
with auto-boxing syntax for literals. rdar://18080352 llvm-svn: 216405
2014-07-14[CMake] Reorder libdeps by alphabetical order.NAKAMURA Takumi1-1/+1
llvm-svn: 212919
2014-05-09[C++11] Use 'nullptr'.Craig Topper2-5/+5
llvm-svn: 208392
2014-04-28[objcmt] Revert r191796, it's not needed anymore.Argyrios Kyrtzidis1-7/+5
rdar://16223810 llvm-svn: 207391
2014-03-29Avoid a local Twine variable.Benjamin Kramer1-4/+2
Harmless in this case but potentially dangerous if it gets extended some day. llvm-svn: 205107
2014-02-26[CMake] Use LINK_LIBS instead of target_link_libraries().NAKAMURA Takumi1-2/+1
llvm-svn: 202238
2014-02-21[CMake] Get rid of explicit dependencies to include/clang/*.inc and ↵NAKAMURA Takumi1-9/+0
introduce CLANG_TABLEGEN_TARGETS. This does; - clang_tablegen() adds each tblgen'd target to global property CLANG_TABLEGEN_TARGETS as list. - List of targets is added to LLVM_COMMON_DEPENDS. - all clang libraries and targets depend on generated headers. You might wonder this would be regression, but in fact, this is little loss. - Almost all of clang libraries depend on tblgen'd files and clang-tblgen. - clang-tblgen may cause short stall-out but doesn't cause unconditional rebuild. - Each library's dependencies to tblgen'd files might vary along headers' structure. It made hard to track and update *really optimal* dependencies. Each dependency to intrinsics_gen and ClangSACheckers is left as DEPENDS. llvm-svn: 201842
2013-12-11Add front-end infrastructure now address space casts are in LLVM IR.David Tweed1-0/+1
With the introduction of explicit address space casts into LLVM, there's a need to provide a new cast kind the front-end can create for C/OpenCL/CUDA and code to produce address space casts from those kinds when appropriate. Patch by Michele Scandale! llvm-svn: 197036
2013-12-09[CMake] clang/lib: Satisfy dependencies to add *actually used* libraries on ↵NAKAMURA Takumi1-0/+4
target_link_libraries() and LLVM_LINK_COMPONENTS. I will prune redundant dependencies later. llvm-svn: 196800
2013-10-01ObjectiveC migrator: When doing migration, migrator must suggestFariborz Jahanian1-5/+7
migration of headers which have become system headers by user having put the .system_framework in the sdk directory. // rdar://15066802 llvm-svn: 191796
2013-07-18ObjectiveC migrator: Remove semicolon after the typedefFariborz Jahanian1-92/+0
declaration when converting to NS_ENUM. This required some code refactoring. llvm-svn: 186619
2013-07-18ObjectiveC migration. migration to NS_ENUM/SN_OPTIONFariborz Jahanian1-0/+13
- wip. llvm-svn: 186604
2013-07-16ObjectiveC migration: complete migrating classFariborz Jahanian1-22/+22
declaration to include list of protocols class conforms to. llvm-svn: 186443
2013-07-16ObjC migrator: build conforming interfaceFariborz Jahanian1-0/+32
declaration (not yet used). wip. llvm-svn: 186369
2013-07-10ObjC migrator: Improve on hueristics.Fariborz Jahanian1-5/+20
migrate to 'copy attribute if Object class implements NSCopying otherwise assume implied 'strong'. Remove lifetime qualifier on property as it has moved to property's attribute. Added TODO comment for future work by poking into setter implementation. llvm-svn: 186037
2013-07-10objc migrator: More refinment of propertyFariborz Jahanian1-9/+9
attributes in migration. Specialli use of 'copy' attribute for retainable object types. llvm-svn: 185985
2013-07-08[Objective-C migrator] replace candidate user setter/getter withFariborz Jahanian2-2/+28
their equivalent property declaration. wip. llvm-svn: 185873
2013-07-05[objc migrator]: More knobs to do migration toFariborz Jahanian1-0/+6
use of objc's properties. llvm-svn: 185724
2013-04-06[objcmt] Fix a mishandled conversion to objc directory literal.Argyrios Kyrtzidis1-0/+2
rdar://13181413 llvm-svn: 178942
2013-02-20Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie1-3/+3
Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
2013-02-14Remove an unneeded const_castDmitri Gribenko1-3/+2
llvm-svn: 175160
2013-02-08Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose1-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
2013-01-20Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei1-0/+1
OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
2013-01-16[objcmt] Rewrite a NSDictionary dictionaryWithObjects:forKeys: to a ↵Argyrios Kyrtzidis1-4/+158
dictionary literal if we can see the elements of the arrays. for example: NSDictionary *dict = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"1", @"2", nil] forKeys:[NSArray arrayWithObjects:@"A", @"B", nil]]; --> NSDictionary *dict = @{ @"A" : @"1", @"B" : @"2" }; rdar://12428166 llvm-svn: 172679
2013-01-12Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko1-3/+3
brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
2012-12-21EditedSource.cpp: Appease msvc, to add <cctype>.NAKAMURA Takumi1-0/+1
llvm-svn: 170817
2012-12-20Use some heuristics so that when a fixit removes a source range, we tryArgyrios Kyrtzidis1-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
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth3-5/+5
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
2012-12-04Refactor recording the preprocessor conditional directive regions out ofArgyrios Kyrtzidis1-2/+2
PreprocessingRecord and into its own class, PPConditionalDirectiveRecord. Decoupling allows a client to use the functionality of PPConditionalDirectiveRecord without needing a PreprocessingRecord. llvm-svn: 169229
2012-08-31Change the representation of builtin functions in the ASTEli Friedman1-0/+1
(__builtin_* etc.) so that it isn't possible to take their address. Specifically, introduce a new type to represent a reference to a builtin function, and a new cast kind to convert it to a function pointer in the operand of a call. Fixes PR13195. llvm-svn: 162962
2012-07-27clang/lib: [CMake] Update tblgen'd dependencies.NAKAMURA Takumi1-0/+5
llvm-svn: 160851
2012-07-27clang/lib: [CMake] Reformat, alphabetize lists.NAKAMURA Takumi1-1/+1
llvm-svn: 160850
2012-07-16Add libEdit dependency on ClangDiagnosticCommon. Hopefully this will ↵Ted Kremenek1-0/+4
unbreak the VS build. llvm-svn: 160309
2012-07-06[objcmt] Check for classes that accept 'objectForKey:' (or the other selectorsArgyrios Kyrtzidis1-5/+70
that the migrator handles) but return their instances as 'id', resulting in the compiler resolving 'objectForKey:' as the method from NSDictionary. When checking if we can convert to subscripting syntax, check whether the receiver is a result of a class method from a hardcoded list of such classes. In such a case return the specific class as the interface of the receiver. llvm-svn: 159788
2012-07-05[objcmt] Allow migrating to subscripting syntax for other classesArgyrios Kyrtzidis1-15/+25
(apart from NSDictionary/NSArray) that implement objectForKey:/objectAtIndex/etc. and the subscripting methods as well. Part of rdar://11734969 llvm-svn: 159783
2012-07-04Drop the ASTContext.h include from Stmt.h and fix up transitive users.Benjamin Kramer1-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. llvm-svn: 159718