Commit Graph

11 Commits

Author SHA1 Message Date
Saleem Abdulrasool
c0de9acdaa test: enable more IRGen tests on Windows
This set of tests also pass on Windows now.  These are mostly invocation
adjustments or renaming/reordering that is needed.
2018-06-07 10:45:35 -07:00
Jordan Rose
a03c40cb2c [ClangImporter] Classify enums using flag_enum and enum_extensibility (#8910)
These new Clang attributes identify whether an enum is intended to
represent an option set or not, and whether the set of cases listed in
the enum declaration is exhaustive. (Swift doesn't currently have a
closed/open distinction for enums, so treat any C enum with
enum_extensibility as a proper closed Swift enum, like we do with
NS_ENUM.)

Enums with neither attribute will continue to be imported as unique
types.

rdar://problem/28476618
2017-04-21 08:57:27 -07:00
Jordan Rose
385da9dc19 [ClangImporter] Don't crash when an enum case alias has no name. (#7483)
Or rather, when the name importer decides that the name it /would/
have should start with a number, and gives up. We should probably
fix that separately, but meanwhile don't crash.

> Roses are red
> Prefix-stripping can create an invalid remainder
> assert(!member->NextDecl &&
> "Already added to a container")

rdar://problem/30401506
2017-02-15 10:46:57 -08:00
Jordan Rose
239b5e02a6 [ClangImporter] Import NS_OPTIONS 0 values with explicit Swift-names.
This shows that the owner of the option set has thought about the
zero case, and wants it to be available in Swift, rather than disabling
it with the default "use [] to construct an empty option set" message.

rdar://problem/26290766
2016-05-26 11:08:24 -07:00
practicalswift
ea0ac3ac67 [gardening] Remove all tabs in C++ code 2016-04-08 21:22:57 +02:00
Jordan Rose
bfd30db4c2 [ClangImporter] Be more careful about stripping 'k' from enum constants.
This condition was wrong and could occasionally produce enum constant
names that started with digits.

rdar://problem/21820628

Swift SVN r30549
2015-07-23 20:50:49 +00:00
Jordan Rose
d9ddc21f49 [ClangImporter] Fix underscore handling from r29673 to handle plurals.
The improvements there caused regressions in other enums. Thanks for catching this
Denis (and Xi)!

Fix-up to rdar://problem/20800204

Swift SVN r29829
2015-07-01 01:01:28 +00:00
Jordan Rose
e900823862 [ClangImporter] Tweak enum import rules to remove more underscores.
If the common prefix of the enum /elements/ had an underscore in the /middle/,
we previously had cases where we'd end up leaving that underscore in place.

rdar://problem/20800204

Swift SVN r29673
2015-06-25 17:32:28 +00:00
Doug Gregor
e033734757 Add test case from rdar://problem/21081557.
This was recently fixed by r29060.

Swift SVN r29094
2015-05-28 04:05:54 +00:00
Jordan Rose
7d9e859596 [ClangImporter] Don't drop the first letter of an enum with underscores.
If the common prefix of all enumerators ends with an underscore, but the
enumerators don't have a common prefix with the enum itself, we can't
drop the underscore.

rdar://problem/18730653

Swift SVN r23941
2014-12-15 19:33:45 +00:00
Argyrios Kyrtzidis
3882ab6bd4 [ClangImporter] When checking for NS_ENUM/NS_OPTIONS enums, use clang::Preprocessor::getImmediateMacroName()
and check for CF_ENUM/CF_OPTIONS, which NS_ENUM/NS_OPTIONS expand to.

This:
- Simplifies code
- Handles CF_ENUM/CF_OPTIONS enums
- Handles correctly an NS_ENUM/NS_OPTIONS enum that was itself expanded from another macro.

Swift SVN r11542
2013-12-21 17:40:28 +00:00