r190038 - clang-format: Enable formatting of nested blocks.

Richard Sandiford rsandifo at linux.vnet.ibm.com
Thu Sep 5 08:54:09 PDT 2013


Probably old news, sorry, but this:

Daniel Jasper <djasper at google.com> writes:
> @@ -1183,23 +1189,39 @@ void UnwrappedLineParser::parseObjCProto
>    parseObjCUntilAtEnd();
>  }
>
> +static void printDebugInfo(const UnwrappedLine &Line, StringRef Prefix = "") {
> +  llvm::dbgs() << Prefix << "Line(" << Line.Level << ")"
> +               << (Line.InPPDirective ? " MACRO" : "") << ": ";
> +  for (std::list<UnwrappedLineNode>::const_iterator I = Line.Tokens.begin(),
> +                                                    E = Line.Tokens.end();
> +       I != E; ++I) {
> +    llvm::dbgs() << I->Tok->Tok.getName() << " ";
> +  }
> +  for (std::list<UnwrappedLineNode>::const_iterator I = Line.Tokens.begin(),
> +                                                    E = Line.Tokens.end();
> +       I != E; ++I) {
> +    const UnwrappedLineNode &Node = *I;
> +    for (SmallVectorImpl<UnwrappedLine>::const_iterator
> +             I = Node.Children.begin(),
> +             E = Node.Children.end();
> +         I != E; ++I) {
> +      printDebugInfo(*I, "\nChild: ");
> +    }
> +  }
> +  llvm::dbgs() << "\n";
> +}
> +
>  void UnwrappedLineParser::addUnwrappedLine() {
>    if (Line->Tokens.empty())
>      return;
>    DEBUG({
> -    llvm::dbgs() << "Line(" << Line->Level << ")"
> -                 << (Line->InPPDirective ? " MACRO" : "") << ": ";
> -    for (std::list<FormatToken *>::iterator I = Line->Tokens.begin(),
> -                                            E = Line->Tokens.end();
> -         I != E; ++I) {
> -      llvm::dbgs() << (*I)->Tok.getName() << " ";
> -    }
> -    llvm::dbgs() << "\n";
> +    if (CurrentLines == &Lines)
> +      printDebugInfo(*Line);
>    });

causes a -Werror release bootstrap to fail, because the function is
defined but not used in that case.

Thanks,
Richard




More information about the cfe-commits mailing list