Record if a compound literal expression is @ file scope. This allows us to implement C99 6.5.2.5p6. This could have been done without modifying the AST (by checking the decl type and passing the info down to isContextExpr), however we concluded this is more desirable.
Bug/patch by Eli Friedman!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45966 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp
index 2dbb125..f0a1a38 100644
--- a/AST/StmtSerialization.cpp
+++ b/AST/StmtSerialization.cpp
@@ -392,13 +392,15 @@
S.Emit(getType());
S.Emit(getLParenLoc());
S.EmitOwnedPtr(Init);
+ S.EmitBool(isFileScope());
}
CompoundLiteralExpr* CompoundLiteralExpr::CreateImpl(Deserializer& D) {
QualType Q = QualType::ReadVal(D);
SourceLocation L = SourceLocation::ReadVal(D);
Expr* Init = D.ReadOwnedPtr<Expr>();
- return new CompoundLiteralExpr(L, Q, Init);
+ bool fileScope = D.ReadBool();
+ return new CompoundLiteralExpr(L, Q, Init, fileScope);
}
void CompoundStmt::EmitImpl(Serializer& S) const {