//===--- Format.cpp - Format C++ code -------------------------------------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===//////// \file/// \brief This file implements functions declared in Format.h. This will be/// split into separate files as we go./////===----------------------------------------------------------------------===//#define DEBUG_TYPE "format-formatter"#include"BreakableToken.h"#include"TokenAnnotator.h"#include"UnwrappedLineParser.h"#include"WhitespaceManager.h"#include"clang/Basic/Diagnostic.h"#include"clang/Basic/OperatorPrecedence.h"#include"clang/Basic/SourceManager.h"#include"clang/Format/Format.h"#include"clang/Frontend/TextDiagnosticPrinter.h"#include"clang/Lex/Lexer.h"#include"llvm/ADT/STLExtras.h"#include"llvm/Support/Allocator.h"#include"llvm/Support/Debug.h"#include<queue>#include<string>namespaceclang{namespaceformat{FormatStylegetLLVMStyle(){FormatStyleLLVMStyle;LLVMStyle.ColumnLimit=80;LLVMStyle.MaxEmptyLinesToKeep=1;LLVMStyle.PointerBindsToType=false;LLVMStyle.DerivePointerBinding=false;LLVMStyle.AccessModifierOffset=-2;LLVMStyle.Standard=FormatStyle::LS_Cpp03;LLVMStyle.IndentCaseLabels=false;LLVMStyle.SpacesBeforeTrailingComments=1;LLVMStyle.BinPackParameters=true;LLVMStyle.AllowAllParametersOfDeclarationOnNextLine=true;LLVMStyle.ConstructorInitializerAllOnOneLineOrOnePerLine=false;LLVMStyle.AllowShortIfStatementsOnASingleLine=false;LLVMStyle.ObjCSpaceBeforeProtocolList=true;LLVMStyle.PenaltyExcessCharacter=1000000;LLVMStyle.PenaltyReturnTypeOnItsOwnLine=75;LLVMStyle.AlignEscapedNewlinesLeft=false;returnLLVMStyle;}FormatStylegetGoogleStyle(){FormatStyleGoogleStyle;GoogleStyle.ColumnLimit=80;GoogleStyle.MaxEmptyLinesToKeep=1;GoogleStyle.PointerBindsToType=true;GoogleStyle.DerivePointerBinding=true