r371917 - [Driver] Improve Clang::getDependencyFileName and its tests after rC371853
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 13 21:13:15 PDT 2019
Author: maskray
Date: Fri Sep 13 21:13:15 2019
New Revision: 371917
URL: http://llvm.org/viewvc/llvm-project?rev=371917&view=rev
Log:
[Driver] Improve Clang::getDependencyFileName and its tests after rC371853
The test file name metadata-with-dots.c is confusing because -MD and -MMD
have nothing to do with metadata.
Added:
cfe/trunk/test/Driver/m-and-mm.c
Removed:
cfe/trunk/test/Driver/m_and_mm.c
cfe/trunk/test/Driver/metadata-with-dots.c
Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=371917&r1=371916&r2=371917&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Sep 13 21:13:15 2019
@@ -6073,7 +6073,7 @@ const char *Clang::getDependencyFileName
return Args.MakeArgString(OutputFilename);
}
- return Args.MakeArgString(std::string(getBaseInputStem(Args, Inputs)) + ".d");
+ return Args.MakeArgString(Twine(getBaseInputStem(Args, Inputs)) + ".d");
}
// Begin ClangAs
Added: cfe/trunk/test/Driver/m-and-mm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/m-and-mm.c?rev=371917&view=auto
==============================================================================
--- cfe/trunk/test/Driver/m-and-mm.c (added)
+++ cfe/trunk/test/Driver/m-and-mm.c Fri Sep 13 21:13:15 2019
@@ -0,0 +1,17 @@
+// RUN: %clang -M -MM %s 2>&1 | FileCheck /dev/null --implicit-check-not=warning
+
+// RUN: mkdir -p %t.dir
+// RUN: rm -f %t.dir/test.d
+// RUN: %clang -fsyntax-only -MD %s -o %t.dir/test.i
+// RUN: test -f %t.dir/test.d
+
+/// If the output file name does not have a suffix, just append `.d`.
+// RUN: rm -f %t.dir/test.d
+// RUN: %clang -fsyntax-only -MD %s -o %t.dir/test
+// RUN: test -f %t.dir/test.d
+
+#warning "-M and -MM suppresses preprocessing, thus this warning shouldn't show up"
+int main(void)
+{
+ return 0;
+}
Removed: cfe/trunk/test/Driver/m_and_mm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/m_and_mm.c?rev=371916&view=auto
==============================================================================
--- cfe/trunk/test/Driver/m_and_mm.c (original)
+++ cfe/trunk/test/Driver/m_and_mm.c (removed)
@@ -1,15 +0,0 @@
-// RUN: %clang -### \
-// RUN: -M -MM %s 2> %t
-// RUN: not grep '"-sys-header-deps"' %t
-
-// RUN: %clang -M -MM %s 2> %t
-// RUN: not grep "warning" %t
-
-// RUN: %clang -MMD -MD %s 2> %t || true
-// RUN: grep "warning" %t
-
-#warning "This warning shouldn't show up with -M and -MM"
-int main (void)
-{
- return 0;
-}
Removed: cfe/trunk/test/Driver/metadata-with-dots.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/metadata-with-dots.c?rev=371916&view=auto
==============================================================================
--- cfe/trunk/test/Driver/metadata-with-dots.c (original)
+++ cfe/trunk/test/Driver/metadata-with-dots.c (removed)
@@ -1,11 +0,0 @@
-// REQUIRES: shell
-// RUN: mkdir -p %t/out.dir
-// RUN: cat %s > %t/out.dir/test.c
-// RUN: %clang -E -MMD %s -o %t/out.dir/test
-// RUN: test ! -f %out.d
-// RUN: test -f %t/out.dir/test.d
-// RUN: rm -rf %t/out.dir/test.d %t/out.dir/ out.d
-int main (void)
-{
- return 0;
-}
More information about the cfe-commits
mailing list