diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2018-11-09 19:37:18 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2018-11-09 19:37:18 +0000 |
commit | ac77dcd764f42d3635b5974dd954d51227bdcc20 (patch) | |
tree | b31a830c5e490a90bf10b9ac94e78dbd10136d3c /clang/test/SemaCXX/switch-implicit-fallthrough.cpp | |
parent | 123553921f86ac0fad7b742740aa45e8d380be02 (diff) | |
download | bcm5719-llvm-ac77dcd764f42d3635b5974dd954d51227bdcc20.tar.gz bcm5719-llvm-ac77dcd764f42d3635b5974dd954d51227bdcc20.zip |
Allow a double-underscore spelling of Clang attributes using double square bracket syntax.
This matches a similar behavior with GCC accepting [[gnu::__attr__]] as a alias for [[gnu::attr]] in that clang attributes can now be spelled with two leading and trailing underscores.
I had always intended for this to work, but missed the critical bit. We already had an existing test in test/Preprocessor/has_attribute.cpp for [[clang::__fallthrough__]] but using that spelling would still give an "unknown attribute" diagnostic.
llvm-svn: 346547
Diffstat (limited to 'clang/test/SemaCXX/switch-implicit-fallthrough.cpp')
-rw-r--r-- | clang/test/SemaCXX/switch-implicit-fallthrough.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/switch-implicit-fallthrough.cpp b/clang/test/SemaCXX/switch-implicit-fallthrough.cpp index 9540b1ff288..6ccac122cff 100644 --- a/clang/test/SemaCXX/switch-implicit-fallthrough.cpp +++ b/clang/test/SemaCXX/switch-implicit-fallthrough.cpp @@ -314,3 +314,18 @@ int fallthrough_targets(int n) { } return n; } + +int fallthrough_alt_spelling(int n) { + switch (n) { + case 0: + n++; + [[clang::fallthrough]]; + case 1: + n++; + [[clang::__fallthrough__]]; + case 2: + n++; + break; + } + return n; +} |