|
@@ -39,18 +39,16 @@ public:
|
|
|
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;
|
|
@@ -62,7 +60,6 @@ public:
|
|
|
SmallString<16> SearchPath;
|
|
|
SmallString<16> RelativePath;
|
|
|
const Module* Imported;
|
|
|
- SrcMgr::CharacteristicKind FileType;
|
|
|
};
|
|
|
|
|
|
// Stub to collect data from PragmaOpenCLExtension callbacks.
|
|
@@ -141,13 +138,6 @@ protected:
|
|
|
// 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)));
|
|
@@ -178,7 +168,7 @@ protected:
|
|
|
}
|
|
|
|
|
|
// Callbacks have been executed at this point -- return filename range.
|
|
|
- return Callbacks;
|
|
|
+ return Callbacks->FilenameRange;
|
|
|
}
|
|
|
|
|
|
PragmaOpenCLExtensionCallbacks::CallbackParameters
|
|
@@ -232,15 +222,6 @@ protected:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-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";
|