|
clang
5.0.0
|
This file implements functions declared in Format.h. More...
#include "clang/Format/Format.h"#include "AffectedRangeManager.h"#include "ContinuationIndenter.h"#include "FormatTokenLexer.h"#include "NamespaceEndCommentsFixer.h"#include "SortJavaScriptImports.h"#include "TokenAnalyzer.h"#include "TokenAnnotator.h"#include "UnwrappedLineFormatter.h"#include "UnwrappedLineParser.h"#include "UsingDeclarationsSorter.h"#include "WhitespaceManager.h"#include "clang/Basic/Diagnostic.h"#include "clang/Basic/DiagnosticOptions.h"#include "clang/Basic/SourceManager.h"#include "clang/Basic/VirtualFileSystem.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 <algorithm>#include <memory>#include <string>Go to the source code of this file.
Namespaces | |
| llvm | |
| DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterators. | |
| llvm::yaml | |
| clang | |
| /file This file defines classes for searching and anlyzing source code clones. | |
| 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) |
| llvm::Error | clang::format::make_string_error (const llvm::Twine &Message) |
| 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 std::pair< unsigned, unsigned > | clang::format::FindCursorIndex (const SmallVectorImpl< IncludeDirective > &Includes, const SmallVectorImpl< unsigned > &Indices, unsigned Cursor) |
| static void | clang::format::sortCppIncludes (const FormatStyle &Style, const SmallVectorImpl< IncludeDirective > &Includes, ArrayRef< tooling::Range > Ranges, StringRef FileName, tooling::Replacements &Replaces, unsigned *Cursor) |
| tooling::Replacements | clang::format::sortCppIncludes (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, tooling::Replacements &Replaces, unsigned *Cursor) |
| bool | clang::format::isMpegTS (StringRef Code) |
| 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... | |
| template<typename T > | |
| static llvm::Expected < tooling::Replacements > | clang::format::processReplacements (T ProcessFunc, StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style) |
| llvm::Expected < tooling::Replacements > | clang::format::formatReplacements (StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style) |
Returns the replacements corresponding to applying and formatting Replaces on success; otheriwse, return an llvm::Error carrying llvm::StringError. More... | |
| llvm::Expected < tooling::Replacements > | clang::format::cleanupAroundReplacements (StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style) |
Returns the replacements corresponding to applying Replaces and cleaning up the code after that on success; otherwise, return an llvm::Error carrying llvm::StringError. More... | |
| tooling::Replacements | clang::format::reformat (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>", FormattingAttemptStatus *Status=nullptr) |
Reformats the given Ranges in Code. More... | |
| tooling::Replacements | clang::format::cleanup (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>") |
Clean up any erroneous/redundant code in the given Ranges in Code. More... | |
| tooling::Replacements | clang::format::reformat (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName, bool *IncompleteFormat) |
Same as above, except if IncompleteFormat is non-null, its value will be set to true if any of the affected ranges were not formatted due to a non-recoverable syntax error. More... | |
| tooling::Replacements | clang::format::fixNamespaceEndComments (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>") |
Fix namespace end comments in the given Ranges in Code. More... | |
| tooling::Replacements | clang::format::sortUsingDeclarations (const FormatStyle &Style, StringRef Code, ArrayRef< tooling::Range > Ranges, StringRef FileName="<stdin>") |
Sort consecutive using declarations in 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) |
| llvm::Expected< FormatStyle > | clang::format::getStyle (StringRef StyleName, StringRef FileName, StringRef FallbackStyle, StringRef Code="", vfs::FileSystem *FS=nullptr) |
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 43 of file Format.cpp.
| bool BinPackInconclusiveFunctions |
Definition at line 1072 of file Format.cpp.
| int Category |
Definition at line 1304 of file Format.cpp.
Referenced by clang::Sema::ActOnPropertyImplDecl(), clang::Sema::ActOnStartCategoryInterface(), AddObjCProperties(), checkAtomicPropertyMismatch(), CheckForIncompatibleAttributes(), clang::Sema::CodeCompleteObjCInterfaceCategory(), clang::Sema::CodeCompleteObjCMethodDecl(), clang::Sema::CodeCompleteObjCPropertyGetter(), clang::Sema::CodeCompleteObjCPropertySetter(), CollectOverriddenMethodsRecurse(), clang::ento::BugReporter::EmitBasicReport(), FindImplementableMethods(), clang::ObjCMethodDecl::findPropertyDecl(), hasWrittenStorageAttribute(), clang::CodeGen::CodeGenModule::isInSanitizerBlacklist(), LookupMemberExpr(), LookupVisibleDecls(), clang::ento::PathDiagnostic::Profile(), clang::format::sortCppIncludes(), and clang::ASTNodeImporter::VisitObjCCategoryImplDecl().
| SmallVector<llvm::Regex, 4> CategoryRegexs |
Definition at line 1467 of file Format.cpp.
| std::set<FormatToken *, FormatTokenLess> DeletedTokens |
Definition at line 1297 of file Format.cpp.
| StringRef Filename |
Definition at line 1301 of file Format.cpp.
Referenced by clang::MemoryBufferCache::addBuffer(), adjustFilenameForRelocatableAST(), clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P(), clang::FrontendAction::BeginSourceFile(), clang::PrecompiledPreamble::Build(), clang::ModuleMap::diagnoseHeaderInclusion(), clang::CodeGen::CodeGenFunction::EmitCheckSourceLocation(), clang::BackendConsumer::EmitOptimizationMessage(), EnableCodeCompletion(), EvaluateHasIncludeCommon(), clang::LineEntry::get(), clang::FileManager::getBufferForFile(), clang::SourceManager::getPresumedLoc(), clang::Preprocessor::HandlePragmaDependency(), clang::FilenamePatternConstraint::isAutoGenerated(), isBuiltinFile(), isCommandLineFile(), isSpecialFilename(), clang::HeaderSearch::LookupFile(), MakeCLOutputFilename(), ParseDirective(), PrintFilename(), clang::serialization::reader::HeaderFileInfoTrait::ReadData(), clang::ASTReader::ReadPath(), clang::format::sortCppIncludes(), clang::BackendConsumer::UnsupportedDiagHandler(), clang::CXXRecordDecl::viewInheritance(), clang::FixItRewriter::WriteFixedFiles(), and clang::driver::XRayArgs::XRayArgs().
| StringRef FileName |
Definition at line 1465 of file Format.cpp.
Referenced by clang::format::cleanupAroundReplacements(), clang::driver::CudaInstallationDetector::CudaInstallationDetector(), clang::serialization::ModuleFile::dump(), clang::format::formatReplacements(), clang::HeaderSearch::getModuleFileName(), clang::HeaderSearch::hasModuleMap(), clang::ModuleMap::isBuiltinHeader(), clang::CompilerInstance::loadModuleFile(), and clang::driver::Command::setResponseFile().
| StringRef FileStem |
Definition at line 1466 of file Format.cpp.
| bool IsMainFile |
Definition at line 1464 of file Format.cpp.
Definition at line 1303 of file Format.cpp.
| const SourceManager& SM |
Definition at line 1293 of file Format.cpp.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), clang::ASTUnit::addFileLevelDecl(), addFixitForObjCARCConversion(), clang::arcmt::trans::MigrationContext::addPropertyAttribute(), clang::GCCAsmStmt::AnalyzeAsmString(), clang::tooling::Replacement::apply(), applyCocoaAPICheck(), applyEditsToTemp(), clang::CodeGen::CodeGenPGO::assignRegionCounters(), clang::ento::ProgramState::assumeInBound(), clang::FrontendAction::BeginSourceFile(), clang::CFGStmtMap::Build(), clang::ObjCMethodCall::canBeOverridenInSubclass(), checkAndSanitizeDiags(), checkObjCUnusedIvar(), compare(), comparePiece(), clang::ento::PathDiagnosticCallPiece::construct(), clang::StmtSequence::contains(), clang::Lexer::Create_PragmaLexer(), clang::ento::PathDiagnosticLocation::createBegin(), clang::ento::PathDiagnosticLocation::createConditionalColonLoc(), clang::ento::PathDiagnosticLocation::createEndOfPath(), clang::ento::PathDiagnosticLocation::createMemberLoc(), clang::ento::PathDiagnosticLocation::createOperatorLoc(), clang::DoRewriteTest(), clang::CodeGen::CodeGenModule::EmitAnnotationLineNo(), clang::CodeGen::CodeGenModule::EmitAnnotationUnit(), clang::CodeGen::CoverageMappingGen::emitCounterMapping(), clang::CodeGen::CoverageMappingGen::emitEmptyMapping(), clang::markup::EmitLocation(), clang::DumpRawTokensAction::ExecuteAction(), clang::PrintPreprocessedAction::ExecuteAction(), clang::arcmt::trans::findSemiAfterLocation(), clang::tooling::formatAndApplyAllReplacements(), GCRewriteFinalize(), GenerateAlternateExtensivePathDiagnostic(), clang::ento::GRBugReporter::generatePathDiagnostic(), clang::index::generateUSRForMacro(), clang::Lexer::getAsCharRange(), getAsmSrcLocInfo(), getAsPointeeSymbol(), clang::CFGStmtMap::getBlock(), clang::ento::LikelyFalsePositiveSuppressionBRVisitor::getEndPath(), clang::ASTUnit::getLocation(), getLocationForCaller(), clang::ento::ProgramState::getLValue(), clang::clone_detection::getMacroStack(), GetMappedTokenLoc(), clang::Preprocessor::getModuleHeaderToIncludeForDiagnostics(), clang::tooling::getNamedDeclAt(), clang::FunctionDecl::getReturnTypeSourceRange(), getTargetEntryUniqueInfo(), clang::VerifyDiagnosticConsumer::HandleComment(), clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::html::HighlightMacros(), clang::html::HighlightRange(), clang::index::IndexingContext::importedModule(), clang::TokenLexer::Init(), clang::FilenamePatternConstraint::isAutoGenerated(), isEmptyARCMTMacroStatement(), isExpandedFromConfigurationMacro(), clang::CodeGen::CodeGenModule::isInSanitizerBlacklist(), clang::ento::CallEvent::isInSystemHeader(), clang::TokenLexer::Lex(), LexRawTokensFromMainFile(), LocPropertyAttribute(), makeStandaloneDiagnostic(), clang::BeforeThanCompare< RawComment >::operator()(), clang::BeforeThanCompare< SourceLocation >::operator()(), clang::BeforeThanCompare< SourceRange >::operator()(), ReadLineMarkerFlags(), ReportEvent(), clang::RewriteIncludesInInput(), clang::RewriteMacrosInInput(), clang::arcmt::trans::MigrationContext::rewritePropertyAttribute(), clang::ento::PathDiagnosticCallPiece::setCallee(), clang::CodeGen::CGDebugInfo::setLocation(), clang::Rewriter::setSourceMgr(), clang::html::SyntaxHighlight(), and clang::arcmt::trans::BlockObjCVariableTraverser::traverseBody().
| FormattingAttemptStatus* Status |
Definition at line 1073 of file Format.cpp.
Referenced by clang::serialization::ModuleManager::addModule(), clang::PrecompiledPreamble::CanReuse(), clang::driver::tools::Clang::ConstructJob(), clang::vfs::Status::copyWithNewName(), clang::CompilerInstance::createOutputFile(), EvaluateBuiltinConstantP(), clang::Expr::EvaluateWithSubstitution(), clang::driver::ForceSuccessCommand::Execute(), findDirectives(), clang::FileSystemStatCache::get(), clang::format::getStyle(), clang::Expr::isCXX11ConstantExpr(), clang::Expr::isPotentialConstantExpr(), clang::Expr::isPotentialConstantExprUnevaluated(), clang::format::reformat(), and clang::Expr::tryEvaluateObjectSize().
| const FormatStyle& Style |
Definition at line 1463 of file Format.cpp.
Referenced by clang::VarDecl::setInitStyle().
| StringRef Text |
Definition at line 1302 of file Format.cpp.
Referenced by clang::format::encoding::columnWidthWithTabs(), clang::format::BreakableComment::compressWhitespace(), clang::format::configurationAsText(), clang::VerifyDiagnosticConsumer::Directive::create(), clang::tooling::createRenameAtomicChanges(), clang::ASTContext::getRawCommentForDeclNoCache(), clang::tooling::AtomicChange::insert(), clang::format::BreakableBlockComment::insertBreak(), clang::format::BreakableLineCommentSection::insertBreak(), ParseDirective(), clang::comments::Parser::parseVerbatimLine(), shouldWarnOnMacroDef(), and shouldWarnOnMacroUndef().
1.8.6