summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Add experimental flag for adaptive parameter bin-packing.Daniel Jasper2013-07-103-12/+62
| | | | | | | | | | | | | | | | | | | | | | | | | This is not activated for any style, might change or go away completely. For those that want to play around with it, set ExperimentalAutoDetectBinPacking to true. clang-format will then: Look at whether function calls/declarations/definitions are currently formatted with one parameter per line (on a case-by-case basis). If so, clang-format will avoid bin-packing the parameters. If all parameters are on one line (thus that line is "inconclusive"), clang-format will make the choice dependent on whether there are other bin-packed calls/declarations in the same file. The reason for this change is that bin-packing in some situations can be really bad and an author might opt to put one parameter on each line. If the author does that, he might want clang-format not to mess with that. If the author is unhappy with the one-per-line formatting, clang-format can easily be convinced to bin-pack by putting any two parameters on the same line. llvm-svn: 186003
* Fixed comment of Sema::FindInstantiatedDecl.Serge Pavlov2013-07-101-5/+5
| | | | llvm-svn: 185997
* Finish off mangling locals in block literals.Eli Friedman2013-07-101-4/+25
| | | | | | | Specifically, handle the case where the block is in a default argument in a class method. The mangling here follows what we do for lambdas. llvm-svn: 185991
* Get rid of dead/useless code for block mangling.Eli Friedman2013-07-103-37/+8
| | | | llvm-svn: 185989
* More local mangling fixes.Eli Friedman2013-07-105-59/+98
| | | | | | | | | | | | Compute mangling numbers for externally visible local variables and tags. Change the mangler to consistently use discriminators where necessary. Tweak the scheme we use to number decls which are not externally visible to avoid unnecessary discriminators in common cases now that we request them more consistently. Fixes <rdar://problem/14204721>. llvm-svn: 185986
* objc migrator: More refinment of propertyFariborz Jahanian2013-07-101-9/+9
| | | | | | | attributes in migration. Specialli use of 'copy' attribute for retainable object types. llvm-svn: 185985
* Apply BlackList -> SpecialCaseList rename in Clang.Peter Collingbourne2013-07-091-3/+3
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1095 llvm-svn: 185979
* Objective-C: merge objc_requires_super attribute ofFariborz Jahanian2013-07-091-1/+9
| | | | | | | | | method declaration into its implementation to prevent a bogus warning about mismatched attributes. then make sure the warning about missing call to super comes out of the method implementation. // rdar://14251387 llvm-svn: 185974
* Reapply an improved version of r180816/180817.Adrian Prantl2013-07-091-16/+0
| | | | | | | | | | | Do not generate VLAs as complex variables any more, as they are now correctly represented as breg+0 locations in the backend. (Paired commit with LLVM: r185966) rdar://problem/13658587 llvm-svn: 185967
* ObjC migrator: Add -objcmt-migrate-property to do propertyFariborz Jahanian2013-07-094-9/+23
| | | | | | | migration. Also, fixes an old bug where older migration flags were not being checked for properly. llvm-svn: 185948
* Initial support for formatting trailing return types.Daniel Jasper2013-07-093-3/+13
| | | | | | | | | | | | This fixes llvm.org/PR15170. For now, the basic formatting rules are (based on the C++11 standard): * Surround the "->" with spaces. * Break before "->". Also fix typo. llvm-svn: 185938
* ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup andRafael Espindola2013-07-097-39/+34
| | | | | | | | Sema::ActOnDocumentableDecls. Patch by Robert Wilhelm. llvm-svn: 185931
* Avoid confusing indentations for chained function calls.Daniel Jasper2013-07-091-4/+18
| | | | | | | | | | | | | | | | | | | Basically treat a function with a trailing call similar to a function with multiple parameters. Before: aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa)) .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(); After: aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaa)) .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(); Also fix typo. llvm-svn: 185930
* Fix alignment of closing brace in braced initializers.Daniel Jasper2013-07-094-33/+36
| | | | | | | | | | | | | | | | | | | | | | Before: someFunction(OtherParam, BracedList{ // comment 1 (Forcing intersting break) param1, param2, // comment 2 param3, param4 }); After: someFunction(OtherParam, BracedList{ // comment 1 (Forcing intersting break) param1, param2, // comment 2 param3, param4 }); To do so, the UnwrappedLineParser now stores the information about the kind of brace in the FormatToken. llvm-svn: 185914
* Format overloaded operators like other functions.Daniel Jasper2013-07-092-5/+8
| | | | | | | | | | | | | | This fixes llvm.org/PR16328 (at least partially). Before: SomeLoooooooooooooooooooooooooooooogType operator<<( const SomeLooooooooogType &a, const SomeLooooooooogType &b); After: SomeLoooooooooooooooooooooooooooooogType operator<<(const SomeLooooooooogType &a, const SomeLooooooooogType &b); llvm-svn: 185908
* [analyzer] Fixup for r185609: actually do suppress warnings coming out of ↵Anna Zaks2013-07-091-4/+4
| | | | | | | | | | | std::list. list is the name of a class, not a namespace. Change the test as well - the previous version did not test properly. Fixes radar://14317928. llvm-svn: 185898
* Fix recovery for missing * in objc property.Eli Friedman2013-07-091-2/+10
| | | | | | <rdar://problem/14354144> llvm-svn: 185897
* Don't give # and ## special treatment when in -traditional-cpp mode. Patch byRichard Smith2013-07-091-0/+12
| | | | | | Austin Seipp! llvm-svn: 185896
* Generalize hack allowing 'const' in __has_attribute (etc) to allow any tokenRichard Smith2013-07-091-3/+1
| | | | | | | with identifier info. This covers most identifier-like entities (other than the ISO646 keywords). llvm-svn: 185895
* Fix crash typo-correcting dependent member func.Eli Friedman2013-07-081-1/+1
| | | | | | PR16561. llvm-svn: 185887
* Attempt typo correction for function calls with the wrong number of arguments.Kaelyn Uhrain2013-07-081-4/+98
| | | | | | | | | | | | | | | Combined with typo correction's new ability to apply global/absolute nested name specifiers to possible corrections, cases such as in PR12287 where the desired function is being shadowed by a lexically closer function with the same name but a different number of parameters will now include a FixIt. On a side note, since the test for this change caused test/SemaCXX/typo-correction.cpp to exceed the typo correction limit for a single file, I've included a test case for exceeding the limit and added some comments to both the original and part two of typo-correction.cpp warning future editors of the files about the limit. llvm-svn: 185881
* Make a couple of useful typo correction callbacks more widely available.Kaelyn Uhrain2013-07-082-62/+40
| | | | llvm-svn: 185880
* ObjC migration: Skip over setter/getter with attributesFariborz Jahanian2013-07-081-1/+6
| | | | | | for now. llvm-svn: 185879
* [Objective-C migrator] replace candidate user setter/getter withFariborz Jahanian2013-07-083-3/+29
| | | | | | their equivalent property declaration. wip. llvm-svn: 185873
* Fix Sema for compares with _Atomic vars.Eli Friedman2013-07-082-41/+25
| | | | | | | | | | | | | | | | Use UsualArithmeticConversions unconditionally in analysis of comparisons and conditional operators: the method performs the usual arithmetic conversions if both sides are arithmetic, and usual unary conversions if they are not. This is just a cleanup for conditional operators; for comparisons, it fixes the issue that we would try to check isArithmetic() on an atomic type. Also, fix GetExprRange() in SemaChecking.cpp so it deals with variables of atomic type correctly. Fixes PR15537. llvm-svn: 185857
* Fix incorrect incorrect cast identification in clang-format.Daniel Jasper2013-07-081-0/+1
| | | | | | | | | | | This fixes llvm.org/PR16534. Before: aaaaa& operator+(const aaaaa&)LLVM_DELETED_FUNCTION; After: aaaaa& operator+(const aaaaa&) LLVM_DELETED_FUNCTION; llvm-svn: 185828
* Reformat clang-format's source files after r185822 and others.Daniel Jasper2013-07-089-59/+51
| | | | llvm-svn: 185823
* Prefer similar line breaks.Daniel Jasper2013-07-081-9/+15
| | | | | | | | | | | | | | | | | | | | | | | This adds a penalty for clang-format for each break that occurs in a set of parentheses (including fake parenthesis that determine the range of certain operator precendences) that have not yet been broken. Thereby, clang-format prefers similar line breaks. This fixes llvm.org/PR15506. Before: const int kTrackingOptions = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways; After: const int kTrackingOptions = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways; Also removed ParenState::ForFakeParenthesis which has become unused. llvm-svn: 185822
* Fix use of invalidated iterator bug in AST match finder.Manuel Klimek2013-07-081-4/+6
| | | | | | | | Pulled out the cache clearing in the case of descendant matching, too, for consistency, also it is not technically needed there. FIXME: Make cache size configurable and add unit test. llvm-svn: 185820
* Fix for corner cases in code handling leading "* " decorations in block commentsAlexander Kornienko2013-07-082-28/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fixes problems that lead to incorrect formatting of these and similar snippets: /* ** */ /* **/ /* * */ /* *test */ Clang-format used to think that all the cases above use "* " decoration, and failed to calculate insertion position properly. It also used to remove leading "* " in the last line. Reviewers: klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1113 llvm-svn: 185818
* Simplify code. No functional change.Craig Topper2013-07-081-3/+1
| | | | llvm-svn: 185792
* Introduce a typedef for the type of NewlyDeducedPacks to avoid repeating the ↵Craig Topper2013-07-081-20/+19
| | | | | | small size of the inner SmallVector. llvm-svn: 185789
* Remove 'else' after 'return'Craig Topper2013-07-081-1/+1
| | | | llvm-svn: 185787
* Function argument formatting fixes. No functional change.Craig Topper2013-07-081-6/+6
| | | | llvm-svn: 185786
* Function argument formatting fixes.Craig Topper2013-07-081-17/+19
| | | | llvm-svn: 185785
* Use SmallVectorImpl::reverse_iterator instead of SmallVector to avoid ↵Craig Topper2013-07-085-8/+8
| | | | | | specifying the vector size. llvm-svn: 185784
* Sema: Do not merge new decls with invalid, old declsDavid Majnemer2013-07-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sema::MergeFunctionDecl attempts merging two decls even if the old decl is invalid. This can lead to interesting circumstances where we successfully merge the decls but the result makes no sense. Take the following for example: template <typename T> int main(void); int main(void); Sema will not consider these to be overloads of the same name because main can't be overloaded, which means that this must be a redeclaration. In this case the templated decl is compatible with the non-templated decl allowing the Sema::CheckFunctionDeclaration machinery to move on and do bizarre things like setting the previous decl of a non-templated decl to a templated decl! The way I see it, we should just bail from MergeFunctionDecl if the old decl is invalid. This fixes PR16531. llvm-svn: 185779
* Fixed source location info for UnaryTransformTypeLoc nodes.Enea Zaffanella2013-07-061-0/+1
| | | | llvm-svn: 185765
* Objective-C: Warn when fast enumeration variable isn't used.Fariborz Jahanian2013-07-061-3/+0
| | | | | | // rdar://14182680. llvm-svn: 185762
* Remove some useless declarations (found by scan-build)Sylvestre Ledru2013-07-062-3/+1
| | | | llvm-svn: 185752
* Sema: Fix a crash when main is redeclared as a function-template.David Majnemer2013-07-061-8/+8
| | | | | | | | | | This boils down to us sending invalid function decls to CheckFunctionDeclaration becauswe we did not consider that CheckMain could cause the decl to be invalid. Instead, interogate the new decl's main-validity and *then* send it over to get CheckFunctionDeclaration'd if it was still valid after calling CheckMain. llvm-svn: 185745
* [comment parsing]: Removes an unsafe API whoseFariborz Jahanian2013-07-051-2/+2
| | | | | | | use can cause crash. No test is available. It is uncovered by code browsing. // rdar://14348205 llvm-svn: 185732
* Use llvm::sys::fs::createUniqueFile.Rafael Espindola2013-07-055-12/+9
| | | | | | | Include a test that clang now produces output files with permissions matching the umask. llvm-svn: 185727
* [objc migrator]: More knobs to do migration toFariborz Jahanian2013-07-052-8/+10
| | | | | | use of objc's properties. llvm-svn: 185724
* Don't use mangleCXXRTTIName in TBAA for C code.Eli Friedman2013-07-052-14/+7
| | | | | | | | | | | | | | This changes the TBAA code so it doesn't use mangleCXXRTTIName in C, because it doesn't really make sense there. Also, as sort of a defense-in-depth change, fix the mangler so it handles C RecordDecls correctly. No tests because I don't know the TBAA code well enough to write a test, and I don't know how else to trigger mangling a local struct in C. Fixes a crash with r185450 reported by Joerg Sonnenberger. llvm-svn: 185721
* Use llvm::sys::fs::createTemporaryFile.Rafael Espindola2013-07-057-21/+14
| | | | llvm-svn: 185717
* Use SmallVectorImpl& for function arguments instead of SmallVector.Craig Topper2013-07-0516-48/+46
| | | | llvm-svn: 185715
* Fix regression from r185450.Eli Friedman2013-07-051-4/+5
| | | | | | | | As it turns out, the NoFunction bit for local class mangling needed to be propagated into more places. r185450 turned what used to be an incorrect mangling into an assertion. llvm-svn: 185713
* Objective-C: diagnose when synthesizing an ivar ofFariborz Jahanian2013-07-051-1/+7
| | | | | | abstract class type. // rdar://14261999 llvm-svn: 185710
* Fix PR16547.Rafael Espindola2013-07-051-2/+3
| | | | | | | | | | | We should not be asking unique_file to prepend the system temporary directory when creating the html report. Unfortunately I don't think we can test this with the current infrastructure since unique_file ignores MakeAbsolute if the directory is already absolute and the paths provided by lit are. I will take a quick look at making this api a bit less error prone. llvm-svn: 185707
OpenPOWER on IntegriCloud