r356931 - clang -dumpversion returns 4.2.1 for legacy reason, update it

Sylvestre Ledru via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 25 11:06:20 PDT 2019


Author: sylvestre
Date: Mon Mar 25 11:06:20 2019
New Revision: 356931

URL: http://llvm.org/viewvc/llvm-project?rev=356931&view=rev
Log:
clang -dumpversion returns 4.2.1 for legacy reason, update it

Summary:
It has been introduced in 2011 for gcc compat:
https://github.com/llvm-mirror/clang/commit/95a907fc0f2f717dca38a379c1d2353bfea06d4f
it is probably time to remove it to remove the confusion.

reported: https://bugs.llvm.org/show_bug.cgi?id=38836
https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1810860

Reviewers: ddunbar, rnk

Reviewed By: rnk

Subscribers: jdoerfert, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D56803

Modified:
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/test/Driver/immediate-options.c

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=356931&r1=356930&r2=356931&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Mar 25 11:06:20 2019
@@ -1640,11 +1640,7 @@ bool Driver::HandleImmediateArgs(const C
   if (C.getArgs().hasArg(options::OPT_dumpversion)) {
     // Since -dumpversion is only implemented for pedantic GCC compatibility, we
     // return an answer which matches our definition of __VERSION__.
-    //
-    // If we want to return a more correct answer some day, then we should
-    // introduce a non-pedantically GCC compatible mode to Clang in which we
-    // provide sensible definitions for -dumpversion, __VERSION__, etc.
-    llvm::outs() << "4.2.1\n";
+    llvm::outs() << CLANG_VERSION_STRING << "\n";
     return false;
   }
 

Modified: cfe/trunk/test/Driver/immediate-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/immediate-options.c?rev=356931&r1=356930&r2=356931&view=diff
==============================================================================
--- cfe/trunk/test/Driver/immediate-options.c (original)
+++ cfe/trunk/test/Driver/immediate-options.c Mon Mar 25 11:06:20 2019
@@ -7,7 +7,7 @@
 // HELP-HIDDEN: driver-mode
 
 // RUN: %clang -dumpversion | FileCheck %s -check-prefix=DUMPVERSION
-// DUMPVERSION: 4.2.1
+// DUMPVERSION: {{[0-9]+\.[0-9.]+}}
 
 // RUN: %clang -print-search-dirs | FileCheck %s -check-prefix=PRINT-SEARCH-DIRS
 // PRINT-SEARCH-DIRS: programs: ={{.*}}




More information about the cfe-commits mailing list