mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-27 20:06:20 +00:00
Fix an embarrassing bug in relocatable PCH support, where we were
passing a temporary const char* down as the "isysroot" parameter and then accessing it later. Fixes <rdar://problem/9035180>. llvm-svn: 135749
This commit is contained in:
parent
4dd6c043ae
commit
77d993d3aa
@ -632,6 +632,7 @@ protected:
|
||||
public:
|
||||
PCHGenerator(const Preprocessor &PP, const std::string &OutputFile, bool Chaining,
|
||||
const char *isysroot, raw_ostream *Out);
|
||||
~PCHGenerator();
|
||||
virtual void InitializeSema(Sema &S) { SemaPtr = &S; }
|
||||
virtual void HandleTranslationUnit(ASTContext &Ctx);
|
||||
virtual ASTMutationListener *GetASTMutationListener();
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "llvm/Bitcode/BitstreamWriter.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace clang;
|
||||
|
||||
@ -31,7 +33,7 @@ PCHGenerator::PCHGenerator(const Preprocessor &PP,
|
||||
bool Chaining,
|
||||
const char *isysroot,
|
||||
llvm::raw_ostream *OS)
|
||||
: PP(PP), OutputFile(OutputFile), isysroot(isysroot), Out(OS), SemaPtr(0),
|
||||
: PP(PP), OutputFile(OutputFile), isysroot(0), 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.
|
||||
@ -40,6 +42,13 @@ PCHGenerator::PCHGenerator(const Preprocessor &PP,
|
||||
// *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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user