Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/unittests/libclang/LibclangTest.cpp
Show First 20 Lines • Show All 509 Lines • ▼ Show 20 Lines | TEST_F(LibclangReparseTest, ReparseWithModule) { | ||||
const char *ModFile = "module A { header \"HeaderFile.h\" }\n"; | const char *ModFile = "module A { header \"HeaderFile.h\" }\n"; | ||||
std::string HeaderName = "HeaderFile.h"; | std::string HeaderName = "HeaderFile.h"; | ||||
std::string MName = "MFile.m"; | std::string MName = "MFile.m"; | ||||
std::string ModName = "module.modulemap"; | std::string ModName = "module.modulemap"; | ||||
WriteFile(MName, MFile); | WriteFile(MName, MFile); | ||||
WriteFile(HeaderName, std::string(HeaderTop) + HeaderBottom); | WriteFile(HeaderName, std::string(HeaderTop) + HeaderBottom); | ||||
WriteFile(ModName, ModFile); | WriteFile(ModName, ModFile); | ||||
// Removing recursively is necessary to delete the module cache. | |||||
RemoveTestDirRecursivelyDuringTeardown = true; | |||||
std::string ModulesCache = std::string("-fmodules-cache-path=") + TestDir; | std::string ModulesCache = std::string("-fmodules-cache-path=") + TestDir; | ||||
const char *Args[] = { "-fmodules", ModulesCache.c_str(), | const char *Args[] = { "-fmodules", ModulesCache.c_str(), | ||||
"-I", TestDir.c_str() }; | "-I", TestDir.c_str() }; | ||||
int NumArgs = std::size(Args); | int NumArgs = std::size(Args); | ||||
ClangTU = clang_parseTranslationUnit(Index, MName.c_str(), Args, NumArgs, | ClangTU = clang_parseTranslationUnit(Index, MName.c_str(), Args, NumArgs, | ||||
nullptr, 0, TUFlags); | nullptr, 0, TUFlags); | ||||
EXPECT_EQ(1U, clang_getNumDiagnostics(ClangTU)); | EXPECT_EQ(1U, clang_getNumDiagnostics(ClangTU)); | ||||
DisplayDiagnostics(); | DisplayDiagnostics(); | ||||
▲ Show 20 Lines • Show All 511 Lines • Show Last 20 Lines |