diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/Parser/cxx11-stmt-attributes.cpp | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/Parser/cxx11-stmt-attributes.cpp')
-rw-r--r-- | clang/test/Parser/cxx11-stmt-attributes.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx11-stmt-attributes.cpp b/clang/test/Parser/cxx11-stmt-attributes.cpp new file mode 100644 index 0000000..fab5621 --- /dev/null +++ b/clang/test/Parser/cxx11-stmt-attributes.cpp @@ -0,0 +1,54 @@ +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s + +void foo(int i) { + + [[unknown_attribute]] ; + [[unknown_attribute]] { } + [[unknown_attribute]] if (0) { } + [[unknown_attribute]] for (;;); + [[unknown_attribute]] do { + [[unknown_attribute]] continue; + } while (0); + [[unknown_attribute]] while (0); + + [[unknown_attribute]] switch (i) { + [[unknown_attribute]] case 0: + [[unknown_attribute]] default: + [[unknown_attribute]] break; + } + + [[unknown_attribute]] goto here; + [[unknown_attribute]] here: + + [[unknown_attribute]] try { + } catch (...) { + } + + [[unknown_attribute]] return; + + + alignas(8) ; // expected-warning {{attribute aligned cannot be specified on a statement}} + [[noreturn]] { } // expected-warning {{attribute noreturn cannot be specified on a statement}} + [[noreturn]] if (0) { } // expected-warning {{attribute noreturn cannot be specified on a statement}} + [[noreturn]] for (;;); // expected-warning {{attribute noreturn cannot be specified on a statement}} + [[noreturn]] do { // expected-warning {{attribute noreturn cannot be specified on a statement}} + [[unavailable]] continue; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here + } while (0); + [[unknown_attributqqq]] while (0); // TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody) + [[unknown_attribute]] while (0); // no warning here yet, just an unknown attribute + + [[unused]] switch (i) { // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here + [[uuid]] case 0: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here + [[visibility]] default: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here + [[carries_dependency]] break; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} + } + + [[fastcall]] goto there; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here + [[noinline]] there: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here + + [[lock_returned]] try { // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here + } catch (...) { + } + + [[weakref]] return; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here +} |