clang API Documentation

Classes | Namespaces | Enumerations | Functions | Variables
Format.h File Reference
#include "clang/Basic/LangOptions.h"
#include "clang/Tooling/Core/Replacement.h"
#include "llvm/ADT/ArrayRef.h"
#include <system_error>
Include dependency graph for Format.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  clang::format::final
struct  clang::format::FormatStyle
 The FormatStyle is used to configure the formatting to follow specific guidelines. More...
struct  std::is_error_code_enum< clang::format::ParseError >

Namespaces

namespace  clang
namespace  clang::format
namespace  std

Enumerations

enum  clang::format::ParseError { clang::format::Success = 0, clang::format::Error, clang::format::Unsuitable }

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.
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.
FormatStyle clang::format::getChromiumStyle (FormatStyle::LanguageKind Language)
 Returns a format style complying with Chromium's style guide: http://www.chromium.org/developers/coding-style.
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.
FormatStyle clang::format::getWebKitStyle ()
 Returns a format style complying with Webkit's style guide: http://www.webkit.org/coding/coding-style.html.
FormatStyle clang::format::getGNUStyle ()
 Returns a format style complying with GNU Coding Standards: http://www.gnu.org/prep/standards/standards.html.
FormatStyle clang::format::getNoStyle ()
 Returns style indicating formatting should be not applied at all.
bool clang::format::getPredefinedStyle (StringRef Name, FormatStyle::LanguageKind Language, FormatStyle *Style)
 Gets a predefined style for the specified language by name.
std::error_code clang::format::parseConfiguration (StringRef Text, FormatStyle *Style)
 Parse configuration from YAML-formatted text.
std::string clang::format::configurationAsText (const FormatStyle &Style)
 Gets configuration in a YAML string.
tooling::Replacements clang::format::reformat (const FormatStyle &Style, Lexer &Lex, SourceManager &SourceMgr, ArrayRef< CharSourceRange > Ranges)
 Reformats the given Ranges in the token stream coming out of Lex.
tooling::Replacements clang::format::reformat (const FormatStyle &Style, SourceManager &SourceMgr, FileID ID, ArrayRef< CharSourceRange > Ranges)
 Reformats the given Ranges in the file ID.
tooling::Replacements clang::format::reformat (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>")
 Reformats the given Ranges in Code.
LangOptions clang::format::getFormattingLangOpts (const FormatStyle &Style=getLLVMStyle())
 Returns the LangOpts that the formatter expects you to set.
FormatStyle clang::format::getStyle (StringRef StyleName, StringRef FileName, StringRef FallbackStyle)
 Construct a FormatStyle based on StyleName.

Variables

const char * clang::format::StyleOptionHelpDescription = " -style=\"{BasedOnStyle: llvm, IndentWidth: 8}\""
 Description to be used for help text for a llvm::cl option for specifying format style. The description is closely related to the operation of getStyle().

Detailed Description

Various functions to configurably format source code.

Definition in file Format.h.