summaryrefslogtreecommitdiffstats
path: root/lib/Format/UnwrappedLineFormatter.h
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-02-04 15:26:27 +0000
committerNico Weber <nicolasweber@gmx.de>2015-02-04 15:26:27 +0000
commitd52fa386bb1b5c37877ea38a06e361868988ce8b (patch)
treeb7e549daffcfd5634bd2858ec797a2cf655d9d0e /lib/Format/UnwrappedLineFormatter.h
parent0add82c2f294855cb463499dc7ef43db26b71e77 (diff)
clang-format: Add support for SEH __try / __except / __finally blocks.
This lets clang-format format __try { } __except(0) { } and __try { } __finally { } correctly. __try and __finally are keywords if `LangOpts.MicrosoftExt` is set, so this turns this on. This also enables a few other keywords, but it shouldn't overly perturb regular clang-format operation. __except is a context-sensitive keyword, so `AdditionalKeywords` needs to be passed around to a few more places. Fixes PR22321. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228148 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineFormatter.h')
-rw-r--r--lib/Format/UnwrappedLineFormatter.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Format/UnwrappedLineFormatter.h b/lib/Format/UnwrappedLineFormatter.h
index 3ae6dbc4db..5e0261210d 100644
--- a/lib/Format/UnwrappedLineFormatter.h
+++ b/lib/Format/UnwrappedLineFormatter.h
@@ -32,8 +32,10 @@ class UnwrappedLineFormatter {
public:
UnwrappedLineFormatter(ContinuationIndenter *Indenter,
WhitespaceManager *Whitespaces,
- const FormatStyle &Style)
- : Indenter(Indenter), Whitespaces(Whitespaces), Style(Style) {}
+ const FormatStyle &Style,
+ const AdditionalKeywords &Keywords)
+ : Indenter(Indenter), Whitespaces(Whitespaces), Style(Style),
+ Keywords(Keywords) {}
unsigned format(const SmallVectorImpl<AnnotatedLine *> &Lines, bool DryRun,
int AdditionalIndent = 0, bool FixBadIndentation = false);
@@ -153,6 +155,7 @@ private:
ContinuationIndenter *Indenter;
WhitespaceManager *Whitespaces;
FormatStyle Style;
+ const AdditionalKeywords &Keywords;
llvm::SpecificBumpPtrAllocator<StateNode> Allocator;