Commit Graph

128 Commits

Author SHA1 Message Date
Owen Voorhees
465bab002f [DiagnosticVerifier] Make Diagnostic Verifier a DiagnosticConsumer subclass
Update DiagnosticVerifier to respect color flags

Improve DiagnosticVerifier test coverage

verifier updates to support new llvm stable branch
2020-03-28 12:29:53 -07:00
Owen Voorhees
768c4385cf [DiagnosticVerifier] More accurate wording when printing diagnostics from external sources 2020-03-21 15:11:46 -07:00
omochimetaru
3ccec26390 [Diagnostics] Fix range of fix-its in verify mode 2020-03-19 18:47:57 +09:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Martin Boehme
f81ef9cf1e Prepend "diagnostic produced by Clang:" to Clang diagnostics. 2020-03-02 14:56:42 +01:00
Martin Boehme
45503abcdf Move struct Result directly above verifyFile(). 2020-03-02 14:56:42 +01:00
Martin Boehme
c164fca37b If -verify mode saw unexpected diagnostics, print diagnostics from all files.
As an example of how this is useful, consider the case where
ClangImporter fails with

  "unexpected error produced: could not build C module 'ctypes'"

It would be useful to know what the underlying Clang error was that
caused building the module to fail, but so far, `-verify` mode would not
output that; to get the error, it would be necessary to run the compiler
invocation again without `-verify`.

This change causes any remaining diagnostics that weren't in the input file
to be output if there were unexpected diagnostics in `-verify` mode.

I haven't added any tests for this because I didn't find a place that
contains tests for the `-verify` functionality itself (as opposed to
tests that use `-verify` mode). I think the large number of tests that
run with `-verify` should at least ensure, however, that this change
does not regress anything.
2020-03-02 14:56:42 +01:00
Owen Voorhees
0a239d568a Update diag_deprecated_string_interpolation to use column offsets in -verify mode instead of FileCheck 2019-09-03 11:09:36 -07:00
Owen Voorhees
3a2547ce0c [Diagnostics][NFC] Allow column specification in -verify mode
To check the column a diagnostic is emitted at, use
expected-error@+x:y, or expected-error@:y to specify
a column without a line offset
2019-08-29 20:11:55 -07:00
Harlan Haskins
42e1c2f07a [test] Add expected-remark to DiagnosticVerifier 2019-05-01 18:22:43 -07:00
Jordan Rose
f6c7973911 Teach -verify-apply-fixes to handle overlapping fix-its (#23970)
...by coalescing duplicates and dropping conflicts. Both cases can
happen with "expected-error 2 {{...}}": we might get multiple fix-its
providing the same new message, or one message might have diverged
into two, giving us incompatible changes.
2019-04-12 13:19:54 -07:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
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
2018-12-04 15:45:04 -08:00
Jordan Rose
501c1fd31b Replace std::ofstream with llvm::raw_fd_ostream in -verify-apply-fixes (#15133)
This isn't a user-facing feature, but why bother using std::ofstream?
2018-03-10 16:57:41 -08:00
Doug Gregor
29150045f9 Handle DK_Remark 2017-10-13 11:30:52 -07:00
Huon Wilson
a9299802bb Factor out first = true; ... if (first) first = false; else ....
There's an `interleave` function for this: let's use it.
2017-03-10 15:44:12 -08:00
Rintaro Ishizaki
384ab780e9 [Diagnostic verifier] Make '<unknown>' check optional
Added frontend option '-verify-ignore-unknown'
2017-02-02 10:49:32 +09:00
Rintaro Ishizaki
827c6e7c3d [Diagnostic verifier] Diagnostics at '<unknown>:0' are unexpected 2017-02-02 10:48:54 +09:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
Hugh Bellamy
4779659f39 Fix warnings building swift/Frontend on Windows using MSVC 2016-12-02 12:50:39 +00:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Jordan Rose
5746671a19 Add -verify-apply-fixes to accompany -verify.
Enables Chris's auto-apply-fixes mode for -verify: if an expected-*
annotation has the wrong message, or if the expected fix-its are
incorrect, this option will **edit the original file** to update them.

This is a tool for compiler developers only; it doesn't affect
normal diagnostic printing or normal fix-its.
2016-09-15 10:38:43 -07:00
Doug Gregor
70f3290252 [Diagnostic verify] Treat "{{none}}" as "no unexpected Fix-Its".
We were using "{{none}}" to mean "no Fix-Its" at all in the diagnostic
verifier, which is useful but narrow. Tweak it's meaning to mean "no
Fix-Its other than the ones we've explicitly checked for", which lets
us verify the exact set of Fix-Its produced as part of a diagnostic
rather than only matching a subset. I'll be landing some tests that
rely on this shortly.
2016-05-26 23:19:11 -07:00
Jordan Rose
0788bf5f5c Revert accidental commit.
...enabling Chris's nifty fix-it updater tool. Now that I've done
it too, maybe I'll put in a frontend flag for it after all.
2016-05-04 14:20:29 -07:00
Jordan Rose
894318cfe0 Allow instance member syntax in @available(renamed:).
Example:

    @available(*, unavailable, renamed: "Sequence.enumerated(self:)")
    func enumerate<Seq: SequenceType>(_ sequence: Seq) ->
        EnumerateSequence<Seq>

This will allow us to reuse this logic to suggest fixes for APIs
turned into members by NS_SWIFT_NAME.
2016-05-04 14:17:15 -07:00
Chris Lattner
860139c09c fix a logic error in the diagnostic verifier: if a fixit was expected but not
produced we'd emit two error messages.  The first complained about the diagnostic
text being wrong and the second complained about the fixit being wrong.

That first one is incorrect to emit and super confusing.  No testcase, since this
only affects -verify mode used by the testsuite.
2016-04-15 14:15:39 -07:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
db13bcb22e Fix typos. 2015-12-26 14:11:42 +01:00
gregomni
db44bf7d69 Add support in the diagnostic verifier for verifying no fix-its
Checked what it would look like to verify fix-its in every case, and
currently the tests are missing expected fix-its in 435 diagnoses in 60
test files.

So as an alternative, added support for a no fix-its marker “{{none}}”, and
added that marker to the c-style for deprecation tests where it applies.
2015-12-22 13:33:39 -08:00
Chris Lattner
f0aa5aa704 revert unintended change.
Swift SVN r32005
2015-09-16 20:17:55 +00:00
Chris Lattner
92fc60f619 fix rdar://22387625 QoI: Common errors: 'let x= 5' and 'let x =5' could use Fix-its
Swift SVN r32004
2015-09-16 20:12:14 +00:00
Chris Lattner
1439bba142 move the special case closure diagnostics to CSDiag out of TypeCheckPattern,
since the logic is specific to it and about to get more-so. NFC.


Swift SVN r31719
2015-09-05 22:13:49 +00:00
Chris Lattner
44b35a85f8 remove a bunch more Failure conditions that CSDiags ignores.
Swift SVN r31718
2015-09-05 21:53:08 +00:00
Chris Lattner
7ad6eaad07 the previous patch improved 22308291 enough to consider it done.
Swift SVN r31697
2015-09-04 22:35:42 +00:00
Chris Lattner
34ae9bb9b6 Fix <rdar://problem/22584076> QoI: Using array literal init with dictionary produces bogus error
This includes a few changes:
 - Enhance diagnoseGeneralConversionFailure to not ignore constraints that are fully solved by
   CSDiags' heuristics.
 - Enhance dictionary/array literals diagnostics to handle non-compliance to their literal 
   protocols with a specific and custom error message.
 - Add specific QoI for turning accidental use of array literals in dictionary context into
   the right dictionary syntax (with a fixit).


Swift SVN r31696
2015-09-04 22:31:21 +00:00
Chris Lattner
eb0131f927 refactor all of the constraint system "Fix" processing logic out of
ConstraintSystem::applySolution into its own helper function to reduce
indentation and make ConstraintSystem::applySolution much more simple
and obvious.  NFC.


Swift SVN r31290
2015-08-18 04:47:34 +00:00
Chris Lattner
1ad24fdfc2 rework how 'as' casts are diagnosed, removing a special case from CSApply and
allowing these failures to hook into other diagnostic goodies (e.g. the
"did you mean to use '!' or '?'?" cases showing in the testsuite).  That said,
by itself this doesn't have a huge impact, but avoids regressions with other
pending changes.


Swift SVN r31289
2015-08-18 04:35:41 +00:00
Chris Lattner
b889fb400d every time I commit this I get closer to doing something about it...
Swift SVN r31265
2015-08-17 16:46:04 +00:00
Chris Lattner
6c3976061c If a contextual type is available when type checking collection literals, use it to
produce specific diagnostics about individual elements being incorrect instead of
complaining about the whole thing in aggregate.

This improves diagnostics immediately, but is also important to unblock future progress.



Swift SVN r31264
2015-08-17 16:41:55 +00:00
Chris Lattner
7f7b78e051 Fix <rdar://problem/22263468> QoI: Not producing specific argument conversion diagnostic for tuple init
Swift SVN r31211
2015-08-13 06:05:03 +00:00
Chris Lattner
616dbb2a5e fix <rdar://problem/22255907> QoI: bad diagnostic if spurious & in argument list
Swift SVN r31206
2015-08-13 05:22:20 +00:00
Chris Lattner
83d6cfcb30 Yet again, didn't mean to check this in...
Swift SVN r31131
2015-08-11 06:06:26 +00:00
Chris Lattner
4b96cba12b Fix <rdar://problem/22143680> QoI: terrible diagnostic when trying to form a generic protocol
Swift SVN r31108
2015-08-10 16:50:45 +00:00
Chris Lattner
92feced290 add some code that causes -verify to error when a fixit was generated, but
not specified in a testcase.  Currently disabled, pending discussion.


Swift SVN r30990
2015-08-04 17:32:55 +00:00
Chris Lattner
7e3146025d fix an off-by-two in the previous patch.
Swift SVN r30983
2015-08-04 05:28:09 +00:00
Chris Lattner
738ccaf054 teach -verify mode to automatically update incorrect fixit requirements when
autoApplyFixes is enabled, because, well, we can.  NFC since noone uses this.



Swift SVN r30982
2015-08-04 05:25:23 +00:00
Chris Lattner
799c366451 Fix some issues where replacing multiple sequential diagnostics
could lead to an "overlapping diagnostics" assertion because
two fixits were zapping whitespace.  NFC, since noone except me
uses this.


Swift SVN r30929
2015-08-02 05:42:17 +00:00
Chris Lattner
5deadfb6e4 didn't mean to comit this...
Swift SVN r30918
2015-08-01 17:37:09 +00:00
Chris Lattner
bdaf954982 when recursively type checking an expression with its contextual type and
other constraints intentionally ripped off, tell the recursive solution that
we can tolerate an ambiguous result.  The point of this walk is not to
produce a concrete type for the subexpression, it is to expose any structural
errors within that subsystem that don't depend on the contextual constraints.


Swift SVN r30917
2015-08-01 17:31:49 +00:00