forked from OSchip/llvm-project
Print the module format in clang -module-file-info.
llvm-svn: 279005
This commit is contained in:
parent
576b2dbec5
commit
99e765b4f8
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -4,10 +4,14 @@
|
|||
// RUN: rm -rf %t %t-obj
|
||||
// RUN: %clang_cc1 -w -Wunused -fmodules -fmodule-format=raw -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE -fmodule-feature myfeature %s
|
||||
// RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s
|
||||
// RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s --check-prefix=RAW
|
||||
|
||||
// RUN: %clang_cc1 -w -Wunused -fmodules -fmodule-format=obj -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-obj -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE -fmodule-feature myfeature %s
|
||||
// RUN: %clang_cc1 -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s
|
||||
// RUN: %clang_cc1 -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s --check-prefix=OBJ
|
||||
|
||||
// RAW: Module format: raw
|
||||
// OBJ: Module format: obj
|
||||
// CHECK: Generated by this Clang:
|
||||
|
||||
// CHECK: Module name: DependsOnModule
|
||||
|
|
Loading…
Reference in New Issue