diff options
author | Julie Hockett <juliehockett@google.com> | 2018-05-09 22:25:47 +0000 |
---|---|---|
committer | Julie Hockett <juliehockett@google.com> | 2018-05-09 22:25:47 +0000 |
commit | b524d5e5537507f066f2fcdcb24b3be3c9a4c566 (patch) | |
tree | fb6e77eebba31f79c6c6f234c902d2cb46024c7f /clang/unittests/Lex/PPCallbacksTest.cpp | |
parent | 4a4384353221b845eccdb631a0f83c66a2544a3c (diff) | |
download | bcm5719-llvm-b524d5e5537507f066f2fcdcb24b3be3c9a4c566.tar.gz bcm5719-llvm-b524d5e5537507f066f2fcdcb24b3be3c9a4c566.zip |
Revert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"
This reverts commit r331904 because of a memory leak.
llvm-svn: 331932
Diffstat (limited to 'clang/unittests/Lex/PPCallbacksTest.cpp')
-rw-r--r-- | clang/unittests/Lex/PPCallbacksTest.cpp | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/clang/unittests/Lex/PPCallbacksTest.cpp b/clang/unittests/Lex/PPCallbacksTest.cpp index 4f528712aef..67b56a601c7 100644 --- a/clang/unittests/Lex/PPCallbacksTest.cpp +++ b/clang/unittests/Lex/PPCallbacksTest.cpp @@ -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"; |