summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/FormatTokenLexer.cpp
diff options
context:
space:
mode:
authorFrancois Ferrand <thetypz@gmail.com>2019-06-06 20:06:23 +0000
committerFrancois Ferrand <thetypz@gmail.com>2019-06-06 20:06:23 +0000
commite8a301f87f75b7743a62077ac60fe06739fbab4b (patch)
tree3ef20f94b8d870923625788e3c8a9d5154534da2 /clang/lib/Format/FormatTokenLexer.cpp
parentf1d9b3180e6197674c26463ef193316333a03805 (diff)
downloadbcm5719-llvm-e8a301f87f75b7743a62077ac60fe06739fbab4b.tar.gz
bcm5719-llvm-e8a301f87f75b7743a62077ac60fe06739fbab4b.zip
clang-format: better handle namespace macros
Summary: Other macros are used to declare namespaces, and should thus be handled similarly. This is the case for crpcut's TESTSUITE macro, or for unittest-cpp's SUITE macro: TESTSUITE(Foo) { TEST(MyFirstTest) { assert(0); } } // TESTSUITE(Foo) This patch deals with this cases by introducing a new option to specify lists of namespace macros. Internally, it re-uses the system already in place for foreach and statement macros, to ensure there is no impact on performance. Reviewers: krasimir, djasper, klimek Reviewed By: klimek Subscribers: acoomans, cfe-commits, klimek Tags: #clang Differential Revision: https://reviews.llvm.org/D37813 llvm-svn: 362740
Diffstat (limited to 'clang/lib/Format/FormatTokenLexer.cpp')
-rw-r--r--clang/lib/Format/FormatTokenLexer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp
index 4438756579a..009b8849753 100644
--- a/clang/lib/Format/FormatTokenLexer.cpp
+++ b/clang/lib/Format/FormatTokenLexer.cpp
@@ -41,6 +41,8 @@ FormatTokenLexer::FormatTokenLexer(const SourceManager &SourceMgr, FileID ID,
Macros.insert({&IdentTable.get(StatementMacro), TT_StatementMacro});
for (const std::string &TypenameMacro : Style.TypenameMacros)
Macros.insert({&IdentTable.get(TypenameMacro), TT_TypenameMacro});
+ for (const std::string &NamespaceMacro : Style.NamespaceMacros)
+ Macros.insert({&IdentTable.get(NamespaceMacro), TT_NamespaceMacro});
}
ArrayRef<FormatToken *> FormatTokenLexer::lex() {
OpenPOWER on IntegriCloud