clang  3.7.0
Classes | Namespaces | Macros | Functions
Format.cpp File Reference

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>
Include dependency graph for Format.cpp:

Go to the source code of this file.

Classes

struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::LanguageKind >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::LanguageStandard >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::UseTabStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::ShortFunctionStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::BinaryOperatorStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::BraceBreakingStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::DefinitionReturnTypeBreakingStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::NamespaceIndentationKind >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::PointerAlignmentStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::SpaceBeforeParensOptions >
 
struct  llvm::yaml::MappingTraits< FormatStyle >
 
struct  llvm::yaml::DocumentListTraits< std::vector< FormatStyle > >
 

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...
 

Detailed Description

This file implements functions declared in Format.h. This will be split into separate files as we go.

Definition in file Format.cpp.

Macro Definition Documentation

#define DEBUG_TYPE   "format-formatter"

Definition at line 35 of file Format.cpp.

Variable Documentation

llvm::SpecificBumpPtrAllocator<FormatToken> Allocator
bool BinPackInconclusiveFunctions

Definition at line 1558 of file Format.cpp.

unsigned Column
encoding::Encoding Encoding
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
SourceManager& SourceMgr
FormatStyle Style
SmallVector<FormatToken *, 16> Tokens
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.