[cfe-commits] r70249 - /cfe/trunk/tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Mon Apr 27 14:19:07 PDT 2009
Author: ddunbar
Date: Mon Apr 27 16:19:07 2009
New Revision: 70249
URL: http://llvm.org/viewvc/llvm-project?rev=70249&view=rev
Log:
Add -empty-input-only option, for timing.
- Forces input file to be empty to time startup/shutdown costs.
Modified:
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=70249&r1=70248&r2=70249&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Mon Apr 27 16:19:07 2009
@@ -168,6 +168,9 @@
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 @@
// 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()) {
More information about the cfe-commits
mailing list