]> granicus.if.org Git - clang/commitdiff
[modules] Accept //-style comments in module maps on purpose rather than by
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 14 Feb 2015 05:32:00 +0000 (05:32 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 14 Feb 2015 05:32:00 +0000 (05:32 +0000)
accident, and accept them even when they begin '//*'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229240 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/ModuleMap.cpp
test/Modules/diagnostics.modulemap

index 529c971ff528bbbeb2dd5ec9cf46a0810f829012..018a0b8825319e83fe1979089b89be1a2496944f 100644 (file)
@@ -89,7 +89,9 @@ ModuleMap::ModuleMap(SourceManager &SourceMgr, DiagnosticsEngine &Diags,
                      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(), 
index e28239fea368d764b24a3381160f3235262d3e9d..14eb408aebb1e16482d8c8fcc440d0d0fae37940 100644 (file)
@@ -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. */