10 #include "clang/Basic/CharInfo.h" 11 #include "llvm/Support/Path.h" 18 SourceLocation
Loc,
const SourceManager &SM,
20 SourceLocation ExpansionLoc = SM.getExpansionLoc(Loc);
22 HeaderFileExtensions);
26 SourceLocation
Loc, SourceManager &SM,
28 PresumedLoc PresumedLocation = SM.getPresumedLoc(Loc);
30 HeaderFileExtensions);
34 SourceLocation
Loc, SourceManager &SM,
36 SourceLocation SpellingLoc = SM.getSpellingLoc(Loc);
38 HeaderFileExtensions);
45 AllHeaderFileExtensions.split(Suffixes, delimiter);
46 HeaderFileExtensions.clear();
47 for (StringRef Suffix : Suffixes) {
48 StringRef Extension = Suffix.trim();
49 for (StringRef::const_iterator it = Extension.begin();
50 it != Extension.end(); ++it) {
51 if (!isAlphanumeric(*it))
54 HeaderFileExtensions.insert(Extension);
61 StringRef extension = llvm::sys::path::extension(FileName);
62 if (extension.empty())
65 return HeaderFileExtensions.count(extension.substr(1)) > 0;
SourceLocation Loc
'#' location in the include directive
bool parseHeaderFileExtensions(StringRef AllHeaderFileExtensions, HeaderFileExtensionsSet &HeaderFileExtensions, char delimiter)
Parses header file extensions from a semicolon-separated list.
bool isSpellingLocInHeaderFile(SourceLocation Loc, SourceManager &SM, const HeaderFileExtensionsSet &HeaderFileExtensions)
Checks whether spelling location of Loc is in header file.
bool isPresumedLocInHeaderFile(SourceLocation Loc, SourceManager &SM, const HeaderFileExtensionsSet &HeaderFileExtensions)
Checks whether presumed location of Loc is in header file.
bool isExpansionLocInHeaderFile(SourceLocation Loc, const SourceManager &SM, const HeaderFileExtensionsSet &HeaderFileExtensions)
Checks whether expansion location of Loc is in header file.
llvm::SmallSet< llvm::StringRef, 5 > HeaderFileExtensionsSet
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
bool isHeaderFileExtension(StringRef FileName, const HeaderFileExtensionsSet &HeaderFileExtensions)
Decides whether a file has a header file extension.
static constexpr llvm::StringLiteral Suffixes