clang 22.0.0git
clang::tooling::IncludeCategoryManager Class Reference

This class manages priorities of C++ #include categories and calculates priorities for headers. More...

#include "clang/Tooling/Inclusions/HeaderIncludes.h"

Public Member Functions

 IncludeCategoryManager (const IncludeStyle &Style, StringRef FileName)
int getIncludePriority (StringRef IncludeName, bool CheckMainHeader) const
 Returns the priority of the category which IncludeName belongs to.
int getSortIncludePriority (StringRef IncludeName, bool CheckMainHeader) const

Detailed Description

This class manages priorities of C++ #include categories and calculates priorities for headers.

FIXME(ioeric): move this class into implementation file when clang-format's include sorting functions are also moved here.

Definition at line 28 of file HeaderIncludes.h.

Constructor & Destructor Documentation

◆ IncludeCategoryManager()

clang::tooling::IncludeCategoryManager::IncludeCategoryManager ( const IncludeStyle & Style,
StringRef FileName )

Definition at line 212 of file HeaderIncludes.cpp.

References clang::if().

Member Function Documentation

◆ getIncludePriority()

int clang::tooling::IncludeCategoryManager::getIncludePriority ( StringRef IncludeName,
bool CheckMainHeader ) const

Returns the priority of the category which IncludeName belongs to.

If CheckMainHeader is true and IncludeName is a main header, returns

  1. Otherwise, returns the priority of the matching category or INT_MAX. NOTE: this API is not thread-safe!

Definition at line 230 of file HeaderIncludes.cpp.

References INT_MAX, and clang::ast_matchers::match().

Referenced by clang::format::sortCppIncludes().

◆ getSortIncludePriority()

int clang::tooling::IncludeCategoryManager::getSortIncludePriority ( StringRef IncludeName,
bool CheckMainHeader ) const

Definition at line 243 of file HeaderIncludes.cpp.

References INT_MAX, and clang::ast_matchers::match().

Referenced by clang::format::sortCppIncludes().


The documentation for this class was generated from the following files: