r229240 - [modules] Accept //-style comments in module maps on purpose rather than by

Richard Smith richard-llvm at metafoo.co.uk
Fri Feb 13 21:32:00 PST 2015


Author: rsmith
Date: Fri Feb 13 23:32:00 2015
New Revision: 229240

URL: http://llvm.org/viewvc/llvm-project?rev=229240&view=rev
Log:
[modules] Accept //-style comments in module maps on purpose rather than by
accident, and accept them even when they begin '//*'.

Modified:
    cfe/trunk/lib/Lex/ModuleMap.cpp
    cfe/trunk/test/Modules/diagnostics.modulemap

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=229240&r1=229239&r2=229240&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Feb 13 23:32:00 2015
@@ -89,7 +89,9 @@ ModuleMap::ModuleMap(SourceManager &Sour
                      HeaderSearch &HeaderInfo)
     : SourceMgr(SourceMgr), Diags(Diags), LangOpts(LangOpts), Target(Target),
       HeaderInfo(HeaderInfo), BuiltinIncludeDir(nullptr),
-      CompilingModule(nullptr), SourceModule(nullptr) {}
+      CompilingModule(nullptr), SourceModule(nullptr) {
+  MMapLangOpts.LineComment = true;
+}
 
 ModuleMap::~ModuleMap() {
   for (llvm::StringMap<Module *>::iterator I = Modules.begin(), 

Modified: cfe/trunk/test/Modules/diagnostics.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/diagnostics.modulemap?rev=229240&r1=229239&r2=229240&view=diff
==============================================================================
--- cfe/trunk/test/Modules/diagnostics.modulemap (original)
+++ cfe/trunk/test/Modules/diagnostics.modulemap Fri Feb 13 23:32:00 2015
@@ -1,3 +1,5 @@
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%s -fsyntax-only -x c++ /dev/null 2>&1
+//
 // RUN: cp %s %t-duplicate.modulemap
 // RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%s -fmodule-map-file=%t-duplicate.modulemap -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck --check-prefix=CHECK-DUPLICATE %s
 
@@ -6,3 +8,5 @@
 // CHECK-DUPLICATE: duplicate.modulemap:[[@LINE+2]]:8: error: redefinition of module 'foo'
 // CHECK-DUPLICATE: diagnostics.modulemap:[[@LINE+1]]:8: note: previously defined here
 module foo {}
+
+//* Check that we accept BCPL comments properly, not just as an extension. */





More information about the cfe-commits mailing list