Switch all of the "isysroot" const char*'s throughout the AST reader
and writer to StringRef or std::string, as appropriate.
llvm-svn: 135769
diff --git a/clang/lib/Serialization/GeneratePCH.cpp b/clang/lib/Serialization/GeneratePCH.cpp
index 9cd694e..16352c8 100644
--- a/clang/lib/Serialization/GeneratePCH.cpp
+++ b/clang/lib/Serialization/GeneratePCH.cpp
@@ -23,18 +23,16 @@
#include "llvm/Bitcode/BitstreamWriter.h"
#include "llvm/Support/raw_ostream.h"
#include <string>
-#include <string.h>
-#include <stdlib.h>
using namespace clang;
PCHGenerator::PCHGenerator(const Preprocessor &PP,
const std::string &OutputFile,
bool Chaining,
- const char *isysroot,
+ StringRef isysroot,
llvm::raw_ostream *OS)
- : PP(PP), OutputFile(OutputFile), isysroot(0), Out(OS), SemaPtr(0),
- StatCalls(0), Stream(Buffer), Writer(Stream), Chaining(Chaining) {
+ : PP(PP), OutputFile(OutputFile), isysroot(isysroot.str()), Out(OS),
+ SemaPtr(0), StatCalls(0), Stream(Buffer), Writer(Stream), Chaining(Chaining) {
// Install a stat() listener to keep track of all of the stat()
// calls.
StatCalls = new MemorizeStatCalls();
@@ -42,13 +40,9 @@
// *after* the already installed ASTReader's stat cache.
PP.getFileManager().addStatCache(StatCalls,
/*AtBeginning=*/!Chaining);
-
- if (isysroot)
- this->isysroot = strdup(isysroot);
}
PCHGenerator::~PCHGenerator() {
- free((void*)isysroot);
}
void PCHGenerator::HandleTranslationUnit(ASTContext &Ctx) {