summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTDiagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova2017-06-031-0/+1
| | | | llvm-svn: 304650
* PR30831: Teach template type diffing to cope with TemplateSpecializationTypesRichard Smith2016-10-281-7/+10
| | | | | | that desugar to non-TSTs (such as injected-class-names). llvm-svn: 285437
* Fix typos from r277797 and unused variable from r277889.Richard Trieu2016-08-061-4/+4
| | | | llvm-svn: 277900
* Fix crash in template type diffing.Richard Trieu2016-08-051-0/+6
| | | | | | | | | When the type being diffed is a type alias, and the orginal type is not a templated type, then there will be no unsugared TemplateSpecializationType. When this happens, exit early from the constructor. Also add assertions to the other iterator accessor to prevent the iterator from being used. llvm-svn: 277797
* [NFC] Header cleanupMehdi Amini2016-07-181-1/+0
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-071-3/+2
| | | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274732
* Apply some suggestions from clang-tidy's performance-unnecessary-value-param.Benjamin Kramer2016-06-151-8/+8
| | | | | | No functionality change intended. llvm-svn: 272789
* Fix Clang crash with template type diffing.Richard Trieu2016-03-301-3/+8
| | | | | | | | | | Fixes https://llvm.org/bugs/show_bug.cgi?id=27129 which is crash involving type aliases and template type diffing. Template arguments for type aliases and template arguments for the underlying desugared type may not have one-to-one relations, which could mess us the attempt to get more information from the desugared type. For type aliases, ignore the iterator over the desugared type. llvm-svn: 264940
* Fix some Clang-tidy readability-redundant-control-flow warnings; other minor ↵Eugene Zelenko2016-02-101-4/+2
| | | | | | | | fixes. Differential revision: http://reviews.llvm.org/D17060 llvm-svn: 260414
* Template Type Diffing changeRichard Trieu2016-02-021-3/+9
| | | | | | | When all the arguments of a template are elided, print "A<...>" instead of "A<[2 * ...]>". Also remove comment fragment that means nothing. llvm-svn: 259445
* Fix a -Wparentheses warning in ASTDiagnostic.cpp.James Y Knight2016-01-151-1/+1
| | | | llvm-svn: 257871
* Fixing more issues with template type diffingRichard Trieu2016-01-151-16/+20
| | | | | | | | | | | | 1) Print qualifiers for templates with zero arguments 2) Add a few more tests for the template type diffing refactoring. Specifically, PR24587 has been fixed and has a test case from http://reviews.llvm.org/D15384 3) Adds asserts to check the DiffTree is in correct state when moving nodes 4) Rename the field FromType and ToType since it is heavily used within member functions. llvm-svn: 257870
* Add new diff modes to template type diffing.Richard Trieu2016-01-151-8/+168
| | | | | | | | Remove an old assertion that does not hold. It is possible for a template argument to be a declaration in one instantiation and an integer in another. Create two new diff kinds for these (decl vs int and int vs decl). llvm-svn: 257869
* Save the integer type for integral template arguments.Richard Trieu2016-01-151-25/+64
| | | | | | | | | Save the integer type when diffing integers in template type diffing. When integers are different sizes, print out the type along with the integer value. Also with the type information, print true and false instead of 1 and 0 for boolean values. llvm-svn: 257861
* Make template type diffing use the new desguared iterator.Richard Trieu2016-01-151-322/+158
| | | | | | | | | | | | | If available, use the canonical template argument to fill in information for template type diffing instead of attempting to special case and evaluate Expr's for the value. Since those are the values used in template instantiation, we don't have to worry about difference between our evaluator and theirs. Also move the nullptr template arguments from DiffKind::Expression to DiffKind::Declaration and allow DiffKind::Declaration to set an Expr. The only effect that should result is that a named nullptr will show up as 'ptr aka nullptr' in diagnostics. llvm-svn: 257853
* Change the TSTiterator in Template Type Diffing.Richard Trieu2016-01-141-80/+117
| | | | | | | | Modify the TSTiterator to have two internal iterators, which will walk the provided sugared type and the desugared type. This will provide better access to the template argument information. No functional changes. llvm-svn: 257838
* Refactor template type diffingRichard Trieu2016-01-141-226/+249
| | | | | | | | | | | | | | | 1) Instead of using pairs of From/To* fields, combine fields into a struct TemplateArgInfo and have two in each DiffNode. 2) Use default initialization in DiffNode so that the constructor shows the only field that is initialized differently on construction. 3) Use Set and Get functions per each DiffKind to make sure all fields for the diff is set. In one case, the Expr fields were not set. 4) Don't print boolean literals for boolean template arguments. This prevents printing 'false aka 0' Only #3 has a functional change, which is reflected in the test change. llvm-svn: 257831
* Support __builtin_ms_va_list.Charles Davis2015-09-171-1/+2
| | | | | | | | | | | | | | | | | | Summary: This change adds support for `__builtin_ms_va_list`, a GCC extension for variadic `ms_abi` functions. The existing `__builtin_va_list` support is inadequate for this because `va_list` is defined differently in the Win64 ABI vs. the System V/AMD64 ABI. Depends on D1622. Reviewers: rsmith, rnk, rjmccall CC: cfe-commits Differential Revision: http://reviews.llvm.org/D1623 llvm-svn: 247941
* Remove and forbid raw_svector_ostream::flush() calls.Yaron Keren2015-08-131-2/+0
| | | | | | | | | | After r244870 flush() will only compare two null pointers and return, doing nothing but wasting run time. The call is not required any more as the stream and its SmallString are always in sync. Thanks to David Blaikie for reviewing. llvm-svn: 244928
* PR10405 - Desugar FunctionType and TemplateSpecializationType if any type ↵Nikola Smiljanic2015-07-161-4/+56
| | | | | | that appears inside needs to be desugared. llvm-svn: 242371
* AST: Avoid reading an unitialized valueJustin Bogner2015-07-081-2/+2
| | | | | | | | | | Desugar doesn't necessarily initialize ShouldAKA, but as of r241542 it may read it. Fix the misuse of the API and initialize this before passing it in. Found by ubsan. llvm-svn: 241705
* Implement the Objective-C __kindof type qualifier.Douglas Gregor2015-07-071-1/+2
| | | | | | | | | | The __kindof type qualifier can be applied to Objective-C object (pointer) types to indicate id-like behavior, which includes implicit "downcasting" of __kindof types to subclasses and id-like message-send behavior. __kindof types provide better type bounds for substitutions into unspecified generic types, which preserves more type information. llvm-svn: 241548
* Handle Objective-C type arguments.Douglas Gregor2015-07-071-0/+10
| | | | | | | | | | | | | | | | | | | | | Objective-C type arguments can be provided in angle brackets following an Objective-C interface type. Syntactically, this is the same position as one would provide protocol qualifiers (e.g., id<NSCopying>), so parse both together and let Sema sort out the ambiguous cases. This applies both when parsing types and when parsing the superclass of an Objective-C class, which can now be a specialized type (e.g., NSMutableArray<T> inherits from NSArray<T>). Check Objective-C type arguments against the type parameters of the corresponding class. Verify the length of the type argument list and that each type argument satisfies the corresponding bound. Specializations of parameterized Objective-C classes are represented in the type system as distinct types. Both specialized types (e.g., NSArray<NSString *> *) and unspecialized types (NSArray *) are represented, separately. llvm-svn: 241542
* Update assumption in template diffing about integer template arguments.Richard Trieu2015-02-261-6/+14
| | | | | | | | | | Fix for PR22017. Integer template arguments are automatically bit extended to the size of the integer type. In template diffing, evaluated expressions were not having their results extending, leading to comparing two APSInt's with different widths. Apply the proper bit extending when evaluating template arguments. This mainly affected bool template arguments. llvm-svn: 230603
* When checking the template argument list, use a copy of that list for changesRichard Trieu2015-01-241-22/+14
| | | | | | | | | | | | | | | | | | | and only update the orginal list on a valid arugment list. When checking an individual expression template argument, and conversions are required, update the expression in the template argument. Since template arguments are speculatively checked, the copying of the template argument list prevents updating the template arguments when the list does not match the template. Additionally, clean up the integer checking code in the template diffing code. The code performs unneccessary conversions from APSInt to APInt. Fixes PR21758. This essentially reverts r224770 to recommits r224667 and r224668 with extra changes to prevent the template instantiation problems seen in PR22006. A test to catch the discovered problem is also added. llvm-svn: 226983
* [msan] Fix a uninitialized-use bug in the template argument diffingChandler Carruth2015-01-171-1/+2
| | | | | | | | | | | | | | | | | logic. In one place we would try to check for the difference between integers even if we were missing one of the integers. This would eventually end up reading uninitialized data out of the APSInt objects. The fix is to short circuit the sameness test when we don't have integers on both sides. This fixes a test failure I was seeing with MSan. Not sure whether other bots were seeing it or not, but yay MSan. In particular the feature to very carefully track origins back through stores throughout the program was invaluable. llvm-svn: 226375
* This reverts commit r224668 and r224667.Rafael Espindola2014-12-231-14/+21
| | | | | | | | | | r224667 broke bootstrap on Fedora 20 X86_64 (at least). See pr22006 for the details. r224668 depends on r224667. llvm-svn: 224770
* Fix a bunch of integer template argument problems in template type diffing.Richard Trieu2014-12-201-20/+10
| | | | | | | | | | | | | Reverts most of the changes from r168005. Since template arguments have proper conversions now, no extending of integers is needed. Further, since the integers are the correct size now, use APSInt::operator== instead of APSInt::hasSameValue since operator== will check the size and signness match. Prior to one comparison of APSInt's, check that both are valid. Previous, one could be uninitialized. Also changed APInt to APSInt in GetInt. This occassionally produced a sign flip, which will now be caught by operator==. llvm-svn: 224668
* Fix for PR21758Richard Trieu2014-12-201-1/+4
| | | | | | | | | When a non-type template argument expression needs a conversion to change it into the argument type, preserve that information by remaking the TemplateArgument with an expression that has those conversions. Also a small fix to template type diffing to handle the extra conversions in some cases. llvm-svn: 224667
* Refactor one of the larger functions for Type Diffing into smaller functions.Richard Trieu2014-08-271-185/+215
| | | | | | No functionality change. llvm-svn: 216526
* Change a few methods to static methods. No functionality change.Richard Trieu2014-08-271-12/+15
| | | | llvm-svn: 216519
* Refactor the diagnostic DeclContext printing. No functionality change.Richard Trieu2014-08-271-10/+6
| | | | llvm-svn: 216517
* If a template argument is non-evaluable expression, use the profile ID to seeRichard Trieu2014-07-261-7/+8
| | | | | | if the two arguments are equal. llvm-svn: 214008
* Pass the PrintingPolicy when converting types to strings in template typeRichard Trieu2014-07-251-5/+6
| | | | | | | diffing. This removes extra "struct"/"class" in the type names and gives "bool" instead of "_Bool" for booleans. llvm-svn: 213912
* Print "(default)" for default template template arguments to match theRichard Trieu2014-07-241-0/+1
| | | | | | printing of other types. llvm-svn: 213902
* Add support for nullptr template arguments to template type diffing.Richard Trieu2014-07-241-31/+107
| | | | llvm-svn: 213840
* Fix '&' printing for template arguments in parentheses in template diffing.Richard Trieu2014-07-221-3/+6
| | | | llvm-svn: 213613
* More gracefully handle parentheses in templare arguments in template diffing.Richard Trieu2014-07-221-1/+2
| | | | llvm-svn: 213611
* Fix a template diffing problem were an '&' is unexpectedly printed inRichard Trieu2014-07-221-6/+26
| | | | | | a template argument. llvm-svn: 213609
* PR15677 - Crash in template diffing. Check that expression is evaluatable ↵Nikola Smiljanic2014-07-011-17/+29
| | | | | | before evaluating it. llvm-svn: 212090
* Replace some assert(0)'s with llvm_unreachable.Craig Topper2014-06-181-2/+2
| | | | llvm-svn: 211143
* Use StringRef to simplify code. No functional change.Craig Topper2014-06-121-13/+10
| | | | llvm-svn: 210751
* Use ArrayRef in some function parameters instead of a pointer and count. No ↵Craig Topper2014-06-121-10/+6
| | | | | | functional change. llvm-svn: 210750
* Implement -Wframe-larger-than backend diagnosticAlp Toker2014-06-051-2/+11
| | | | | | | | | | | | | | | | | | Add driver and frontend support for the GCC -Wframe-larger-than=bytes warning. This is the first GCC-compatible backend diagnostic built around LLVM's reporting feature. This commit adds infrastructure to perform reverse lookup from mangled names emitted after LLVM IR generation. We use that to resolve precise locations and originating AST functions, lambdas or block declarations to produce seamless codegen-guided diagnostics. An associated change, StringMap now maintains unique mangled name strings instead of allocating copies. This is a net memory saving in C++ and a small hit for C where we no longer reuse IdentifierInfo storage, pending further optimisation. llvm-svn: 210293
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-13/+14
| | | | llvm-svn: 208517
* Print detailed vector type information on diagnostics.Benjamin Kramer2014-04-251-0/+14
| | | | | | | | | | | | | | | | | | | | | | We never aka vector types because our attributed syntax for it is less comprehensible than the typedefs. This leaves the user in the dark when the typedef isn't named that well. Example: v2s v; v4f w; w = v; The naming in this cases isn't even that bad, but the error we give is useless without looking up the actual typedefs. t.c:6:5: error: assigning to 'v4f' from incompatible type 'v2s' Now: t.c:6:5: error: assigning to 'v4f' (vector of 4 'float' values) from incompatible type 'v2s' (vector of 2 'int' values) We do this for all diagnostics that print a vector type. llvm-svn: 207267
* Normalize line endingsDavid Majnemer2014-03-021-7/+7
| | | | | | | Some files had CRLF line terminators, some only had a mixture of CRLF and LF. Switch to LF. llvm-svn: 202659
* Teach the diagnostics engine about the Attr type to make reporting on ↵Aaron Ballman2013-12-261-0/+9
| | | | | | semantic attributes easier (and not require hard-coded strings). This requires a getSpelling() function on the Attr class, which is table-driven. Updates a handful of cases where a hard-coded string was being used to test the functionality out. Updating associated test cases for the improved quoting. llvm-svn: 198055
* Add an AdjustedType sugar node for adjusting calling conventionsReid Kleckner2013-12-051-0/+5
| | | | | | | | | | | | | | | | Summary: In general, this type node can be used to represent any type adjustment that occurs implicitly without losing type sugar. The immediate use of this is to adjust the calling conventions of member function pointer types without breaking template instantiation. Fixes PR17996. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2332 llvm-svn: 196451
* Remove some unused localsAlp Toker2013-11-261-2/+1
| | | | llvm-svn: 195714