summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-08-15 14:42:01 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-08-15 14:42:01 +0000
commit0b1ce8b8e6932b004d651de4ad33dcd1d46236e5 (patch)
treeaf3441c4039629ef48de3d0e0bf5fb885f7eebdc /clang/lib/Parse/ParseDecl.cpp
parent07ed94a7c77de3890e13bca10a030b7a45d8bbed (diff)
downloadbcm5719-llvm-0b1ce8b8e6932b004d651de4ad33dcd1d46236e5.tar.gz
bcm5719-llvm-0b1ce8b8e6932b004d651de4ad33dcd1d46236e5.zip
Allow pretty platform names in availability attributes
rdar://32076651 llvm-svn: 310921
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index f6a315198c3..b20b0db7d30 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/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)) {
OpenPOWER on IntegriCloud