From: Richard Smith Date: Sat, 14 Feb 2015 05:32:00 +0000 (+0000) Subject: [modules] Accept //-style comments in module maps on purpose rather than by X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce39e5c4cb1a0b2d2a0d7f5d9db13e4b477358e4;p=clang [modules] Accept //-style comments in module maps on purpose rather than by 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 --- diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 529c971ff5..018a0b8825 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -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::iterator I = Modules.begin(), diff --git a/test/Modules/diagnostics.modulemap b/test/Modules/diagnostics.modulemap index e28239fea3..14eb408aeb 100644 --- a/test/Modules/diagnostics.modulemap +++ b/test/Modules/diagnostics.modulemap @@ -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. */