diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-10-06 23:00:33 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-10-06 23:00:33 +0000 |
commit | b001de7458d17c17e6d8b8034c7cfcefd3b70c00 (patch) | |
tree | 22aafdcc75a1bc4984c7112800b87ece9b2f54c6 /lib/Sema/SemaExpr.cpp | |
parent | 5f22614327065a4ae78588eda8cb62f8b50502aa (diff) |
Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.
Thanks to Jeffrey Yasskin for the thorough review!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141330 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 7721caf939..ec71a4e94d 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -342,6 +342,10 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) { QualType T = E->getType(); assert(!T.isNull() && "r-value conversion on typeless expression?"); + // We can't do lvalue-to-rvalue on atomics yet. + if (T->getAs<AtomicType>()) + return Owned(E); + // Create a load out of an ObjCProperty l-value, if necessary. if (E->getObjectKind() == OK_ObjCProperty) { ExprResult Res = ConvertPropertyForRValue(E); @@ -5393,6 +5397,10 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, LHSType = Context.getCanonicalType(LHSType).getUnqualifiedType(); RHSType = Context.getCanonicalType(RHSType).getUnqualifiedType(); + // We can't do assignment from/to atomics yet. + if (LHSType->isAtomicType()) + return Incompatible; + // Common case: no conversion required. if (LHSType == RHSType) { Kind = CK_NoOp; @@ -5712,7 +5720,7 @@ Sema::AssignConvertType Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose) { if (getLangOptions().CPlusPlus) { - if (!LHSType->isRecordType()) { + if (!LHSType->isRecordType() && !LHSType->isAtomicType()) { // C++ 5.17p3: If the left operand is not of class type, the // expression is implicitly converted (C++ 4) to the // cv-unqualified type of the left operand. @@ -5732,6 +5740,8 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, // FIXME: Currently, we fall through and treat C++ classes like C // structures. + // FIXME: We also fall through for atomics; not sure what should + // happen there, though. } // C99 6.5.16.1p1: the left operand is a pointer and the right is |