[llvm-branch-commits] [cfe-branch] r286667 - Merging r281286:

Richard Trieu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 11 15:11:36 PST 2016


Author: rtrieu
Date: Fri Nov 11 17:11:36 2016
New Revision: 286667

URL: http://llvm.org/viewvc/llvm-project?rev=286667&view=rev
Log:
Merging r281286:
------------------------------------------------------------------------
r281286 | rtrieu | 2016-09-12 18:20:40 -0700 (Mon, 12 Sep 2016) | 6 lines

Fix interaction between serialization and c++1z feature.

In c++1z, static_assert is not required to have a StringLiteral message, where
previously it was required.  Update the AST Reader to be able to handle a
null StringLiteral.

------------------------------------------------------------------------

Added:
    cfe/branches/release_39/test/Modules/Inputs/static_assert/
    cfe/branches/release_39/test/Modules/Inputs/static_assert/a.h
    cfe/branches/release_39/test/Modules/Inputs/static_assert/module.modulemap
    cfe/branches/release_39/test/Modules/static_assert.cpp
Modified:
    cfe/branches/release_39/lib/Serialization/ASTReaderDecl.cpp

Modified: cfe/branches/release_39/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Serialization/ASTReaderDecl.cpp?rev=286667&r1=286666&r2=286667&view=diff
==============================================================================
--- cfe/branches/release_39/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/branches/release_39/lib/Serialization/ASTReaderDecl.cpp Fri Nov 11 17:11:36 2016
@@ -2220,7 +2220,7 @@ void ASTDeclReader::VisitStaticAssertDec
   VisitDecl(D);
   D->AssertExprAndFailed.setPointer(Reader.ReadExpr(F));
   D->AssertExprAndFailed.setInt(Record[Idx++]);
-  D->Message = cast<StringLiteral>(Reader.ReadExpr(F));
+  D->Message = cast_or_null<StringLiteral>(Reader.ReadExpr(F));
   D->RParenLoc = ReadSourceLocation(Record, Idx);
 }
 

Added: cfe/branches/release_39/test/Modules/Inputs/static_assert/a.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/Modules/Inputs/static_assert/a.h?rev=286667&view=auto
==============================================================================
--- cfe/branches/release_39/test/Modules/Inputs/static_assert/a.h (added)
+++ cfe/branches/release_39/test/Modules/Inputs/static_assert/a.h Fri Nov 11 17:11:36 2016
@@ -0,0 +1,3 @@
+class S {
+  static_assert(4 == 4);
+};

Added: cfe/branches/release_39/test/Modules/Inputs/static_assert/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/Modules/Inputs/static_assert/module.modulemap?rev=286667&view=auto
==============================================================================
--- cfe/branches/release_39/test/Modules/Inputs/static_assert/module.modulemap (added)
+++ cfe/branches/release_39/test/Modules/Inputs/static_assert/module.modulemap Fri Nov 11 17:11:36 2016
@@ -0,0 +1 @@
+module a { header "a.h" }

Added: cfe/branches/release_39/test/Modules/static_assert.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/Modules/static_assert.cpp?rev=286667&view=auto
==============================================================================
--- cfe/branches/release_39/test/Modules/static_assert.cpp (added)
+++ cfe/branches/release_39/test/Modules/static_assert.cpp Fri Nov 11 17:11:36 2016
@@ -0,0 +1,8 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps \
+// RUN:            -I%S/Inputs/static_assert -std=c++1z -verify %s
+// expected-no-diagnostics
+
+#include "a.h"
+
+S s;




More information about the llvm-branch-commits mailing list