summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-02-14 05:32:00 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-02-14 05:32:00 +0000
commit0414b8578e8a967de9d7c5a9916816802e1d2c3b (patch)
treeea926c2e832fe5351dcbaa959592f7f6d2660c84
parent0bbcd8ba2f176ecefa96421391207b1b0beadf26 (diff)
downloadbcm5719-llvm-0414b8578e8a967de9d7c5a9916816802e1d2c3b.tar.gz
bcm5719-llvm-0414b8578e8a967de9d7c5a9916816802e1d2c3b.zip
[modules] Accept //-style comments in module maps on purpose rather than by
accident, and accept them even when they begin '//*'. llvm-svn: 229240
-rw-r--r--clang/lib/Lex/ModuleMap.cpp4
-rw-r--r--clang/test/Modules/diagnostics.modulemap4
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 529c971ff52..018a0b88253 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/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<Module *>::iterator I = Modules.begin(),
diff --git a/clang/test/Modules/diagnostics.modulemap b/clang/test/Modules/diagnostics.modulemap
index e28239fea36..14eb408aebb 100644
--- a/clang/test/Modules/diagnostics.modulemap
+++ b/clang/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. */
OpenPOWER on IntegriCloud