Reland "[tools] Updating PPCallbacks::InclusionDirective calls"

This commit relands r331905.

r331904 added SrcMgr::CharacteristicKind to the InclusionDirective
callback, this revision updates instances of it in clang-tools-extra.

llvm-svn: 332023
This commit is contained in:
Julie Hockett 2018-05-10 19:13:14 +00:00
parent a3686c9a28
commit 546943f9f1
10 changed files with 24 additions and 13 deletions

View File

@ -131,7 +131,8 @@ public:
clang::CharSourceRange FilenameRange,
const clang::FileEntry * /*File*/,
StringRef SearchPath, StringRef /*RelativePath*/,
const clang::Module * /*Imported*/) override {
const clang::Module * /*Imported*/,
SrcMgr::CharacteristicKind /*FileType*/) override {
if (const auto *FileEntry = SM.getFileEntryForID(SM.getFileID(HashLoc)))
MoveTool->addIncludes(FileName, IsAngled, SearchPath,
FileEntry->getName(), FilenameRange, SM);

View File

@ -28,7 +28,8 @@ public:
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
const Module *Imported) override;
const Module *Imported,
SrcMgr::CharacteristicKind FileType) override;
void EndOfMainFile() override;
private:
@ -76,7 +77,8 @@ static int getPriority(StringRef Filename, bool IsAngled, bool IsMainModule) {
void IncludeOrderPPCallbacks::InclusionDirective(
SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName,
bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath, const Module *Imported) {
StringRef SearchPath, StringRef RelativePath, const Module *Imported,
SrcMgr::CharacteristicKind FileType) {
// We recognize the first include as a special main module header and want
// to leave it in the top position.
IncludeDirective ID = {HashLoc, FilenameRange, FileName, IsAngled, false};

View File

@ -30,7 +30,8 @@ public:
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
const Module *Imported) override;
const Module *Imported,
SrcMgr::CharacteristicKind FileType) override;
private:
ClangTidyCheck &Check;
@ -94,7 +95,8 @@ IncludeModernizePPCallbacks::IncludeModernizePPCallbacks(ClangTidyCheck &Check,
void IncludeModernizePPCallbacks::InclusionDirective(
SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName,
bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath, const Module *Imported) {
StringRef SearchPath, StringRef RelativePath, const Module *Imported,
SrcMgr::CharacteristicKind FileType) {
// FIXME: Take care of library symbols from the global namespace.
//
// Reasonable options for the check:

View File

@ -25,7 +25,8 @@ public:
bool IsAngled, CharSourceRange FileNameRange,
const FileEntry * /*IncludedFile*/,
StringRef /*SearchPath*/, StringRef /*RelativePath*/,
const Module * /*ImportedModule*/) override {
const Module * /*ImportedModule*/,
SrcMgr::CharacteristicKind /*FileType*/) override {
Inserter->AddInclude(FileNameRef, IsAngled, HashLocation,
IncludeToken.getEndLoc());
}

View File

@ -93,7 +93,8 @@ public:
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
const Module *Imported) override {
const Module *Imported,
SrcMgr::CharacteristicKind FileType) override {
auto SR = FilenameRange.getAsRange();
if (SR.isInvalid() || !File || File->tryGetRealPathName().empty())
return;

View File

@ -34,7 +34,8 @@ public:
CharSourceRange /*FilenameRange*/,
const FileEntry *File, llvm::StringRef /*SearchPath*/,
llvm::StringRef /*RelativePath*/,
const Module * /*Imported*/) override {
const Module * /*Imported*/,
SrcMgr::CharacteristicKind /*FileType*/) override {
WrittenHeaders.insert(
(IsAngled ? "<" + FileName + ">" : "\"" + FileName + "\"").str());
if (File != nullptr && !File->tryGetRealPathName().empty())

View File

@ -90,7 +90,8 @@ public:
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
const Module *Imported) override {
const Module *Imported,
SrcMgr::CharacteristicKind FileType) override {
Checker.collectUmbrellaHeaderHeader(File->getName());
}

View File

@ -750,7 +750,8 @@ public:
const clang::FileEntry *File,
llvm::StringRef SearchPath,
llvm::StringRef RelativePath,
const clang::Module *Imported) override;
const clang::Module *Imported,
clang::SrcMgr::CharacteristicKind FileType) override;
void FileChanged(clang::SourceLocation Loc,
clang::PPCallbacks::FileChangeReason Reason,
clang::SrcMgr::CharacteristicKind FileType,
@ -1289,7 +1290,7 @@ void PreprocessorCallbacks::InclusionDirective(
llvm::StringRef FileName, bool IsAngled,
clang::CharSourceRange FilenameRange, const clang::FileEntry *File,
llvm::StringRef SearchPath, llvm::StringRef RelativePath,
const clang::Module *Imported) {
const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) {
int DirectiveLine, DirectiveColumn;
std::string HeaderPath = getSourceLocationFile(PP, HashLoc);
getSourceLocationLineAndColumn(PP, HashLoc, DirectiveLine, DirectiveColumn);

View File

@ -139,7 +139,7 @@ void PPCallbacksTracker::InclusionDirective(
llvm::StringRef FileName, bool IsAngled,
clang::CharSourceRange FilenameRange, const clang::FileEntry *File,
llvm::StringRef SearchPath, llvm::StringRef RelativePath,
const clang::Module *Imported) {
const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) {
beginCallback("InclusionDirective");
appendArgument("IncludeTok", IncludeTok);
appendFilePathArgument("FileName", FileName);

View File

@ -102,7 +102,8 @@ public:
const clang::FileEntry *File,
llvm::StringRef SearchPath,
llvm::StringRef RelativePath,
const clang::Module *Imported) override;
const clang::Module *Imported,
clang::SrcMgr::CharacteristicKind FileType) override;
void moduleImport(clang::SourceLocation ImportLoc, clang::ModuleIdPath Path,
const clang::Module *Imported) override;
void EndOfMainFile() override;