summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-12-01 12:05:04 +0000
committerDaniel Jasper <djasper@google.com>2015-12-01 12:05:04 +0000
commita00de6366a6662ad71c509fed584c7f707859a27 (patch)
tree53604e9091d78baad1ef00198e7a6a838d7f49d8 /clang/lib
parentec90e51c7946bfd57097c8e45b5f12f3077f4895 (diff)
downloadbcm5719-llvm-a00de6366a6662ad71c509fed584c7f707859a27.tar.gz
bcm5719-llvm-a00de6366a6662ad71c509fed584c7f707859a27.zip
clang-format: treat Q_SIGNALS as an access modifier
Patch by Alexander Richardson, thank you! llvm-svn: 254407
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/FormatToken.h2
-rw-r--r--clang/lib/Format/UnwrappedLineFormatter.cpp4
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp3
3 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h
index 49885205994..93baaf29321 100644
--- a/clang/lib/Format/FormatToken.h
+++ b/clang/lib/Format/FormatToken.h
@@ -561,6 +561,7 @@ struct AdditionalKeywords {
kw_returns = &IdentTable.get("returns");
kw_signals = &IdentTable.get("signals");
+ kw_qsignals = &IdentTable.get("Q_SIGNALS");
kw_slots = &IdentTable.get("slots");
kw_qslots = &IdentTable.get("Q_SLOTS");
}
@@ -607,6 +608,7 @@ struct AdditionalKeywords {
// QT keywords.
IdentifierInfo *kw_signals;
+ IdentifierInfo *kw_qsignals;
IdentifierInfo *kw_slots;
IdentifierInfo *kw_qslots;
};
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 04087e84871..f6505690796 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -90,8 +90,8 @@ private:
return 0;
if (RootToken.isAccessSpecifier(false) ||
RootToken.isObjCAccessSpecifier() ||
- (RootToken.is(Keywords.kw_signals) && RootToken.Next &&
- RootToken.Next->is(tok::colon)))
+ (RootToken.isOneOf(Keywords.kw_signals, Keywords.kw_qsignals) &&
+ RootToken.Next && RootToken.Next->is(tok::colon)))
return Style.AccessModifierOffset;
return 0;
}
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index ad548217b41..e06903c306c 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -784,7 +784,8 @@ void UnwrappedLineParser::parseStructuralElement() {
parseJavaScriptEs6ImportExport();
return;
}
- if (FormatTok->is(Keywords.kw_signals)) {
+ if (FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals,
+ Keywords.kw_slots, Keywords.kw_qslots)) {
nextToken();
if (FormatTok->is(tok::colon)) {
nextToken();
OpenPOWER on IntegriCloud