From 657ca6683d754c903026221a3aa3aa9cedb7556f Mon Sep 17 00:00:00 2001
From: Chris Lattner <sabre@nondot.org>
Date: Sun, 16 Jan 2011 08:14:11 +0000
Subject: [PATCH] improve compatibility with GCC: when generating the ".d"
 filename to use and the filename has multiple .'s in it, use the last.  For
 example, "foo.bar.cpp" should produce "foo.bar.d" not "foo.d".  Patch by
 Johan Boule in PR8391

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123576 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/Driver/Tools.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index ba2d32328ce..e245f788709 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1964,7 +1964,7 @@ const char *darwin::CC1::getBaseInputStem(const ArgList &Args,
                                           const InputInfoList &Inputs) {
   const char *Str = getBaseInputName(Args, Inputs);
 
-  if (const char *End = strchr(Str, '.'))
+  if (const char *End = strrchr(Str, '.'))
     return Args.MakeArgString(std::string(Str, End));
 
   return Str;
-- 
GitLab