diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-27 21:19:07 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-27 21:19:07 +0000 |
commit | 57cbfc0c52d7a27cce1e12e79d204f80e324e1c8 (patch) | |
tree | 6e6f8ec8308cb3028a6badf8a6df689ce892c076 | |
parent | fef9f59e80275cc7515676ee6d8cc539ef155b47 (diff) | |
download | clang-57cbfc0c52d7a27cce1e12e79d204f80e324e1c8.tar.gz |
Add -empty-input-only option, for timing.
- Forces input file to be empty to time startup/shutdown costs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70249 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/clang-cc/clang-cc.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index bba5723724..6f159e0615 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -168,6 +168,9 @@ static llvm::cl::opt<bool> DisableFree("disable-free", llvm::cl::desc("Disable freeing of memory on exit"), llvm::cl::init(false)); +static llvm::cl::opt<bool> +EmptyInputOnly("empty-input-only", + llvm::cl::desc("Force running on an empty input file")); enum ProgActions { RewriteObjC, // ObjC->C Rewriter. @@ -1037,8 +1040,13 @@ static bool InitializeSourceManager(Preprocessor &PP, // Figure out where to get and map in the main file. SourceManager &SourceMgr = PP.getSourceManager(); FileManager &FileMgr = PP.getFileManager(); - - if (InFile != "-") { + + if (EmptyInputOnly) { + const char *EmptyStr = ""; + llvm::MemoryBuffer *SB = + llvm::MemoryBuffer::getMemBuffer(EmptyStr, EmptyStr, "<empty input>"); + SourceMgr.createMainFileIDForMemBuffer(SB); + } else if (InFile != "-") { const FileEntry *File = FileMgr.getFile(InFile); if (File) SourceMgr.createMainFileID(File, SourceLocation()); if (SourceMgr.getMainFileID().isInvalid()) { |