[PATCH] D56803: clang -dumpversion returns 4.2.1 for legacy reason, update it

Sylvestre Ledru via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 16 13:05:18 PST 2019


sylvestre.ledru created this revision.
sylvestre.ledru added a reviewer: ddunbar.

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.


Repository:
  rC Clang

https://reviews.llvm.org/D56803

Files:
  lib/Driver/Driver.cpp
  test/Driver/immediate-options.c


Index: test/Driver/immediate-options.c
===================================================================
--- test/Driver/immediate-options.c
+++ test/Driver/immediate-options.c
@@ -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: ={{.*}}
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1625,11 +1625,7 @@
   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;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56803.182128.patch
Type: text/x-patch
Size: 1205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190116/ae4fbd2f/attachment.bin>


More information about the cfe-commits mailing list