clang 10.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. More...
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 26 of file HeaderIncludes.h.

## Constructor & Destructor Documentation

## ◆ IncludeCategoryManager()

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

Definition at line 177 of file HeaderIncludes.cpp.

References Category, clang::tooling::IncludeStyle::IncludeCategories, and clang::tooling::IncludeStyle::IncludeIsMainSourceRegex.

## 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 193 of file HeaderIncludes.cpp.

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

Referenced by clang::tooling::HeaderIncludes::insert().

## ◆ getSortIncludePriority()

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

Definition at line 206 of file HeaderIncludes.cpp.

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

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

- include/clang/Tooling/Inclusions/HeaderIncludes.h
- lib/Tooling/Inclusions/HeaderIncludes.cpp