aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-01-08 16:17:54 +0000
committerDaniel Jasper <djasper@google.com>2013-01-08 16:17:54 +0000
commit765561ff8fa636cc88d133b85ecb592094104554 (patch)
tree6aa314182e7cc20cbc5ba7967614beb6969068c1 /lib/Format/Format.cpp
parenta879a164495db6daa4d809fbaba1617c9ade5919 (diff)
Don't put spaces around ##.
In Clang/LLVM this seems to be the more common formatting for ##s. There might still be case that we miss, but we'll fix those as we go along. Before: #define A(X) void function ## X(); After: #define A(X) void function##X(); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171862 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 1aa7acf3de..120b54d831 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -928,6 +928,10 @@ private:
bool spaceRequiredBetween(const AnnotatedToken &Left,
const AnnotatedToken &Right) {
+ if (Right.is(tok::hashhash))
+ return Left.is(tok::hash);
+ if (Left.is(tok::hashhash) || Left.is(tok::hash))
+ return Right.is(tok::hash);
if (Right.is(tok::r_paren) || Right.is(tok::semi) || Right.is(tok::comma))
return false;
if (Left.is(tok::kw_template) && Right.is(tok::less))
@@ -962,8 +966,6 @@ private:
return true;
if (Left.is(tok::l_paren))
return false;
- if (Left.is(tok::hash))
- return false;
if (Right.is(tok::l_paren)) {
return Left.is(tok::kw_if) || Left.is(tok::kw_for) ||
Left.is(tok::kw_while) || Left.is(tok::kw_switch) ||