From 8ca6ab33b7d2bd10e885124405d6f26406256b9b Mon Sep 17 00:00:00 2001 From: Erik Pilkington Date: Wed, 20 Mar 2019 19:26:37 +0000 Subject: [PATCH] Add a __has_extension check for '#pragma clang attribute' as an external-declaration This was added in r356075. llvm-svn: 356600 --- clang/include/clang/Basic/Features.def | 1 + clang/test/Parser/pragma-attribute-context.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/clang/include/clang/Basic/Features.def b/clang/include/clang/Basic/Features.def index b171365efcea..c97cbc59bc6a 100644 --- a/clang/include/clang/Basic/Features.def +++ b/clang/include/clang/Basic/Features.def @@ -247,6 +247,7 @@ EXTENSION(cxx_variable_templates, LangOpts.CPlusPlus) // Miscellaneous language extensions EXTENSION(overloadable_unmarked, true) EXTENSION(pragma_clang_attribute_namespaces, true) +EXTENSION(pragma_clang_attribute_external_declaration, true) #undef EXTENSION #undef FEATURE diff --git a/clang/test/Parser/pragma-attribute-context.cpp b/clang/test/Parser/pragma-attribute-context.cpp index 3ec5a67f4c35..d893f18335e0 100644 --- a/clang/test/Parser/pragma-attribute-context.cpp +++ b/clang/test/Parser/pragma-attribute-context.cpp @@ -1,6 +1,10 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -verify -std=c++11 %s // RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -xobjective-c++ -verify -std=c++11 %s +#if !__has_extension(pragma_clang_attribute_external_declaration) +#error +#endif + #define BEGIN_PRAGMA _Pragma("clang attribute push (__attribute__((availability(macos, introduced=1000))), apply_to=function)") #define END_PRAGMA _Pragma("clang attribute pop")