blob: 70bdc81209197fe8961963e2b10ee4eb443cd00f [file] [log] [blame]
Haojian Wuc2d75772016-02-05 11:23:59 +00001//===--- HeaderFileExtensionsUtils.h - clang-tidy----------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
12
Haojian Wuc2d75772016-02-05 11:23:59 +000013#include "clang/Basic/SourceLocation.h"
14#include "clang/Basic/SourceManager.h"
15#include "llvm/ADT/StringRef.h"
16#include "llvm/ADT/SmallSet.h"
Haojian Wuc2d75772016-02-05 11:23:59 +000017
18namespace clang {
19namespace tidy {
20namespace utils {
21
22typedef llvm::SmallSet<llvm::StringRef, 5> HeaderFileExtensionsSet;
23
Alexander Kornienkoc9c82902016-06-17 11:43:33 +000024/// \brief Checks whether expansion location of \p Loc is in header file.
Haojian Wuc2d75772016-02-05 11:23:59 +000025bool isExpansionLocInHeaderFile(
26 SourceLocation Loc, const SourceManager &SM,
27 const HeaderFileExtensionsSet &HeaderFileExtensions);
28
Alexander Kornienkoc9c82902016-06-17 11:43:33 +000029/// \brief Checks whether presumed location of \p Loc is in header file.
Haojian Wuc2d75772016-02-05 11:23:59 +000030bool isPresumedLocInHeaderFile(
31 SourceLocation Loc, SourceManager &SM,
32 const HeaderFileExtensionsSet &HeaderFileExtensions);
33
Alexander Kornienkoc9c82902016-06-17 11:43:33 +000034/// \brief Checks whether spelling location of \p Loc is in header file.
Haojian Wuc2d75772016-02-05 11:23:59 +000035bool isSpellingLocInHeaderFile(
36 SourceLocation Loc, SourceManager &SM,
37 const HeaderFileExtensionsSet &HeaderFileExtensions);
38
39/// \brief Parses header file extensions from a semicolon-separated list.
40bool parseHeaderFileExtensions(StringRef AllHeaderFileExtensions,
41 HeaderFileExtensionsSet &HeaderFileExtensions,
42 char delimiter);
43
44} // namespace utils
45} // namespace tidy
46} // namespace clang
47
48#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H