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

This file implements functions declared in Format.h. More...

#include "clang/Format/Format.h"
#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/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::ReturnTypeBreakingStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::DefinitionReturnTypeBreakingStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::NamespaceIndentationKind >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::BracketAlignmentStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::PointerAlignmentStyle >
 
struct  llvm::yaml::ScalarEnumerationTraits< FormatStyle::SpaceBeforeParensOptions >
 
struct  llvm::yaml::MappingTraits< FormatStyle >
 
struct  llvm::yaml::MappingTraits< FormatStyle::BraceWrappingFlags >
 
struct  llvm::yaml::MappingTraits< FormatStyle::IncludeCategory >
 
struct  llvm::yaml::DocumentListTraits< std::vector< FormatStyle > >
 

Namespaces

 llvm
 DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterators.
 
 llvm::yaml
 
 clang
 Dataflow Directional Tag Classes.
 
 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)
 
static FormatStyle clang::format::expandPresets (const FormatStyle &Style)
 
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. 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...
 
static bool clang::format::affectsRange (ArrayRef< tooling::Range > Ranges, unsigned Start, unsigned End)
 
static void clang::format::sortIncludes (const FormatStyle &Style, const SmallVectorImpl< IncludeDirective > &Includes, ArrayRef< tooling::Range > Ranges, StringRef FileName, tooling::Replacements &Replaces, unsigned *Cursor)
 
tooling::Replacements clang::format::sortIncludes (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, unsigned *Cursor=nullptr)
 Returns the replacements necessary to sort all #include blocks that are affected by 'Ranges'. 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 1719 of file Format.cpp.

int Category
unsigned Column
encoding::Encoding Encoding
StringRef Filename
unsigned FirstInLineIndex

Definition at line 1360 of file Format.cpp.

SmallVector<IdentifierInfo *, 8> ForEachMacros

Definition at line 1362 of file Format.cpp.

bool FormattingDisabled

Definition at line 1364 of file Format.cpp.

FormatToken* FormatTok

Definition at line 1346 of file Format.cpp.

bool GreaterStashed

Definition at line 1348 of file Format.cpp.

FileID ID

Definition at line 1353 of file Format.cpp.

IdentifierTable IdentTable

Definition at line 1355 of file Format.cpp.

bool IsFirstToken

Definition at line 1347 of file Format.cpp.

AdditionalKeywords Keywords

Definition at line 1356 of file Format.cpp.

bool LessStashed

Definition at line 1348 of file Format.cpp.

std::unique_ptr<Lexer> Lex

Definition at line 1351 of file Format.cpp.

Referenced by clang::Lexer::LexFromRawLexer().

llvm::Regex MacroBlockBeginRegex

Definition at line 1366 of file Format.cpp.

llvm::Regex MacroBlockEndRegex

Definition at line 1367 of file Format.cpp.

Definition at line 1725 of file Format.cpp.

SmallVector<CharSourceRange, 8> Ranges
SourceManager& SourceMgr
FormatStyle Style
StringRef Text
SmallVector<FormatToken *, 16> Tokens
unsigned TrailingWhitespace

Definition at line 1350 of file Format.cpp.

SmallVector<SmallVector<UnwrappedLine, 16>, 2> UnwrappedLines

Definition at line 1716 of file Format.cpp.

WhitespaceManager Whitespaces

Definition at line 1714 of file Format.cpp.

Referenced by NormalizeLine().