[PATCH] D17787: [Modules] Don't swallow errors when parsing optional attributes

Davide Italiano via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 1 16:11:58 PST 2016


davide created this revision.
davide added reviewers: silvas, doug.gregor.
davide added a subscriber: cfe-commits.

I found this by visual inspection while trying to get up-to-speed on modules, so I'm still uncertain how to test it. If the current one is really the actual behaviour, then parse can return void.

http://reviews.llvm.org/D17787

Files:
  lib/Lex/ModuleMap.cpp

Index: lib/Lex/ModuleMap.cpp
===================================================================
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -1402,7 +1402,8 @@
   
   // Parse the optional attribute list.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+    return;
   
   // Parse the opening brace.
   if (!Tok.is(MMToken::LBrace)) {
@@ -2067,7 +2068,9 @@
 
   // Parse the optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+    return;
+
   if (Attrs.IsExhaustive && !ActiveModule->Parent) {
     ActiveModule->ConfigMacrosExhaustive = true;
   }
@@ -2215,7 +2218,8 @@
 
   // Parse optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+    return;
 
   if (ActiveModule) {
     // Note that we have an inferred submodule.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17787.49563.patch
Type: text/x-patch
Size: 913 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160302/1f2ef0da/attachment.bin>


More information about the cfe-commits mailing list