diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-06-25 00:28:35 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-06-25 00:28:35 +0000 |
commit | e15c5bb0df8f1d7f9a1f4887c893e8517a0465ea (patch) | |
tree | d1a99185f73229e82fd79c54d233a06d7786b38f /test | |
parent | 450955db5aa414877c6c966660b41472ffd60b52 (diff) | |
download | clang-e15c5bb0df8f1d7f9a1f4887c893e8517a0465ea.tar.gz clang-e15c5bb0df8f1d7f9a1f4887c893e8517a0465ea.tar.bz2 clang-e15c5bb0df8f1d7f9a1f4887c893e8517a0465ea.tar.xz |
Fix parsing nested __if_exists blocks
Rather than having kw___if_exists be a special case of
ParseCompoundStatementBody, we can look for kw___if_exists in the big
switch over for valid statement tokens in ParseStatementOrDeclaration.
Nested __if_exists blocks are used in the DECLARE_REGISTRY_RESOURCEID
macro from atlcom.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211654 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Parser/ms-if-exists.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/Parser/ms-if-exists.cpp b/test/Parser/ms-if-exists.cpp index 2d4a957f12..79cc571a35 100644 --- a/test/Parser/ms-if-exists.cpp +++ b/test/Parser/ms-if-exists.cpp @@ -1,7 +1,5 @@ // RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -Wmicrosoft -verify -fms-extensions -// expected-no-diagnostics - class MayExist { private: typedef int Type; @@ -101,3 +99,19 @@ class IfExistsClassScope { int var244; } }; + +void test_nested_if_exists() { + __if_exists(MayExist::Type) { + int x = 42; + __if_not_exists(MayExist::Type_not) { + x++; + } + } +} + +void test_attribute_on_if_exists() { + [[clang::fallthrough]] // expected-error {{an attribute list cannot appear here}} + __if_exists(MayExist::Type) { + int x; + } +} |