Commit Graph

108 Commits

Author SHA1 Message Date
Doug Gregor
9a70c0ebf4 [Clang Importer] Refactor the handling of type import contexts.
The importer has always imported types differently in different
places, e.g., function parameter types have special rules for C++
references. Formalize this notion a bit, and make it work properly
when dealing with typedefs where the underlying type itself might be
imported differently in different contexts. 

As part of this, limit the import of C's 'void' type to the result of
a function type.


Swift SVN r5055
2013-05-06 18:10:46 +00:00
Doug Gregor
f3bb94c166 Clang importer: look through macros that simply expand to another macro.
This allows us to import FOO in the following example:

  #define FOO BAR
  #define BAR 5

Fixes <rdar://problem/13768957>.


Swift SVN r5001
2013-04-30 20:25:56 +00:00
Doug Gregor
c057b21193 Ban the use of construction syntax T(x) for coercions and unchecked downcasts.
Use "x as T" for coercions and "x as! T" for unchecked downcasts.


Swift SVN r4683
2013-04-11 21:17:47 +00:00
Doug Gregor
6adc44dac1 Fix for Clang r175585
Swift SVN r4106
2013-02-20 17:56:58 +00:00
Doug Gregor
32855fa161 Handle negation in imported constants, for both macros and enumerators.
Swift SVN r3963
2013-02-06 01:35:04 +00:00
Doug Gregor
a9a90fd56a Track the Clang macros that were used to generate Swift constants.
Swift SVN r3960
2013-02-06 00:57:03 +00:00
Doug Gregor
b1fa6a2ff1 Switch the macro-importer over to the createConstant() interface used by enums.
We can now IRgen references to single-token macros that have integral
or floating literals. They map to CInt and CDouble,
respectively. There is more work to do here, later.



Swift SVN r3958
2013-02-06 00:24:32 +00:00
Joe Groff
77fc671d91 ClangImporter: Groundwork for importing #defines.
When doing name lookup into a Clang module, look for a macro with the given name and try to convert it into a Swift decl. Turn simple literal macros with expansions <number>, -<number>, or (-<number>) into Swift read-only properties. Map integer literals to Swift 'Int' and float literals to Swift 'Double' for want of a better type to map them to--it would probably be better if we had a decl that behaved like Pascal 'const' and converted like a literal value. Codegen for the synthesized properties isn't wired up, so compiling code that tries to use macro values will currently die because of missing externals.

Swift SVN r3941
2013-02-03 19:06:11 +00:00