2020-02-26 01:41:32 +08:00
|
|
|
//===--- FileExtensionsUtils.h - clang-tidy --------------------*- C++ -*-===//
|
2016-02-05 19:23:59 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-02-05 19:23:59 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-03-10 01:56:10 +08:00
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FILE_EXTENSIONS_UTILS_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FILE_EXTENSIONS_UTILS_H
|
2016-02-05 19:23:59 +08:00
|
|
|
|
|
|
|
#include "clang/Basic/SourceLocation.h"
|
|
|
|
#include "clang/Basic/SourceManager.h"
|
2020-03-10 22:34:34 +08:00
|
|
|
#include "llvm/ADT/Optional.h"
|
2016-02-05 19:23:59 +08:00
|
|
|
#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 {
|
|
|
|
|
2020-02-26 01:41:32 +08:00
|
|
|
typedef llvm::SmallSet<llvm::StringRef, 5> FileExtensionsSet;
|
2016-02-05 19:23:59 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Checks whether expansion location of \p Loc is in header file.
|
2020-02-26 01:41:32 +08:00
|
|
|
bool isExpansionLocInHeaderFile(SourceLocation Loc, const SourceManager &SM,
|
|
|
|
const FileExtensionsSet &HeaderFileExtensions);
|
2016-02-05 19:23:59 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Checks whether presumed location of \p Loc is in header file.
|
2020-02-26 01:41:32 +08:00
|
|
|
bool isPresumedLocInHeaderFile(SourceLocation Loc, SourceManager &SM,
|
|
|
|
const FileExtensionsSet &HeaderFileExtensions);
|
2016-02-05 19:23:59 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Checks whether spelling location of \p Loc is in header file.
|
2020-02-26 01:41:32 +08:00
|
|
|
bool isSpellingLocInHeaderFile(SourceLocation Loc, SourceManager &SM,
|
|
|
|
const FileExtensionsSet &HeaderFileExtensions);
|
2016-02-05 19:23:59 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Returns recommended default value for the list of header file
|
2017-07-20 20:02:03 +08:00
|
|
|
/// extensions.
|
2020-03-05 00:55:03 +08:00
|
|
|
inline StringRef defaultHeaderFileExtensions() { return ";h;hh;hpp;hxx"; }
|
|
|
|
|
2020-04-05 14:28:11 +08:00
|
|
|
/// Returns recommended default value for the list of implementation file
|
2020-03-10 22:34:34 +08:00
|
|
|
/// extensions.
|
|
|
|
inline StringRef defaultImplementationFileExtensions() {
|
|
|
|
return "c;cc;cpp;cxx";
|
|
|
|
}
|
|
|
|
|
2020-03-05 00:55:03 +08:00
|
|
|
/// Returns recommended default value for the list of file extension
|
|
|
|
/// delimiters.
|
|
|
|
inline StringRef defaultFileExtensionDelimiters() { return ",;"; }
|
2017-07-20 20:02:03 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Parses header file extensions from a semicolon-separated list.
|
2020-02-26 01:41:32 +08:00
|
|
|
bool parseFileExtensions(StringRef AllFileExtensions,
|
2020-03-05 00:55:03 +08:00
|
|
|
FileExtensionsSet &FileExtensions,
|
|
|
|
StringRef Delimiters);
|
2016-02-05 19:23:59 +08:00
|
|
|
|
2020-03-10 22:34:34 +08:00
|
|
|
/// Decides whether a file has a header file extension.
|
|
|
|
/// Returns the file extension, if included in the provided set.
|
|
|
|
llvm::Optional<StringRef>
|
|
|
|
getFileExtension(StringRef FileName, const FileExtensionsSet &FileExtensions);
|
|
|
|
|
2020-02-26 01:41:32 +08:00
|
|
|
/// Decides whether a file has one of the specified file extensions.
|
|
|
|
bool isFileExtension(StringRef FileName,
|
|
|
|
const FileExtensionsSet &FileExtensions);
|
2016-08-26 13:59:53 +08:00
|
|
|
|
2016-02-05 19:23:59 +08:00
|
|
|
} // namespace utils
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|
|
|
|
|
2020-03-10 01:56:10 +08:00
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FILE_EXTENSIONS_UTILS_H
|