Skip to content

Commit 4e548fe

Browse files
author
Julie Hockett
committedMay 9, 2018
[tools] Updating PPCallbacks::InclusionDirective calls
[revision] added SrcMgr::CharacteristicKind to the InclusionDirective callback, this revision updates instances of it in clang-tools-extra. Differential Revision: https://reviews.llvm.org/D46615 llvm-svn: 331905
1 parent 36d94ab commit 4e548fe

File tree

10 files changed

+24
-13
lines changed

10 files changed

+24
-13
lines changed
 

Diff for: ‎clang-tools-extra/clang-move/ClangMove.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ class FindAllIncludes : public clang::PPCallbacks {
131131
clang::CharSourceRange FilenameRange,
132132
const clang::FileEntry * /*File*/,
133133
StringRef SearchPath, StringRef /*RelativePath*/,
134-
const clang::Module * /*Imported*/) override {
134+
const clang::Module * /*Imported*/,
135+
SrcMgr::CharacteristicKind /*FileType*/) override {
135136
if (const auto *FileEntry = SM.getFileEntryForID(SM.getFileID(HashLoc)))
136137
MoveTool->addIncludes(FileName, IsAngled, SearchPath,
137138
FileEntry->getName(), FilenameRange, SM);

Diff for: ‎clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class IncludeOrderPPCallbacks : public PPCallbacks {
2828
StringRef FileName, bool IsAngled,
2929
CharSourceRange FilenameRange, const FileEntry *File,
3030
StringRef SearchPath, StringRef RelativePath,
31-
const Module *Imported) override;
31+
const Module *Imported,
32+
SrcMgr::CharacteristicKind FileType) override;
3233
void EndOfMainFile() override;
3334

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

Diff for: ‎clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class IncludeModernizePPCallbacks : public PPCallbacks {
3030
StringRef FileName, bool IsAngled,
3131
CharSourceRange FilenameRange, const FileEntry *File,
3232
StringRef SearchPath, StringRef RelativePath,
33-
const Module *Imported) override;
33+
const Module *Imported,
34+
SrcMgr::CharacteristicKind FileType) override;
3435

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

Diff for: ‎clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class IncludeInserterCallback : public PPCallbacks {
2525
bool IsAngled, CharSourceRange FileNameRange,
2626
const FileEntry * /*IncludedFile*/,
2727
StringRef /*SearchPath*/, StringRef /*RelativePath*/,
28-
const Module * /*ImportedModule*/) override {
28+
const Module * /*ImportedModule*/,
29+
SrcMgr::CharacteristicKind /*FileType*/) override {
2930
Inserter->AddInclude(FileNameRef, IsAngled, HashLocation,
3031
IncludeToken.getEndLoc());
3132
}

Diff for: ‎clang-tools-extra/clangd/ClangdUnit.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ class InclusionLocationsCollector : public PPCallbacks {
9393
StringRef FileName, bool IsAngled,
9494
CharSourceRange FilenameRange, const FileEntry *File,
9595
StringRef SearchPath, StringRef RelativePath,
96-
const Module *Imported) override {
96+
const Module *Imported,
97+
SrcMgr::CharacteristicKind FileType) override {
9798
auto SR = FilenameRange.getAsRange();
9899
if (SR.isInvalid() || !File || File->tryGetRealPathName().empty())
99100
return;

Diff for: ‎clang-tools-extra/clangd/Headers.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class RecordHeaders : public PPCallbacks {
3434
CharSourceRange /*FilenameRange*/,
3535
const FileEntry *File, llvm::StringRef /*SearchPath*/,
3636
llvm::StringRef /*RelativePath*/,
37-
const Module * /*Imported*/) override {
37+
const Module * /*Imported*/,
38+
SrcMgr::CharacteristicKind /*FileType*/) override {
3839
WrittenHeaders.insert(
3940
(IsAngled ? "<" + FileName + ">" : "\"" + FileName + "\"").str());
4041
if (File != nullptr && !File->tryGetRealPathName().empty())

Diff for: ‎clang-tools-extra/modularize/CoverageChecker.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ class CoverageCheckerCallbacks : public PPCallbacks {
9090
StringRef FileName, bool IsAngled,
9191
CharSourceRange FilenameRange, const FileEntry *File,
9292
StringRef SearchPath, StringRef RelativePath,
93-
const Module *Imported) override {
93+
const Module *Imported,
94+
SrcMgr::CharacteristicKind FileType) override {
9495
Checker.collectUmbrellaHeaderHeader(File->getName());
9596
}
9697

Diff for: ‎clang-tools-extra/modularize/PreprocessorTracker.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,8 @@ class PreprocessorCallbacks : public clang::PPCallbacks {
750750
const clang::FileEntry *File,
751751
llvm::StringRef SearchPath,
752752
llvm::StringRef RelativePath,
753-
const clang::Module *Imported) override;
753+
const clang::Module *Imported,
754+
clang::SrcMgr::CharacteristicKind FileType) override;
754755
void FileChanged(clang::SourceLocation Loc,
755756
clang::PPCallbacks::FileChangeReason Reason,
756757
clang::SrcMgr::CharacteristicKind FileType,
@@ -1289,7 +1290,7 @@ void PreprocessorCallbacks::InclusionDirective(
12891290
llvm::StringRef FileName, bool IsAngled,
12901291
clang::CharSourceRange FilenameRange, const clang::FileEntry *File,
12911292
llvm::StringRef SearchPath, llvm::StringRef RelativePath,
1292-
const clang::Module *Imported) {
1293+
const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) {
12931294
int DirectiveLine, DirectiveColumn;
12941295
std::string HeaderPath = getSourceLocationFile(PP, HashLoc);
12951296
getSourceLocationLineAndColumn(PP, HashLoc, DirectiveLine, DirectiveColumn);

Diff for: ‎clang-tools-extra/pp-trace/PPCallbacksTracker.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void PPCallbacksTracker::InclusionDirective(
139139
llvm::StringRef FileName, bool IsAngled,
140140
clang::CharSourceRange FilenameRange, const clang::FileEntry *File,
141141
llvm::StringRef SearchPath, llvm::StringRef RelativePath,
142-
const clang::Module *Imported) {
142+
const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) {
143143
beginCallback("InclusionDirective");
144144
appendArgument("IncludeTok", IncludeTok);
145145
appendFilePathArgument("FileName", FileName);

Diff for: ‎clang-tools-extra/pp-trace/PPCallbacksTracker.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ class PPCallbacksTracker : public clang::PPCallbacks {
102102
const clang::FileEntry *File,
103103
llvm::StringRef SearchPath,
104104
llvm::StringRef RelativePath,
105-
const clang::Module *Imported) override;
105+
const clang::Module *Imported,
106+
clang::SrcMgr::CharacteristicKind FileType) override;
106107
void moduleImport(clang::SourceLocation ImportLoc, clang::ModuleIdPath Path,
107108
const clang::Module *Imported) override;
108109
void EndOfMainFile() override;

0 commit comments

Comments
 (0)
Please sign in to comment.