clang
3.7.0
|
This file implements functions declared in Format.h. This will be split into separate files as we go. More...
#include "ContinuationIndenter.h"
#include "TokenAnnotator.h"
#include "UnwrappedLineFormatter.h"
#include "UnwrappedLineParser.h"
#include "WhitespaceManager.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Format/Format.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/YAMLTraits.h"
#include <queue>
#include <string>
Go to the source code of this file.
Namespaces | |
llvm | |
llvm::yaml | |
clang | |
clang::format | |
Macros | |
#define | DEBUG_TYPE "format-formatter" |
Functions | |
const std::error_category & | clang::format::getParseCategory () |
std::error_code | clang::format::make_error_code (ParseError e) |
FormatStyle | clang::format::getLLVMStyle () |
Returns a format style complying with the LLVM coding standards: http://llvm.org/docs/CodingStandards.html. More... | |
FormatStyle | clang::format::getGoogleStyle (FormatStyle::LanguageKind Language) |
Returns a format style complying with one of Google's style guides: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml. http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml. https://developers.google.com/protocol-buffers/docs/style. More... | |
FormatStyle | clang::format::getChromiumStyle (FormatStyle::LanguageKind Language) |
Returns a format style complying with Chromium's style guide: http://www.chromium.org/developers/coding-style. More... | |
FormatStyle | clang::format::getMozillaStyle () |
Returns a format style complying with Mozilla's style guide: https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style. More... | |
FormatStyle | clang::format::getWebKitStyle () |
Returns a format style complying with Webkit's style guide: http://www.webkit.org/coding/coding-style.html. More... | |
FormatStyle | clang::format::getGNUStyle () |
Returns a format style complying with GNU Coding Standards: http://www.gnu.org/prep/standards/standards.html. More... | |
FormatStyle | clang::format::getNoStyle () |
Returns style indicating formatting should be not applied at all. More... | |
bool | clang::format::getPredefinedStyle (StringRef Name, FormatStyle::LanguageKind Language, FormatStyle *Style) |
Gets a predefined style for the specified language by name. More... | |
std::error_code | clang::format::parseConfiguration (StringRef Text, FormatStyle *Style) |
Parse configuration from YAML-formatted text. More... | |
std::string | clang::format::configurationAsText (const FormatStyle &Style) |
Gets configuration in a YAML string. More... | |
tooling::Replacements | clang::format::reformat (const FormatStyle &Style, SourceManager &SourceMgr, FileID ID, ArrayRef< CharSourceRange > Ranges, bool *IncompleteFormat=nullptr) |
Reformats the given Ranges in the file ID . More... | |
tooling::Replacements | clang::format::reformat (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>", bool *IncompleteFormat=nullptr) |
Reformats the given Ranges in Code . More... | |
LangOptions | clang::format::getFormattingLangOpts (const FormatStyle &Style=getLLVMStyle()) |
Returns the LangOpts that the formatter expects you to set. More... | |
static FormatStyle::LanguageKind | clang::format::getLanguageByFileName (StringRef FileName) |
FormatStyle | clang::format::getStyle (StringRef StyleName, StringRef FileName, StringRef FallbackStyle) |
Construct a FormatStyle based on StyleName . More... | |
This file implements functions declared in Format.h. This will be split into separate files as we go.
Definition in file Format.cpp.
#define DEBUG_TYPE "format-formatter" |
Definition at line 35 of file Format.cpp.
llvm::SpecificBumpPtrAllocator<FormatToken> Allocator |
Definition at line 1211 of file Format.cpp.
Referenced by clang::CodeCompletionBuilder::addBriefComment(), and AddObjCKeyValueCompletions().
bool BinPackInconclusiveFunctions |
Definition at line 1558 of file Format.cpp.
unsigned Column |
Definition at line 1202 of file Format.cpp.
Referenced by clang::ASTUnit::CodeComplete(), clang::CodeGen::CodeGenFunction::EmitCheckSourceLocation(), clang::BackendConsumer::EmitOptimizationMessage(), clang::format::CommaSeparatedList::formatAfterToken(), clang::BackendConsumer::InlineAsmDiagHandler2(), clang::format::CommaSeparatedList::precomputeFormattingInfos(), and printWordWrapped().
encoding::Encoding Encoding |
Definition at line 1210 of file Format.cpp.
Referenced by clang::format::getCommentSplit(), clang::SourceLocation::getFromRawEncoding(), and clang::format::getStringSplit().
unsigned FirstInLineIndex |
Definition at line 1213 of file Format.cpp.
SmallVector<IdentifierInfo *, 8> ForEachMacros |
Definition at line 1215 of file Format.cpp.
bool FormattingDisabled |
Definition at line 1217 of file Format.cpp.
FormatToken* FormatTok |
Definition at line 1199 of file Format.cpp.
bool GreaterStashed |
Definition at line 1201 of file Format.cpp.
FileID ID |
Definition at line 1206 of file Format.cpp.
IdentifierTable IdentTable |
Definition at line 1208 of file Format.cpp.
bool IsFirstToken |
Definition at line 1200 of file Format.cpp.
AdditionalKeywords Keywords |
Definition at line 1209 of file Format.cpp.
bool LessStashed |
Definition at line 1201 of file Format.cpp.
std::unique_ptr<Lexer> Lex |
Definition at line 1204 of file Format.cpp.
Referenced by clang::Lexer::LexFromRawLexer().
llvm::Regex MacroBlockBeginRegex |
Definition at line 1219 of file Format.cpp.
llvm::Regex MacroBlockEndRegex |
Definition at line 1220 of file Format.cpp.
SmallVector<CharSourceRange, 8> Ranges |
Definition at line 1554 of file Format.cpp.
Referenced by clang::DiagnosticRenderer::emitDiagnostic(), clang::ento::BugReporterVisitor::getDefaultEndPath(), clang::ento::PathDiagnosticConsumer::HandlePathDiagnostic(), clang::ento::PathDiagnosticPiece::Profile(), and ReportEvent().
SourceManager& SourceMgr |
Definition at line 1205 of file Format.cpp.
Referenced by clang::tooling::applyAllReplacements(), clang::GenerateModuleAction::BeginSourceFileAction(), checkConfigMacro(), compileModuleImpl(), ConvertBackendLocation(), clang::CompilerInstance::createSourceManager(), clang::Preprocessor::CreateString(), clang::Sema::DiagnoseUnusedExprResult(), clang::Preprocessor::DumpLocation(), clang::Preprocessor::DumpToken(), clang::BackendConsumer::EmitOptimizationMessage(), clang::Preprocessor::EnterMainSourceFile(), clang::ASTReader::findPreprocessedEntitiesInRange(), clang::format::WhitespaceManager::generateReplacements(), clang::ASTContext::getFullLoc(), clang::Preprocessor::getLastMacroWithSpelling(), clang::Sema::getLocForEndOfToken(), clang::ASTContext::getRawCommentForDeclNoCache(), clang::PreprocessingRecord::getSourceManager(), clang::ASTContext::getSourceManager(), clang::ASTUnit::getSourceManager(), clang::ASTReader::isPreprocessedEntityInFileID(), PrintUnexpected(), clang::ASTReader::ReadAST(), clang::ASTReader::ReadPragmaDiagnosticMappings(), clang::ASTReader::ReadSLocEntry(), clang::format::reformat(), clang::Preprocessor::SetCodeCompletionPoint(), and clang::CompilerInstance::setSourceManager().
FormatStyle Style |
Definition at line 1207 of file Format.cpp.
Referenced by clang::format::configurationAsText(), clang::format::getGNUStyle(), clang::format::getStyle(), clang::format::getWebKitStyle(), and clang::VarDecl::setInitStyle().
SmallVector<FormatToken *, 16> Tokens |
Definition at line 1214 of file Format.cpp.
Referenced by clang::comments::Sema::checkDeprecatedCommand(), DiagnoseSwitchLabelsFallthrough(), clang::Preprocessor::getLastMacroWithSpelling(), and clang::format::AnnotatedLine::startsWith().
unsigned TrailingWhitespace |
Definition at line 1203 of file Format.cpp.
SmallVector<SmallVector<UnwrappedLine, 16>, 2> UnwrappedLines |
Definition at line 1555 of file Format.cpp.
WhitespaceManager Whitespaces |
Definition at line 1553 of file Format.cpp.