Commit Graph

104 Commits

Author SHA1 Message Date
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