From c7162937a4ccd044a0df67eed4a73ee828c49162 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 11 Nov 2009 23:58:53 +0000 Subject: Tweak PCH -include handling to make sure it matches the name as would be present in the predefines buffer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86903 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/InitPreprocessor.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/Frontend/InitPreprocessor.cpp') diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index ad70727c05..462e065e8c 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -61,9 +61,7 @@ static void UndefineBuiltinMacro(std::vector &Buf, const char *Macro) { Buf.push_back('\n'); } -/// Add the quoted name of an implicit include file. -static void AddQuotedIncludePath(std::vector &Buf, - const std::string &File) { +std::string clang::NormalizeDashIncludePath(llvm::StringRef File) { // Implicit include paths should be resolved relative to the current // working directory first, and then use the regular header search // mechanism. The proper way to handle this is to have the @@ -76,9 +74,16 @@ static void AddQuotedIncludePath(std::vector &Buf, if (!Path.exists()) Path = File; + return Lexer::Stringify(Path.str()); +} + +/// Add the quoted name of an implicit include file. +static void AddQuotedIncludePath(std::vector &Buf, + const std::string &File) { + // Escape double quotes etc. Buf.push_back('"'); - std::string EscapedFile = Lexer::Stringify(Path.str()); + std::string EscapedFile = NormalizeDashIncludePath(File); Buf.insert(Buf.end(), EscapedFile.begin(), EscapedFile.end()); Buf.push_back('"'); } -- cgit v1.2.3