diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-08-17 23:14:00 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-08-17 23:14:00 +0000 |
commit | 99e765b4f81247840a6cff40021c9f5de6e5e832 (patch) | |
tree | a2be79c98863bb7fc486370372778cc07d840a0d /clang/lib/Frontend/FrontendActions.cpp | |
parent | 576b2dbec5c737020a95e46b70d9111200b5f9e7 (diff) | |
download | llvm-99e765b4f81247840a6cff40021c9f5de6e5e832.zip llvm-99e765b4f81247840a6cff40021c9f5de6e5e832.tar.gz llvm-99e765b4f81247840a6cff40021c9f5de6e5e832.tar.bz2 |
Print the module format in clang -module-file-info.
llvm-svn: 279005
Diffstat (limited to 'clang/lib/Frontend/FrontendActions.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 88ff7e0..d83e98f 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -615,14 +615,19 @@ void DumpModuleInfoAction::ExecuteAction() { llvm::raw_ostream &Out = OutFile.get()? *OutFile.get() : llvm::outs(); Out << "Information for module file '" << getCurrentFile() << "':\n"; + auto &FileMgr = getCompilerInstance().getFileManager(); + auto Buffer = FileMgr.getBufferForFile(getCurrentFile()); + StringRef Magic = (*Buffer)->getMemBufferRef().getBuffer(); + bool IsRaw = (Magic.size() >= 4 && Magic[0] == 'C' && Magic[1] == 'P' && + Magic[2] == 'C' && Magic[3] == 'H'); + Out << " Module format: " << (IsRaw ? "raw" : "obj") << "\n"; Preprocessor &PP = getCompilerInstance().getPreprocessor(); DumpModuleInfoListener Listener(Out); HeaderSearchOptions &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts(); ASTReader::readASTFileControlBlock( - getCurrentFile(), getCompilerInstance().getFileManager(), - getCompilerInstance().getPCHContainerReader(), + getCurrentFile(), FileMgr, getCompilerInstance().getPCHContainerReader(), /*FindModuleFileExtensions=*/true, Listener, HSOpts.ModulesValidateDiagnosticOptions); } |