summaryrefslogtreecommitdiffstats
path: root/lib/Lex/PPMacroExpansion.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-02-26 19:27:00 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-02-26 19:27:00 +0000
commita004401660d68b3cd8e272e75c535003b6c02e53 (patch)
tree278e3521fcc8ead28c7d5cdd1531fe7537d6e1dd /lib/Lex/PPMacroExpansion.cpp
parent2da60ba8cce2deb639056e254e1a191f919ba726 (diff)
SemaCXX: Support templates in availability attributes
If the availability context is `FunctionTemplateDecl`, we should look through it to the `FunctionDecl`. This prevents a diagnostic in the following case: class C __attribute__((unavailable)); template <class T> void foo(C&) __attribute__((unavailable)); This adds tests for availability in templates in many other cases, but that was the only case that failed before this patch. I added a feature `__has_feature(attribute_availability_in_templates)` so users can test for this. rdar://problem/24561029 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPMacroExpansion.cpp')
-rw-r--r--lib/Lex/PPMacroExpansion.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 50f07bd82b..2c9a37525d 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -1074,6 +1074,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("attribute_availability_tvos", true)
.Case("attribute_availability_watchos", true)
.Case("attribute_availability_with_strict", true)
+ .Case("attribute_availability_in_templates", true)
.Case("attribute_cf_returns_not_retained", true)
.Case("attribute_cf_returns_retained", true)
.Case("attribute_cf_returns_on_parameters", true)