From ddc15c40d22718d7b7060634b782d1a3ce9184a8 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 2 Apr 2013 13:38:48 +0000 Subject: Escape # and $ in dependency files. Fixes PR15642. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178540 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/DependencyFile.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/Frontend/DependencyFile.cpp') diff --git a/lib/Frontend/DependencyFile.cpp b/lib/Frontend/DependencyFile.cpp index 53ea8befbc..628def68e5 100644 --- a/lib/Frontend/DependencyFile.cpp +++ b/lib/Frontend/DependencyFile.cpp @@ -151,12 +151,14 @@ void DependencyFileCallback::AddFilename(StringRef Filename) { Files.push_back(Filename); } -/// PrintFilename - GCC escapes spaces, but apparently not ' or " or other -/// scary characters. +/// PrintFilename - GCC escapes spaces, # and $, but apparently not ' or " or +/// other scary characters. static void PrintFilename(raw_ostream &OS, StringRef Filename) { for (unsigned i = 0, e = Filename.size(); i != e; ++i) { - if (Filename[i] == ' ') + if (Filename[i] == ' ' || Filename[i] == '#') OS << '\\'; + else if (Filename[i] == '$') // $ is escaped by $$. + OS << '$'; OS << Filename[i]; } } -- cgit v1.2.3-18-g5258