clang 20.0.0git
Public Member Functions | List of all members
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 191 of file HeaderIncludes.cpp.

References Category, and clang::FileName.

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 0. Otherwise, returns the priority of the matching category or INT_MAX. NOTE: this API is not thread-safe!

Definition at line 209 of file HeaderIncludes.cpp.

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

Referenced by clang::tooling::HeaderIncludes::insert(), and clang::format::sortCppIncludes().

◆ getSortIncludePriority()

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

Definition at line 222 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: