Commit Graph

20 Commits

Author SHA1 Message Date
Varun Gandhi
58304137d4 Adds an expected-error test characterizing the issue in SR-9482. 2019-07-15 13:36:38 -07:00
Saleem Abdulrasool
09bc471e87 test: add a test for ll suffixed types being promoted to ULL
This addresses the follow up test case discussed in PR23651.  Windows
will not promote a macro literal suffixed with `ll` or `i64` to an
unsigned long long even upon an overflow.  This tests that the corner
case behaviour for importing a long long literal matches the platform
expectations.
2019-04-01 10:55:57 -07:00
Saleem Abdulrasool
8a1457c431 test: explicitly make a value unsigned on Windows
Windows will keep the imported type as `signed long long` rather than
`unsigned long long` as per the Microsoft compiler behaviour.  This
breaks the tests for this case.  Unfortunately, this is one of those
areas which must differ.
2019-03-29 16:18:09 -07:00
Jordan Rose
413e7db918 [ClangImporter] Handle diagnostics about cast types in macros
The importer handles these by first trying to look up the type by name
using Clang's Sema, but that lookup can cause diagnostics to be
emitted (usually availability diagnostics). We could try to figure out
how to propagate that to the macro when we import it, but for now just
drop the macro instead if there are any diagnostics emitted when
looking up the type.

This will be a small source compatibility break if anyone was using a
macro defined in terms of a type that's deprecated or that has partial
availability; the macro will now silently not be imported instead of
producing an unsilenceable warning.

rdar://problem/36528212
2018-01-16 13:44:22 -08:00
Jordan Rose
5edbefcc69 [ClangImporter] Break circularity when importing macros (#13099)
Rather than being smart about this, just record an import failure when
we start importing a particular macro and update it at the end. Also
add a PrettyStackTrace to make this a little easier to track down in
the future.

The old logic for importing macros that just aliased other macros
managed to handle this in a clever way, but that was never tested for
the newer logic that evaluates expressions (fa834e2f80). Macro
importing in general probably deserves some cleanup, but meanwhile we
should make sure not to crash!

rdar://problem/34986930
2017-12-01 11:42:49 -08:00
SpringsUp
fa834e2f80 [ClangImporter] Teach the importer about more infix operators between
integer constants, and to always look through macro definitions for them.

Also, logical comparisons now return a Boolean.

New operations: +, -, *, /, ^, >>, ==, >, >=, <, <=
2017-01-23 21:02:47 +01:00
Chris Willmore
6d428b8d52 ClangImporter: Import macros of the form '#define FOO CFSTR("bar")'.
rdar://problem/18668528

Swift SVN r23544
2014-11-22 02:33:27 +00:00
Jordan Rose
eb3689051e [ClangImporter] Ban useless macro CF_USE_OSBYTEORDER_H.
rdar://problem/18966078

Swift SVN r23395
2014-11-18 01:55:30 +00:00
Jordan Rose
54c0baa9aa [ClangImporter] Don't recurse infinitely on "#define X X".
<rdar://problem/17182523>

Swift SVN r18772
2014-06-10 01:18:29 +00:00
Jordan Rose
171fc95d27 [ClangImporter] Suppress macros named TRUE and FALSE.
These are too close to "true" and "false" for comfort; they add confusion and
mess up code completion. If the names appear in other contexts, though (such
as enumerator names), we should still bring them through.

<rdar://problem/17080279>

Swift SVN r18670
2014-05-30 18:39:39 +00:00
Jordan Rose
11947c4e86 [test] Change UTF-16 test to not mention the language name.
Just in case. I changed the emoji for "Swift" too, just for Joe.

Swift SVN r17985
2014-05-13 00:48:04 +00:00
Jordan Rose
829d3e6de9 [ClangImporter] Handle macros that use bitshifts, like "(1 << 0)".
<rdar://problem/16202229>

Swift SVN r17462
2014-05-05 17:37:03 +00:00
Jordan Rose
ac15f949d2 [ClangImporter] Import macros that use ~.
This and the previous commit cover <rdar://problem/16521124>.

Swift SVN r17461
2014-05-05 17:37:02 +00:00
Jordan Rose
9e61c4bb62 [ClangImporter] Import NULL, nil, Nil, and ((void*)0) as Swift.nil.
Also, look through one layer of parentheses in general for macros, rather
than special-casing it for each token count.

<rdar://problem/16198517>

Swift SVN r17460
2014-05-05 17:37:00 +00:00
Ted Kremenek
656fd1a2ee Add blacklist for imported macros, which can be extended over time.
Implements:

<rdar://problem/16454306> NS_BLOCKS_AVAILABLE probably should not be imported since by default it's true

Swift SVN r16067
2014-04-08 19:26:17 +00:00
Dmitri Hrybenko
2c96263f02 Clang importer: when importing a macro A that resolves to another macro B, put
the imported macro into the module that owns A, not B

rdar://16449405


Swift SVN r15675
2014-03-31 12:11:19 +00:00
Dmitri Hrybenko
a422886e6f Clang importer: add a workaround so that we don't import literals with ud-suffix
Workaround for rdar://16445608


Swift SVN r15559
2014-03-27 17:59:19 +00:00
Jordan Rose
3d313fb3f0 [ClangImporter] Import macros containing a single NSString literal as String.
Bonus goodness related to the previous commit.

Swift SVN r14665
2014-03-05 00:29:44 +00:00
Jordan Rose
a84f939545 [ClangImporter] Import string macros as CStrings.
Also, pass "-std=gnu11" so that we accept UTF-8 strings in these macros.

<rdar://problem/16198953>

Swift SVN r14664
2014-03-05 00:29:43 +00:00
Dmitri Hrybenko
d35cf945e6 Move Clang importer test SDK to a toplevel dir test/Inputs where it can be
shared between Clang importer and IDE tests


Swift SVN r11292
2013-12-14 02:20:32 +00:00