[modules] Support use of -E on modules built from the command line.
llvm-svn: 342306
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 10f1d1e..d247005 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -587,12 +587,12 @@
assert(ASTModule && "module file does not define its own module");
Input = FrontendInputFile(ASTModule->PresumedModuleMapFile, Kind);
} else {
- auto &SM = CI.getSourceManager();
- FileID ID = SM.getMainFileID();
- if (auto *File = SM.getFileEntryForID(ID))
+ auto &OldSM = AST->getSourceManager();
+ FileID ID = OldSM.getMainFileID();
+ if (auto *File = OldSM.getFileEntryForID(ID))
Input = FrontendInputFile(File->getName(), Kind);
else
- Input = FrontendInputFile(SM.getBuffer(ID), Kind);
+ Input = FrontendInputFile(OldSM.getBuffer(ID), Kind);
}
setCurrentInput(Input, std::move(AST));
}