aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-12-19 17:25:59 +0000
committerTed Kremenek <kremenek@apple.com>2007-12-19 17:25:59 +0000
commit3910c7ceb905a03aeffcb0aa1dc5308d0fc64f4c (patch)
treecedc61ccc9acacc64fd9c77a50851d98f9d2e190
parent5ca4020c6e1e4f8d81cf4c2890ca8a7c0dd28d56 (diff)
Moved generation of the name of the serialized AST file into
CreateASTSerializer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45201 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Driver/ASTConsumers.cpp14
-rw-r--r--Driver/ASTConsumers.h2
-rw-r--r--Driver/clang.cpp16
3 files changed, 16 insertions, 16 deletions
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index 49bf59b883..184f29a606 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -637,8 +637,20 @@ namespace {
} // end anonymous namespace
-ASTConsumer *clang::CreateASTSerializer(const llvm::sys::Path& FName,
+ASTConsumer* clang::CreateASTSerializer(const std::string& InFile,
Diagnostic &Diags,
const LangOptions &Features) {
+
+ // FIXME: This is a hack: "/" separator not portable.
+ std::string::size_type idx = InFile.rfind("/");
+
+ if (idx != std::string::npos && idx == InFile.size()-1)
+ return NULL;
+
+ std::string TargetPrefix( idx == std::string::npos ?
+ InFile : InFile.substr(idx+1));
+
+ llvm::sys::Path FName = llvm::sys::Path((TargetPrefix + ".ast").c_str());
+
return new ASTSerializer(FName, Diags, Features);
}
diff --git a/Driver/ASTConsumers.h b/Driver/ASTConsumers.h
index 027370f708..05473b1558 100644
--- a/Driver/ASTConsumers.h
+++ b/Driver/ASTConsumers.h
@@ -37,7 +37,7 @@ ASTConsumer *CreateCodeRewriterTest(Diagnostic &Diags);
ASTConsumer *CreateSerializationTest(Diagnostic &Diags, FileManager& FMgr,
const LangOptions &LOpts);
-ASTConsumer *CreateASTSerializer(const llvm::sys::Path& FName,
+ASTConsumer *CreateASTSerializer(const std::string& InFile,
Diagnostic &Diags, const LangOptions &LOpts);
} // end clang namespace
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index d440aad6a2..8afd71833f 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -922,21 +922,9 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile,
case EmitLLVM:
return CreateLLVMEmitter(Diag, LangOpts);
- case SerializeAST: {
+ case SerializeAST:
// FIXME: Allow user to tailor where the file is written.
- // FIXME: This is a hack: "/" separator not portable.
- std::string::size_type idx = InFile.rfind("/");
-
- if (idx != std::string::npos && idx == InFile.size()-1)
- return NULL;
-
- std::string TargetPrefix( idx == std::string::npos ?
- InFile : InFile.substr(idx+1));
-
- llvm::sys::Path FName = llvm::sys::Path((TargetPrefix + ".ast").c_str());
-
- return CreateASTSerializer(FName, Diag, LangOpts);
- }
+ return CreateASTSerializer(InFile, Diag, LangOpts);
case RewriteTest:
return CreateCodeRewriterTest(Diag);