diff options
author | Daniel Jasper <djasper@google.com> | 2014-09-16 16:36:57 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-09-16 16:36:57 +0000 |
commit | b23e20b7f5b9491e04b849e96cb010c2b0906b14 (patch) | |
tree | 2e1d0ebc31da377e47c3d4f090e2897a89537f61 /clang | |
parent | eef9f4dc74d081393eaca26186b3c12c16d24b61 (diff) | |
download | bcm5719-llvm-b23e20b7f5b9491e04b849e96cb010c2b0906b14.tar.gz bcm5719-llvm-b23e20b7f5b9491e04b849e96cb010c2b0906b14.zip |
clang-format: Allow unbroken ::: in inline assembly.
Before:
asm volatile("nop" :: : "memory");
After:
asm volatile("nop" ::: "memory");
Patch by Eugene Toder. Thank you.
llvm-svn: 217883
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 4c18b72d3c6..db08f59b843 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1653,6 +1653,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, return !Line.First->isOneOf(tok::kw_case, tok::kw_default) && Tok.getNextNonComment() && Tok.Type != TT_ObjCMethodExpr && !Tok.Previous->is(tok::question) && + !(Tok.Type == TT_InlineASMColon && + Tok.Previous->is(tok::coloncolon)) && (Tok.Type != TT_DictLiteral || Style.SpacesInContainerLiterals); if (Tok.Previous->Type == TT_UnaryOperator) return Tok.Type == TT_BinaryOperator; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 4b0791d673b..7da0b534be3 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -2105,6 +2105,7 @@ TEST_F(FormatTest, FormatsExternC) { verifyFormat("extern \"C\" {\nint a;"); } TEST_F(FormatTest, FormatsInlineASM) { verifyFormat("asm(\"xyz\" : \"=a\"(a), \"=d\"(b) : \"a\"(data));"); + verifyFormat("asm(\"nop\" ::: \"memory\");"); verifyFormat( "asm(\"movq\\t%%rbx, %%rsi\\n\\t\"\n" " \"cpuid\\n\\t\"\n" |