2014-03-03 0:04 GMT+01:00 Gautier DI FOLCO <[email protected]>:
> Hi doug.gregor, > > lookupModuleName segfaulted in ModuleManager on "-" FileName when the > FileManager was empty. > > http://llvm-reviews.chandlerc.com/D2920 > > Files: > lib/Serialization/ModuleManager.cpp > unittests/CMakeLists.txt > unittests/Makefile > unittests/Serialization/CMakeLists.txt > unittests/Serialization/ModuleManagerTest.cpp > > Index: lib/Serialization/ModuleManager.cpp > =================================================================== > --- lib/Serialization/ModuleManager.cpp > +++ lib/Serialization/ModuleManager.cpp > @@ -383,7 +383,7 @@ > const FileEntry *&File) { > File = FileMgr.getFile(FileName, /*openFile=*/false, > /*cacheFailure=*/false); > > - if (!File && FileName != "-") { > + if (!File) { > return false; > } > > Index: unittests/CMakeLists.txt > =================================================================== > --- unittests/CMakeLists.txt > +++ unittests/CMakeLists.txt > @@ -12,6 +12,7 @@ > add_subdirectory(Basic) > add_subdirectory(Lex) > add_subdirectory(Driver) > +add_subdirectory(Serialization) > if(CLANG_ENABLE_STATIC_ANALYZER) > add_subdirectory(Frontend) > endif() > Index: unittests/Makefile > =================================================================== > --- unittests/Makefile > +++ unittests/Makefile > @@ -14,7 +14,7 @@ > > IS_UNITTEST_LEVEL := 1 > CLANG_LEVEL := .. > -PARALLEL_DIRS = Basic Lex Driver libclang > +PARALLEL_DIRS = Basic Lex Driver libclang Serialization > > include $(CLANG_LEVEL)/../..//Makefile.config > > Index: unittests/Serialization/CMakeLists.txt > =================================================================== > --- unittests/Serialization/CMakeLists.txt > +++ unittests/Serialization/CMakeLists.txt > @@ -0,0 +1,7 @@ > +add_clang_unittest(clangSerializationTests > + ModuleManagerTest.cpp > + ) > + > +target_link_libraries(clangSerializationTests > + clangSerialization > + ) > Index: unittests/Serialization/ModuleManagerTest.cpp > =================================================================== > --- unittests/Serialization/ModuleManagerTest.cpp > +++ unittests/Serialization/ModuleManagerTest.cpp > @@ -0,0 +1,39 @@ > +//=== unittests/Serialization/ModuleManagerTest.cpp - ModuleManager tests > ===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > > +//===----------------------------------------------------------------------===// > + > +#include "clang/Basic/FileSystemOptions.h" > +#include "clang/Basic/FileManager.h" > +#include "clang/Serialization/ModuleManager.h" > +#include "gtest/gtest.h" > + > +using namespace clang; > + > +namespace { > + > +// Test a lookup of a unknown file when there is no Modules > +TEST(ModuleManager, LookupModuleUnknownFilenameDontFailAtStartup) { > + FileSystemOptions f; > + FileManager m(f); > + serialization::ModuleManager ModuleMgr(m); > + const FileEntry *File = 0; > + ASSERT_FALSE(ModuleMgr.lookupModuleFile("UnknownModuleFile", 1, 1, > File)); > + ASSERT_TRUE(File == NULL); > +} > + > +// Test a lookup of dash file when there is no Modules > +TEST(ModuleManager, LookupModuleDashFilenameDontFailAtStartup) { > + FileSystemOptions f; > + FileManager m(f); > + serialization::ModuleManager ModuleMgr(m); > + const FileEntry *File = 0; > + ASSERT_FALSE(ModuleMgr.lookupModuleFile("-", 1, 1, File)); > + ASSERT_TRUE(File == NULL); > +} > + > +} // anonymous namespace > Gentle ping.
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
