forked from OSchip/llvm-project
Fixes incorrect handling of the declaration context stack.
llvm-svn: 173250
This commit is contained in:
parent
ffffbefa43
commit
390805731f
|
@ -33,12 +33,12 @@ public:
|
|||
ScopedDeclarationState(UnwrappedLine &Line, std::vector<bool> &Stack,
|
||||
bool MustBeDeclaration)
|
||||
: Line(Line), Stack(Stack) {
|
||||
Stack.push_back(MustBeDeclaration);
|
||||
Line.MustBeDeclaration = MustBeDeclaration;
|
||||
Stack.push_back(MustBeDeclaration);
|
||||
}
|
||||
~ScopedDeclarationState() {
|
||||
Line.MustBeDeclaration = Stack.back();
|
||||
Stack.pop_back();
|
||||
Line.MustBeDeclaration = Stack.back();
|
||||
}
|
||||
private:
|
||||
UnwrappedLine &Line;
|
||||
|
|
|
@ -1682,6 +1682,16 @@ TEST_F(FormatTest, BlockComments) {
|
|||
TEST_F(FormatTest, FormatStarDependingOnContext) {
|
||||
verifyFormat("void f(int *a);");
|
||||
verifyFormat("void f() { f(fint * b); }");
|
||||
verifyFormat("class A {\n void f(int *a);\n};");
|
||||
verifyFormat("class A {\n int *a;\n};");
|
||||
verifyFormat("namespace a {\n"
|
||||
"namespace b {\n"
|
||||
"class A {\n"
|
||||
" void f() {}\n"
|
||||
" int *a;\n"
|
||||
"};\n"
|
||||
"}\n"
|
||||
"}");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, SpecialTokensAtEndOfLine) {
|
||||
|
|
Loading…
Reference in New Issue