diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-08-15 14:42:01 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-08-15 14:42:01 +0000 |
commit | c3ca0b51321b9d6ec627c7fc7484e8aec46475bb (patch) | |
tree | a29bd66b073200044ae7476c06a4f97b3a71a8cd /lib/Parse/ParseDecl.cpp | |
parent | bcc9bb722691c90459b10f7b8016fb84d62d3039 (diff) |
Allow pretty platform names in availability attributes
rdar://32076651
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index f6a315198c..b20b0db7d3 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -912,13 +912,18 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability, return; } IdentifierLoc *Platform = ParseIdentifierLoc(); - // Canonicalize platform name from "macosx" to "macos". - if (Platform->Ident && Platform->Ident->getName() == "macosx") - Platform->Ident = PP.getIdentifierInfo("macos"); - // Canonicalize platform name from "macosx_app_extension" to - // "macos_app_extension". - if (Platform->Ident && Platform->Ident->getName() == "macosx_app_extension") - Platform->Ident = PP.getIdentifierInfo("macos_app_extension"); + if (const IdentifierInfo *const Ident = Platform->Ident) { + // Canonicalize platform name from "macosx" to "macos". + if (Ident->getName() == "macosx") + Platform->Ident = PP.getIdentifierInfo("macos"); + // Canonicalize platform name from "macosx_app_extension" to + // "macos_app_extension". + else if (Ident->getName() == "macosx_app_extension") + Platform->Ident = PP.getIdentifierInfo("macos_app_extension"); + else + Platform->Ident = PP.getIdentifierInfo( + AvailabilityAttr::canonicalizePlatformName(Ident->getName())); + } // Parse the ',' following the platform name. if (ExpectAndConsume(tok::comma)) { |