summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-15 17:54:22 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-15 17:54:22 +0000
commit10b2368e9f90898888300748f96bba6a566e283e (patch)
treef5945099278d2fefa36152a8b1e63a8196e75be4 /clang/lib/Frontend/ASTUnit.cpp
parent7a03c852d0361df55b14127acc613be8e5c43f63 (diff)
downloadbcm5719-llvm-10b2368e9f90898888300748f96bba6a566e283e.tar.gz
bcm5719-llvm-10b2368e9f90898888300748f96bba6a566e283e.zip
Allow resolving headers from a PCH even after headers+PCH were moved to another path.
Store in PCH the directory that the PCH was originally created in. If a header file is not found at the path that we expect it to be and the PCH file was moved from its original location, try to resolve the file by assuming that header+PCH were moved together and the header is in the same place relative to the PCH. llvm-svn: 125576
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 00902e810c2..0370c2e125b 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -653,7 +653,7 @@ public:
PrecompilePreambleConsumer(ASTUnit &Unit,
const Preprocessor &PP, bool Chaining,
const char *isysroot, llvm::raw_ostream *Out)
- : PCHGenerator(PP, Chaining, isysroot, Out), Unit(Unit) { }
+ : PCHGenerator(PP, "", Chaining, isysroot, Out), Unit(Unit) { }
virtual void HandleTopLevelDecl(DeclGroupRef D) {
for (DeclGroupRef::iterator it = D.begin(), ie = D.end(); it != ie; ++it) {
@@ -700,9 +700,11 @@ public:
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef InFile) {
std::string Sysroot;
+ std::string OutputFile;
llvm::raw_ostream *OS = 0;
bool Chaining;
- if (GeneratePCHAction::ComputeASTConsumerArguments(CI, InFile, Sysroot,
+ if (GeneratePCHAction::ComputeASTConsumerArguments(CI, InFile, Sysroot,
+ OutputFile,
OS, Chaining))
return 0;
@@ -2008,7 +2010,7 @@ bool ASTUnit::Save(llvm::StringRef File) {
std::vector<unsigned char> Buffer;
llvm::BitstreamWriter Stream(Buffer);
ASTWriter Writer(Stream);
- Writer.WriteAST(getSema(), 0, 0);
+ Writer.WriteAST(getSema(), 0, std::string(), 0);
// Write the generated bitstream to "Out".
if (!Buffer.empty())
OpenPOWER on IntegriCloud