summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/TextDiagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing spaceFangrui Song2018-07-301-14/+14
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-17/+17
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 331834
* PR37189 Fix incorrect end source location and spelling for a split '>>' token.Richard Smith2018-04-301-22/+16
| | | | | | | | | | | | | | | | | | 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). llvm-svn: 331155
* [clang] buildFixItInsertionLine should use Hints of the same FID and LineNoChih-Hung Hsieh2017-07-121-6/+5
| | | | | | | | Fix bug https://bugs.llvm.org/show_bug.cgi?id=33734 Differential Revision: https://reviews.llvm.org/D35230 llvm-svn: 307809
* Revert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""Christof Douma2017-06-271-48/+37
| | | | | | | | | | | | | | | | | | | | | | This reverts commit r305688 meaning it reintroduces r305684. To repeat: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. This breaks clang-tidy and clng-query which will be fixed in a commit soon after. Patch by Sanne Wouda Differential Revision: https://reviews.llvm.org/D31709 llvm-svn: 306384
* Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"Christof Douma2017-06-191-37/+48
| | | | | | | This reverts commit 305684. This patch breaks extra/tools/clang-tidy llvm-svn: 305688
* [NFC] Refactor DiagnosticRenderer to use FullSourceLocChristof Douma2017-06-191-48/+37
| | | | | | | | | | | | | | | | Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. Patch by Sanne Wouda Review: https://reviews.llvm.org/D31709 Change-Id: If351a112cdf6718e2d3ef6721b8da9c6376b32dd llvm-svn: 305684
* Make helper functions static. NFC.Benjamin Kramer2017-05-261-3/+3
| | | | llvm-svn: 304028
* [Frontend] Don't index into an empty string.Benjamin Kramer2017-05-231-1/+1
| | | | | | Found by msan! llvm-svn: 303686
* Add option to include multiple lines in snippets.Richard Smith2017-05-221-86/+156
| | | | | | | | | | | | When a diagnostic includes a highlighted range spanning multiple lines, clang now supports printing out multiple lines of context if necessary to show the highlighted ranges. This is not yet exposed in the driver, but can be enabled by "-Xclang -fcaret-diagnostics-max-lines -Xclang N". This is experimental until we can find out whether it works well in practice, and if so, what a good default for the maximum number of lines is. llvm-svn: 303589
* Move UTF functions into namespace llvm.Justin Lebar2016-09-301-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This lets people link against LLVM and their own version of the UTF library. I determined this only affects llvm, clang, lld, and lldb by running $ git grep -wl 'UTF[0-9]\+\|\bConvertUTF\bisLegalUTF\|getNumBytesFor' | cut -f 1 -d '/' | sort | uniq clang lld lldb llvm Tested with ninja lldb ninja check-clang check-llvm check-lld (ninja check-lldb doesn't complete for me with or without this patch.) Reviewers: rnk Subscribers: klimek, beanz, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D24996 llvm-svn: 282822
* Add support for -fdiagnostics-absolute-paths: printing absolute paths in ↵Hans Wennborg2016-08-261-2/+19
| | | | | | | | diagnostics Differential Revision: https://reviews.llvm.org/D23816 llvm-svn: 279827
* [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
* Fix use of uninitialized value exposed by r267802. Accessors of an invalidRichard Smith2016-04-281-3/+3
| | | | | | PresumedLoc should not be called. llvm-svn: 267914
* clang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting.Nico Weber2016-03-231-1/+9
| | | | | | | | | | | Remove tests that have neither a triple nor an explicit -fmsc-version flag, since in the absence of an -fmsc-version flag, the implicit value of the flag is 17 (MSVC2013) with MSVC triples but 0 (not set) for other triples, and the default triple is platform dependent. This relands r263974 with a test fix. llvm-svn: 264210
* Revert r263974, "clang-cl: With -fmsc-version=1900, use MSVS2015 diag ↵NAKAMURA Takumi2016-03-211-9/+1
| | | | | | | | formatting." It seems the test wouldn't expect if default target is *-win32. llvm-svn: 264007
* clang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting.Nico Weber2016-03-211-1/+9
| | | | llvm-svn: 263974
* Don't crash w/ a diagnostic range containing a null byteDavid Majnemer2016-02-171-3/+11
| | | | | | | | We prematurely ended the line at the null byte which caused us to crash down stream because we tried to reason about columns beyond the end of the line. llvm-svn: 261171
* 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 llvm-svn: 250827
* 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 llvm-svn: 250822
* Replace double negation of !FileID.isInvalid() with FileID.isValid().Yaron Keren2015-10-031-1/+1
| | | | | | +couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228. llvm-svn: 249235
* Replace double-negated !SourceLocation.isInvalid() with ↵Yaron Keren2015-10-031-1/+1
| | | | | | SourceLocation.isValid(). llvm-svn: 249228
* [modules] Properly diagnose errors in module files for which we have noRichard Smith2015-08-111-3/+3
| | | | | | corresponding include location (those specified on the command line). llvm-svn: 244538
* Give isCompatibleWithMSVC a better interfaceDavid Majnemer2015-05-111-1/+1
| | | | | | | We now use an enum which maps the marketing name (almost always a year) to the major version number. llvm-svn: 236967
* The prefix 'Ms-' should be 'MS-'David Majnemer2015-02-021-3/+3
| | | | | | | Clang is otherwise consistent that Microsoft be abbreviated as MS, not Ms. llvm-svn: 227842
* Frontend: Fix SourceColumnMap assertion failure on non-ascii characters.Logan Chien2015-01-081-9/+11
| | | | | | | | | | | | | | | | | | | | If there are some non-ascii character in the input source code, the column index might be smallar than the byte index. This will result in two possible assertion failures. This CL fixes the computation of the column index and byte index. 1. The assertion in startOfNextColumn() and startOfPreviousColumn() should not be raised when the byte index is greater than the column index since the non-ascii characters may use more than one bytes to store a character in a column. 2. The length of the caret line should be equal to the number of columns of source line, instead of the length of the source line. Otherwise, the assertion in selectInterestingSourceRegion will be raised because the removed columns plus the kept columns are not greater than the max column, which means that we should not remove any column at all. llvm-svn: 225442
* Frontend: Fix typo in comments.Logan Chien2014-12-201-2/+2
| | | | llvm-svn: 224680
* Driver: bifurcate extended and basic MSC versioningSaleem Abdulrasool2014-07-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | This restores the original behaviour of -fmsc-version. The older option remains as a mechanism for specifying the basic version information. A secondary option, -fms-compatibility-version permits the user to specify an extended version to the driver. The new version takes the value as a dot-separated value rather than the major * 100 + minor format that -fmsc-version format. This makes it easier to specify the value as well as a more flexible manner for specifying the value. Specifying both values is considered an error. The older parameter is left solely as a driver option, which is normalised into the newer parameter. This allows us to retain a single code path in the compiler itself whilst preserving the semantics of the old parameter as well as avoid having to determine which of two formats are being used by the invocation. The test changes are due to the fact that the compiler no longer supports the old option, and is a direct conversion to the new option. llvm-svn: 213119
* Track IntrusiveRefCntPtr::get() changes from LLVM r212366Alp Toker2014-07-051-1/+1
| | | | llvm-svn: 212369
* DiagnosticRenderer: emit basic notes as real diagnosticsAlp Toker2014-06-211-6/+0
| | | | | | | Fixes terminal column wrapping and vestigial 'note:' prefixes that would appear when using emitBasicNote(). llvm-svn: 211448
* TextDiagnostic: print remark level diagnostics in bold tooAlp Toker2014-06-211-19/+14
| | | | | | | | | | | The purpose of bolding these is to make them visually distinct from continuations (supplemental note diagnostics). Therefore, the bolding applies to all severities _including_ remarks -- it's not in any way an indicator of priority. Also simplify and comment. No tests. llvm-svn: 211447
* Driver: enhance MSC version compatibilitySaleem Abdulrasool2014-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The version information for Visual Studio is spread over multiple variables. The newer Windows SDK has started making use of some of the extended versioning variables that were previously undefined. Enhance our compatibility definitions for these cases. _MSC_VER is defined to be the Major * 100 + Minor. _MSC_FULL_VER is defined to be Major * 10000000 + Minor * 100000 + Build. And _MSC_BUILD is the build revision of the compiler. Extend the -fmsc-version option in a compatible manner. If the value is the previous form of MMmm, then we assume that the build number is 0. Otherwise, a specific build number may be passed by using the form MMmmbbbbb. Due to bitwidth limitations of the option, it is currently not possible to define a revision value. The version information can be passed as either the decimal encoded value (_MSC_FULL_VER or _MSC_VER) or as a dot-delimited value. The change to the TextDiagnostic is to deal with the updated encoding of the version information. llvm-svn: 211420
* The Visual Studio IDE changed behavior in VS2012. It used to be the case thatYunzhong Gao2014-03-071-1/+3
| | | | | | | | | | | | | | | | the clang diagnostic has to report a column number one less than the correct value in order for the IDE to move the cursor to the expected location. This behavior is changed in VS2012 and VS2013 so that the IDE is now expecting the column number to match the actual source location. Before: source(line, column-1): type: message After: source(line, column): type: message This patch changes -fdiagnostics-format=msvc to match the new VS2012 and VS2013 when fmsc-version is 1700 or greater. Differential Revision: http://llvm-reviews.chandlerc.com/D2949 llvm-svn: 203183
* [C++11] Replace verbose functors with succinct lambdasBenjamin Kramer2014-03-011-9/+1
| | | | | | No functionality change. llvm-svn: 202590
* Add 'remark' diagnostic type in 'clang'Tobias Grosser2014-02-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | A 'remark' is information that is not an error or a warning, but rather some additional information provided to the user. In contrast to a 'note' a 'remark' is an independent diagnostic, whereas a 'note' always depends on another diagnostic. A typical use case for remark nodes is information provided to the user, e.g. information provided by the vectorizer about loops that have been vectorized. This patch provides the initial implementation of 'remarks'. It includes the actual definiton of the remark nodes, their printing as well as basic parameter handling. We are reusing the existing diagnostic parameters which means a remark can be enabled with normal '-Wdiagnostic-name' flags and can be upgraded to an error using '-Werror=diagnostic-name'. '-Werror' alone does not upgrade remarks. This patch is by intention minimal in terms of parameter handling. More experience and more discussions will most likely lead to further enhancements in the parameter handling. llvm-svn: 202475
* Split FileEntry name vs. isValidBen Langmuir2014-02-271-1/+1
| | | | | | | This is a small bit of refactoring in preparation for FileEntry owning the storage for its own name. llvm-svn: 202412
* clang-cl: print diagnostics as "error(clang): foo" in /fallback modeHans Wennborg2013-09-241-6/+17
| | | | | | | | | | | | | | | This solves two problems: 1) MSBuild will not flag the build as unsuccessful just because we print an error in the output, since "error(clang):" doesn't seem to match the regex it's using. 2) It becomes more clear that the diagnostic is coming from clang as supposed to cl.exe. Differential Revision: http://llvm-reviews.chandlerc.com/D1735 llvm-svn: 191250
* Use llvm::sys::fs::UniqueID for windows and unix.Rafael Espindola2013-08-011-4/+1
| | | | | | | | | | | | | | | | | | | This unifies the unix and windows versions of FileManager::UniqueDirContainer and FileManager::UniqueFileContainer by using UniqueID. We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we want to be able to construct fake ones, and file_status has different members on unix and windows. What the patch does is: * Record only the information that clang is actually using. * Use llvm::sys::fs::status instead of stat and fstat. * Use llvm::sys::fs::UniqueID * Delete the old windows versions of UniqueDirContainer and UniqueFileContainer since the "unix" one now works on windows too. llvm-svn: 187619
* Handle Unicode characters in fix-it replacement strings.Jordan Rose2013-06-071-19/+17
| | | | | | Patch by Sukolsak Sakshuwong! llvm-svn: 183535
* Make compares unsigned. The expression can't become negative anyways.Benjamin Kramer2013-04-231-2/+2
| | | | | | Silences a sign compare warning on 32 bit archs. llvm-svn: 180110
* Fix buffer underrun (invalid read) triggered during diagnostic rendering. ↵Ted Kremenek2013-03-151-1/+1
| | | | | | | | | | | | | The test would overflow when computing '0 - 1'. I don't have a good testcase for this that does not depend on system headers. It did not trigger with preprocessed output, and I had trouble reducing the example. Fixes <rdar://problem/13324594>. Thanks to Michael Greiner for reporting this issue. llvm-svn: 177201
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-15/+12
| | | | | | | 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
* TextDiagnostic.cpp: Suppress a warning to use ptrdiff_t on i686-clang. ↵NAKAMURA Takumi2013-02-051-1/+1
| | | | | | [-Wsign-compare] llvm-svn: 174353
* Diagnostics: Clarify name of line-length-limiting constant in r173976.Jordan Rose2013-01-301-3/+3
| | | | | | Thanks, Sean. llvm-svn: 173981
* Diagnostics: if a line is longer than 4096 characters, don't print it.Jordan Rose2013-01-301-1/+9
| | | | | | | | | | | | | Specifically, don't print snippets, caret diagnostics, or ranges for lines over 4096 characters. We copy the line around a few times in our diagnostics machinery, and we have to print a caret line that's just as long. This uses a lot of memory just to create a poor user experience as we print out a line much too long for anyone to read...or spend extra energy trying to fit it to -fmessage-length. <rdar://problem/13106850> llvm-svn: 173976
* Move UTF conversion routines from clang/lib/Basic to llvm/lib/SupportDmitri Gribenko2013-01-301-1/+1
| | | | | | This is required to use them in TableGen. llvm-svn: 173924
* Be defensive when printing module import locations; the diagnostic printer ↵Douglas Gregor2012-12-181-1/+1
| | | | | | needs to be robust llvm-svn: 170466
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-6/+6
| | | | | | | | | | | | | 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 helper classes anonymous. Make helper functions static instead of ↵Benjamin Kramer2012-12-011-155/+156
| | | | | | | | private members so the anonymous class doesn't leak out. No functionality change. llvm-svn: 169099
* When we're emitting a diagnostic with a source location in an importedDouglas Gregor2012-11-301-0/+10
| | | | | | | | | | | | | | module, provide a module import stack similar to what we would get for an include stack, e.g., In module 'DependsOnModule' imported from build-fail-notes.m:4: In module 'Module' imported from DependsOnModule.framework/Headers/DependsOnModule.h:1: Inputs/Module.framework/Headers/Module.h:15:12: note: previous definition is here @interface Module <rdar://problem/12696425> llvm-svn: 169042
OpenPOWER on IntegriCloud