Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -411,6 +411,10 @@ // If the location is not valid then use main input file. return getOrCreateMainFile(); + if (!getSource(SM, SM.getFileID(Loc))) + // If the source file is not valid then use main input file + return getOrCreateMainFile(); + // Cache the results. const char *fname = PLoc.getFilename(); auto It = DIFileCache.find(fname);