diff options
Diffstat (limited to 'lib/Format')
-rw-r--r-- | lib/Format/Format.cpp | 4 | ||||
-rw-r--r-- | lib/Format/UnwrappedLineParser.cpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index d95deb5704..2952067c39 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -1256,8 +1256,10 @@ private: IsExpression = true; AnnotatedToken *Previous = Current.Parent; while (Previous != NULL) { - if (Previous->Type == TT_BinaryOperator) + if (Previous->Type == TT_BinaryOperator && + (Previous->is(tok::star) || Previous->is(tok::amp))) { Previous->Type = TT_PointerOrReference; + } Previous = Previous->Parent; } } diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index c21fa0d74e..1b39442610 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -38,7 +38,10 @@ public: } ~ScopedDeclarationState() { Stack.pop_back(); - Line.MustBeDeclaration = Stack.back(); + if (!Stack.empty()) + Line.MustBeDeclaration = Stack.back(); + else + Line.MustBeDeclaration = true; } private: UnwrappedLine &Line; |