summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTDiagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Fix an edge case in the template differ with default arguments.Benjamin Kramer2013-10-081-5/+10
| | | | | | | | In the test case one type is coming from a typedef with no default arg, the other has the default arg. Taking the default arg from the typedef crashes, so always use the real template paramter declaration. PR17510. llvm-svn: 192202
* If a default argument is a dependent type, get the real type from the desugaredRichard Trieu2013-07-201-3/+7
| | | | | | | template. Passing around dependent types can lead to integral arguments that cannot be evaluated. llvm-svn: 186757
* Use SmallVectorImpl::reverse_iterator instead of SmallVector to avoid ↵Craig Topper2013-07-081-1/+1
| | | | | | specifying the vector size. llvm-svn: 185784
* Use SmallVectorImpl& for function arguments instead of SmallVector.Craig Topper2013-07-051-1/+1
| | | | llvm-svn: 185715
* Provide operator<< for stream output of DeclarationNamesDavid Blaikie2013-05-141-2/+1
| | | | | | | | | | | ASTDumper was already trying to do this & instead got an implicit bool conversion by surprise (thus printing out 0 or 1 instead of the name of the declaration). To avoid that issue & simplify call sites, simply make it the normal/expected operator<<(raw_ostream&, ...) overload & simplify all the existing call sites. (bonus: this function doesn't need to be a member or friend, it's just using public API in DeclarationName) llvm-svn: 181832
* Fix crash on invalid in template type diffing.Richard Trieu2013-05-071-10/+41
| | | | | | | | | This is a fix for PR15895, where Clang will crash when trying to print a template diff and the template uses an address of operator. This resulted from expecting a DeclRefExpr when the Expr could have also been UnaryOperator->DeclRefExpr. llvm-svn: 181365
* Refactor the Get* functions to be more consistant among themselves.Richard Trieu2013-04-031-22/+23
| | | | llvm-svn: 178613
* Do not assume the template argument is an integer only because theRichard Trieu2013-04-031-2/+1
| | | | | | | | | | expressions are integer. It can also be ValueDecl expressions Use the type information from the TemplateParameterList instead Patch by Olivier Goffart! llvm-svn: 178611
* Fix a crasher in Template Diffing.Richard Trieu2013-04-031-1/+2
| | | | | | | | | | When support was added for declaration arguments, the case of variadic declaration arguments was not supported. This patch fixes that problem by not crashing when certain ValueDecl's are null. Patch by Olivier Goffart! llvm-svn: 178610
* Fix a crasher in Template Diffing.Richard Trieu2013-04-031-51/+47
| | | | | | | | | | | | Value depenedent expressions for default arguments cannot be evaluated. Instead, use the desugared template type to get an argument expression that can be used. This is needed for both integer and declaration arguements. Also, move this common code into a separate function. Patch by Olivier Goffart! llvm-svn: 178609
* Strip off local qualifiers when converting from RecordType toRichard Trieu2013-03-231-1/+1
| | | | | | | TemplateSpecializationType during template type diffing. This allows the correct printing of diffing qualifiers on templates. llvm-svn: 177809
* Improve template diffing handling of default integer values.Richard Trieu2013-03-151-22/+113
| | | | | | | | | | When the template argument is both default and value dependent, the expression retrieved for the default argument cannot be evaluated, thus never matching any argument value. To get the proper value, get the template argument from the desugared template specialization. Also, output the original expression to provide more information about the argument mismatch. llvm-svn: 177209
* Remove unnecessary default in covered switch over enumDavid Blaikie2013-03-151-1/+0
| | | | | | This cleans up the Clang -Werror build that was broken by r177180. llvm-svn: 177184
* Refactor template diffing to store an enum that records which type ofRichard Trieu2013-03-151-89/+88
| | | | | | | difference is stored inside a DiffNode. This should not change any diagnostic messages. llvm-svn: 177180
* [PR15513/<rdar://problem/13409707>] Template arguments in diagnostics aren't ↵Douglas Gregor2013-03-141-1/+1
| | | | | | always known at compile time. llvm-svn: 177110
* Update template diffing to handle template arguments that are declarations.Richard Trieu2013-02-271-4/+91
| | | | llvm-svn: 176153
* Use raw_ostream::indent, update comment.Benjamin Kramer2013-02-221-4/+3
| | | | llvm-svn: 175897
* Push the raw_ostream through the template diffing code.Benjamin Kramer2013-02-221-17/+11
| | | | llvm-svn: 175896
* Streamify FormatASTNodeDiagnosticArgument.Benjamin Kramer2013-02-221-35/+33
| | | | llvm-svn: 175895
* Streamify getNameForDiagnostic and remove the string versions of ↵Benjamin Kramer2013-02-221-2/+6
| | | | | | PrintTemplateArgumentList. llvm-svn: 175894
* Remove commented out code.Richard Trieu2013-02-211-1/+1
| | | | llvm-svn: 175699
* When comparing two template template arguments in the template differ, considerRichard Trieu2013-01-311-5/+14
| | | | | | | | | | | them the same if they are actually the same; having the same name isn't enough. Similar to r174013, template template arguments were also mistakenly considered the same when they had the same name but were in different namespaces. In addition, when printing template template arguments, use the qualified name if the regular name is the same. llvm-svn: 174029
* When comparing two templates in the template differ, consider them theDouglas Gregor2013-01-311-2/+2
| | | | | | | same if they are actually the same; having the same name isn't enough. Fixes <rdar://problem/12931988>. llvm-svn: 174013
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-2/+2
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Use a safe default width for template-diff'ing integral arguments, inDouglas Gregor2012-12-211-1/+1
| | | | | | | case we can't find an exact width to use. Fixes crash in <rdar://problem/12456626>. llvm-svn: 170951
* Fix another uninitialized bool member bug found by -fsanitize=bool. This oneRichard Smith2012-12-201-0/+1
| | | | | | | appears to currently be benign (we happen to test the flags in the right order, so we never depend on the uninitialized value). llvm-svn: 170640
* Fix a crash in diagnostic printing when a template class type is diff'edEli Friedman2012-12-181-1/+6
| | | | | | against itself. PR14489. llvm-svn: 170474
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+2
| | | | | | | | | | | | | 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
* Make template diffing handle integral expressions of various widths correctly.Eli Friedman2012-11-141-4/+17
| | | | | | PR14342. llvm-svn: 168005
* Fix the template type diffing to handle integral template arguments.Richard Trieu2012-11-011-6/+102
| | | | llvm-svn: 167252
* Update template type diffing to handle qualifiers. Differing qualifiers willRichard Trieu2012-09-281-0/+103
| | | | | | now be printed with highlighting. llvm-svn: 164843
* Clean up part of template type diffing. Moved repeated code to separateRichard Trieu2012-09-281-32/+30
| | | | | | functions. Reworked one of the conditionals. No functional changes. llvm-svn: 164839
* Fix the AST representation for non-type template arguments to encodeEli Friedman2012-09-261-1/+3
| | | | | | | | | | | | enough information so we can mangle them correctly in cases involving dependent parameter types. (This specifically impacts cases involving null pointers and cases involving parameters of reference type.) Fix the mangler to use this information instead of trying to scavenge it out of the parameter declaration. <rdar://problem/12296776>. llvm-svn: 164656
* Store SourceManager pointer on PrintingPolicy in the case where we're dumping,Richard Smith2012-08-161-1/+1
| | | | | | | | | and remove ASTContext reference (which was frequently bound to a dereferenced null pointer) from the recursive lump of printPretty functions. In so doing, fix (at least) one case where we intended to use the 'dump' mode, but that failed because a null ASTContext reference had been passed in. llvm-svn: 162011
* Properly update the FormattedArgs vector when the template type diffing fallsRichard Trieu2012-07-101-1/+2
| | | | | | back to regular type printing. llvm-svn: 159976
* Remove spurious semicolons committed in r159216.David Blaikie2012-06-261-2/+2
| | | | llvm-svn: 159218
* Add template type diffing to Clang. This feature will provide a betterRichard Trieu2012-06-261-0/+933
| | | | | | | | | | | | comparison between two templated types when they both appear in a diagnostic. Type elision will remove indentical template arguments, which can be disabled with -fno-elide-type. Cyan highlighting is applied to the differing types. For more formatting, -fdiagnostic-show-template-tree will output the template type as an indented text tree, with differences appearing inline. Template tree works with or without type elision. llvm-svn: 159216
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-1/+1
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Support for raw and template forms of numeric user-defined literals,Richard Smith2012-03-091-0/+2
| | | | | | and lots of tidying up. llvm-svn: 152392
OpenPOWER on IntegriCloud