2016-02-05 19:23:59 +08:00
|
|
|
//===--- HeaderFileExtensionsUtils.h - clang-tidy----------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
|
|
|
|
|
|
|
|
#include "clang/Basic/SourceLocation.h"
|
|
|
|
#include "clang/Basic/SourceManager.h"
|
|
|
|
#include "llvm/ADT/SmallSet.h"
|
2016-08-26 13:59:53 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2016-02-05 19:23:59 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
namespace utils {
|
|
|
|
|
|
|
|
typedef llvm::SmallSet<llvm::StringRef, 5> HeaderFileExtensionsSet;
|
|
|
|
|
2016-06-17 19:43:33 +08:00
|
|
|
/// \brief Checks whether expansion location of \p Loc is in header file.
|
2016-02-05 19:23:59 +08:00
|
|
|
bool isExpansionLocInHeaderFile(
|
|
|
|
SourceLocation Loc, const SourceManager &SM,
|
|
|
|
const HeaderFileExtensionsSet &HeaderFileExtensions);
|
|
|
|
|
2016-06-17 19:43:33 +08:00
|
|
|
/// \brief Checks whether presumed location of \p Loc is in header file.
|
2016-02-05 19:23:59 +08:00
|
|
|
bool isPresumedLocInHeaderFile(
|
|
|
|
SourceLocation Loc, SourceManager &SM,
|
|
|
|
const HeaderFileExtensionsSet &HeaderFileExtensions);
|
|
|
|
|
2016-06-17 19:43:33 +08:00
|
|
|
/// \brief Checks whether spelling location of \p Loc is in header file.
|
2016-02-05 19:23:59 +08:00
|
|
|
bool isSpellingLocInHeaderFile(
|
|
|
|
SourceLocation Loc, SourceManager &SM,
|
|
|
|
const HeaderFileExtensionsSet &HeaderFileExtensions);
|
|
|
|
|
2017-07-20 20:02:03 +08:00
|
|
|
/// \brief Returns recommended default value for the list of header file
|
|
|
|
/// extensions.
|
|
|
|
inline StringRef defaultHeaderFileExtensions() { return ",h,hh,hpp,hxx"; }
|
|
|
|
|
2016-02-05 19:23:59 +08:00
|
|
|
/// \brief Parses header file extensions from a semicolon-separated list.
|
|
|
|
bool parseHeaderFileExtensions(StringRef AllHeaderFileExtensions,
|
|
|
|
HeaderFileExtensionsSet &HeaderFileExtensions,
|
|
|
|
char delimiter);
|
|
|
|
|
2016-08-26 13:59:53 +08:00
|
|
|
/// \brief Decides whether a file has a header file extension.
|
|
|
|
bool isHeaderFileExtension(StringRef FileName,
|
2016-08-26 19:15:38 +08:00
|
|
|
const HeaderFileExtensionsSet &HeaderFileExtensions);
|
2016-08-26 13:59:53 +08:00
|
|
|
|
2016-02-05 19:23:59 +08:00
|
|
|
} // namespace utils
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|
|
|
|
|
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
|