diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-22 16:35:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-22 16:35:34 +0000 |
commit | 832d620b4ae0fc5fe28561b885b4cfc65cf5c9ab (patch) | |
tree | 499c921a0e163c0aaf47afc091a045a13556f64c /lib/Frontend/ASTUnit.cpp | |
parent | 72a9ae18553bf8b6bdad84d2c54f73741a47e275 (diff) |
Switch all of the "isysroot" const char*'s throughout the AST reader
and writer to StringRef or std::string, as appropriate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index d37d39c60b..1b3e81b6f7 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -778,7 +778,7 @@ class PrecompilePreambleConsumer : public PCHGenerator, public: PrecompilePreambleConsumer(ASTUnit &Unit, const Preprocessor &PP, bool Chaining, - const char *isysroot, llvm::raw_ostream *Out) + StringRef isysroot, llvm::raw_ostream *Out) : PCHGenerator(PP, "", Chaining, isysroot, Out), Unit(Unit), Hash(Unit.getCurrentTopLevelHashValue()) { Hash = 0; @@ -838,12 +838,13 @@ public: OS, Chaining)) return 0; - const char *isysroot = CI.getFrontendOpts().RelocatablePCH ? - Sysroot.c_str() : 0; + if (!CI.getFrontendOpts().RelocatablePCH) + Sysroot.clear(); + CI.getPreprocessor().addPPCallbacks( new MacroDefinitionTrackerPPCallbacks(Unit.getCurrentTopLevelHashValue())); return new PrecompilePreambleConsumer(Unit, CI.getPreprocessor(), Chaining, - isysroot, OS); + Sysroot, OS); } virtual bool hasCodeCompletionSupport() const { return false; } @@ -2347,7 +2348,7 @@ bool ASTUnit::serialize(llvm::raw_ostream &OS) { std::vector<unsigned char> Buffer; llvm::BitstreamWriter Stream(Buffer); ASTWriter Writer(Stream); - Writer.WriteAST(getSema(), 0, std::string(), 0); + Writer.WriteAST(getSema(), 0, std::string(), ""); // Write the generated bitstream to "Out". if (!Buffer.empty()) |