@@ -978,18 +978,21 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
978978 if (!CI.getFrontendOpts ().SummaryDirPath .empty ()) {
979979 // FIXME: this is a quick shortcut so large summaries are only evaluated
980980 // once, we should think about implementing it in a reasonable way...
981- static const char *reducedCache =
982- " reduced-summary-so-that-we-do-not-have-to-evaluate-it-every-time.json" ;
983- FileManager &FileMgr = CI.getFileManager ();
981+ static const char *reducedCacheName =
982+ " reduced-summary-so-that-we-do-not-have-to-evaluate-it-every-time" ;
983+ const std::string summaryExtension =
984+ ' .' + CI.getFrontendOpts ().SummaryFormat ;
984985
986+ FileManager &FileMgr = CI.getFileManager ();
985987 StringRef SummaryDirPath = CI.getFrontendOpts ().SummaryDirPath ;
986988 if (auto SummaryDir = FileMgr.getOptionalDirectoryRef (SummaryDirPath)) {
987989 std::error_code EC;
988990 SmallString<128 > DirNative;
989991 llvm::sys::path::native (SummaryDir->getName (), DirNative);
990992
991993 llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem ();
992- std::string cacheFile = DirNative.str ().str () + ' /' + reducedCache;
994+ std::string cacheFile =
995+ DirNative.str ().str () + ' /' + reducedCacheName + summaryExtension;
993996
994997 std::vector<std::string> paths;
995998
@@ -999,7 +1002,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
9991002 for (llvm::vfs::directory_iterator Dir = FS.dir_begin (DirNative, EC),
10001003 DirEnd;
10011004 Dir != DirEnd && !EC; Dir.increment (EC)) {
1002- if (llvm::sys::path::extension (Dir->path ()) != " .json " )
1005+ if (llvm::sys::path::extension (Dir->path ()) != summaryExtension )
10031006 continue ;
10041007
10051008 paths.emplace_back (Dir->path ().str ());
0 commit comments