/// \param Imported The module, whenever an inclusion directive was
/// automatically turned into a module import or null otherwise.
///
- /// \param FileType The characteristic kind, indicates whether a file or
- /// directory holds normal user code, system code, or system code which is
- /// implicitly 'extern "C"' in C++ mode.
- ///
virtual void InclusionDirective(SourceLocation HashLoc,
const Token &IncludeTok,
StringRef FileName,
const FileEntry *File,
StringRef SearchPath,
StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) {
+ const Module *Imported) {
}
/// Callback invoked whenever there was an explicit module-import
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override {
+ const Module *Imported) override {
First->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled,
FilenameRange, File, SearchPath, RelativePath,
- Imported, FileType);
+ Imported);
Second->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled,
FilenameRange, File, SearchPath, RelativePath,
- Imported, FileType);
+ Imported);
}
void moduleImport(SourceLocation ImportLoc, ModuleIdPath Path,
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange,
const FileEntry *File, StringRef SearchPath,
- StringRef RelativePath, const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override;
+ StringRef RelativePath,
+ const Module *Imported) override;
void Ifdef(SourceLocation Loc, const Token &MacroNameTok,
const MacroDefinition &MD) override;
void Ifndef(SourceLocation Loc, const Token &MacroNameTok,
void MacroPPCallbacks::InclusionDirective(
SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName,
bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File,
- StringRef SearchPath, StringRef RelativePath, const Module *Imported,
- SrcMgr::CharacteristicKind FileType) {
+ StringRef SearchPath, StringRef RelativePath, const Module *Imported) {
// Record the line location of the current included file.
LastHashLoc = HashLoc;
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override;
+ const Module *Imported) override;
/// Hook called whenever a macro definition is seen.
void MacroDefined(const Token &MacroNameTok,
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override {
+ const Module *Imported) override {
if (!File)
DepCollector.maybeAddDependency(FileName, /*FromModule*/false,
/*IsSystem*/false, /*IsModuleFile*/false,
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override;
+ const Module *Imported) override;
void EndOfMainFile() override {
OutputDependencyFile();
const FileEntry *File,
StringRef SearchPath,
StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) {
+ const Module *Imported) {
if (!File) {
if (AddMissingHeaderDeps)
AddFilename(FileName);
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override;
+ const Module *Imported) override;
void EndOfMainFile() override {
OutputGraphFile();
SysRoot));
}
-void DependencyGraphCallback::InclusionDirective(
- SourceLocation HashLoc,
- const Token &IncludeTok,
- StringRef FileName,
- bool IsAngled,
- CharSourceRange FilenameRange,
- const FileEntry *File,
- StringRef SearchPath,
- StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) {
+void DependencyGraphCallback::InclusionDirective(SourceLocation HashLoc,
+ const Token &IncludeTok,
+ StringRef FileName,
+ bool IsAngled,
+ CharSourceRange FilenameRange,
+ const FileEntry *File,
+ StringRef SearchPath,
+ StringRef RelativePath,
+ const Module *Imported) {
if (!File)
return;
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override {
+ const Module *Imported) override {
if (!File)
return;
Collector.addFile(File->getName());
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override;
+ const Module *Imported) override;
void Ident(SourceLocation Loc, StringRef str) override;
void PragmaMessage(SourceLocation Loc, StringRef Namespace,
PragmaMessageKind Kind, StringRef Str) override;
}
}
-void PrintPPOutputPPCallbacks::InclusionDirective(
- SourceLocation HashLoc,
- const Token &IncludeTok,
- StringRef FileName,
- bool IsAngled,
- CharSourceRange FilenameRange,
- const FileEntry *File,
- StringRef SearchPath,
- StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) {
+void PrintPPOutputPPCallbacks::InclusionDirective(SourceLocation HashLoc,
+ const Token &IncludeTok,
+ StringRef FileName,
+ bool IsAngled,
+ CharSourceRange FilenameRange,
+ const FileEntry *File,
+ StringRef SearchPath,
+ StringRef RelativePath,
+ const Module *Imported) {
// In -dI mode, dump #include directives prior to dumping their content or
// interpretation.
if (DumpIncludeDirectives) {
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override;
+ const Module *Imported) override;
void WriteLineInfo(StringRef Filename, int Line,
SrcMgr::CharacteristicKind FileType,
StringRef Extra = StringRef());
const FileEntry * /*File*/,
StringRef /*SearchPath*/,
StringRef /*RelativePath*/,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType){
+ const Module *Imported) {
if (Imported) {
auto P = ModuleIncludes.insert(
std::make_pair(HashLoc.getRawEncoding(), Imported));
HashLoc, IncludeTok,
LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, isAngled,
FilenameRange, File, SearchPath, RelativePath,
- ShouldEnter ? nullptr : SuggestedModule.getModule(), FileCharacter);
+ ShouldEnter ? nullptr : SuggestedModule.getModule());
if (SkipHeader && !SuggestedModule.getModule())
Callbacks->FileSkipped(*File, FilenameTok, FileCharacter);
}
const FileEntry *File,
StringRef SearchPath,
StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) {
+ const Module *Imported) {
InclusionDirective::InclusionKind Kind = InclusionDirective::Include;
switch (IncludeTok.getIdentifierInfo()->getPPKeywordID()) {
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override {
+ const Module *Imported) override {
bool isImport = (IncludeTok.is(tok::identifier) &&
IncludeTok.getIdentifierInfo()->getPPKeywordID() == tok::pp_import);
DataConsumer.ppIncludedFile(HashLoc, FileName, File, isImport, IsAngled,
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
- SrcMgr::CharacteristicKind FileType) override {
- this->HashLoc = HashLoc;
- this->IncludeTok = IncludeTok;
- this->FileName = FileName.str();
- this->IsAngled = IsAngled;
- this->FilenameRange = FilenameRange;
- this->File = File;
- this->SearchPath = SearchPath.str();
- this->RelativePath = RelativePath.str();
- this->Imported = Imported;
- this->FileType = FileType;
+ const Module *Imported) override {
+ this->HashLoc = HashLoc;
+ this->IncludeTok = IncludeTok;
+ this->FileName = FileName.str();
+ this->IsAngled = IsAngled;
+ this->FilenameRange = FilenameRange;
+ this->File = File;
+ this->SearchPath = SearchPath.str();
+ this->RelativePath = RelativePath.str();
+ this->Imported = Imported;
}
SourceLocation HashLoc;
SmallString<16> SearchPath;
SmallString<16> RelativePath;
const Module* Imported;
- SrcMgr::CharacteristicKind FileType;
};
// Stub to collect data from PragmaOpenCLExtension callbacks.
// the InclusionDirective callback.
CharSourceRange InclusionDirectiveFilenameRange(const char* SourceText,
const char* HeaderPath, bool SystemHeader) {
- return InclusionDirectiveCallback(SourceText, HeaderPath, SystemHeader)
- ->FilenameRange;
- }
-
- InclusionDirectiveCallbacks *
- InclusionDirectiveCallback(const char *SourceText, const char *HeaderPath,
- bool SystemHeader) {
std::unique_ptr<llvm::MemoryBuffer> Buf =
llvm::MemoryBuffer::getMemBuffer(SourceText);
SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(Buf)));
}
// Callbacks have been executed at this point -- return filename range.
- return Callbacks;
+ return Callbacks->FilenameRange;
}
PragmaOpenCLExtensionCallbacks::CallbackParameters
}
};
-TEST_F(PPCallbacksTest, UserFileCharacteristics) {
- const char *Source = "#include \"quoted.h\"\n";
-
- SrcMgr::CharacteristicKind Kind =
- InclusionDirectiveCallback(Source, "/quoted.h", false)->FileType;
-
- ASSERT_EQ(SrcMgr::CharacteristicKind::C_User, Kind);
-}
-
TEST_F(PPCallbacksTest, QuotedFilename) {
const char* Source =
"#include \"quoted.h\"\n";