Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 1 | //===--- SemaExpr.cpp - Semantic Analysis for Expressions -----------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by Chris Lattner and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements semantic analysis for expressions. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "Sema.h" |
Chris Lattner | cb6a382 | 2006-11-10 06:20:45 +0000 | [diff] [blame] | 15 | #include "clang/AST/ASTContext.h" |
Chris Lattner | 17ed487 | 2006-11-20 04:58:19 +0000 | [diff] [blame] | 16 | #include "clang/AST/Decl.h" |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 17 | #include "clang/AST/Expr.h" |
| 18 | #include "clang/Lex/Preprocessor.h" |
Steve Naroff | 09ef474 | 2007-03-09 23:16:33 +0000 | [diff] [blame] | 19 | #include "clang/Lex/LiteralSupport.h" |
Steve Naroff | f2fb89e | 2007-03-13 20:29:44 +0000 | [diff] [blame] | 20 | #include "clang/Basic/SourceManager.h" |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 21 | #include "clang/Basic/Diagnostic.h" |
Chris Lattner | ac18be9 | 2006-11-20 06:49:47 +0000 | [diff] [blame] | 22 | #include "clang/Basic/LangOptions.h" |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 23 | #include "clang/Basic/TargetInfo.h" |
| 24 | #include "llvm/ADT/SmallString.h" |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 25 | using namespace llvm; |
| 26 | using namespace clang; |
| 27 | |
Steve Naroff | df7855b | 2007-02-21 23:46:25 +0000 | [diff] [blame] | 28 | /// ParseStringLiteral - The specified tokens were lexed as pasted string |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 29 | /// fragments (e.g. "foo" "bar" L"baz"). The result string has to handle string |
| 30 | /// concatenation ([C99 5.1.1.2, translation phase #6]), so it may come from |
| 31 | /// multiple tokens. However, the common case is that StringToks points to one |
| 32 | /// string. |
| 33 | /// |
| 34 | Action::ExprResult |
Steve Naroff | df7855b | 2007-02-21 23:46:25 +0000 | [diff] [blame] | 35 | Sema::ParseStringLiteral(const LexerToken *StringToks, unsigned NumStringToks) { |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 36 | assert(NumStringToks && "Must have at least one string!"); |
| 37 | |
Steve Naroff | 4f88b31 | 2007-03-13 22:37:02 +0000 | [diff] [blame] | 38 | StringLiteralParser Literal(StringToks, NumStringToks, PP, Context.Target); |
| 39 | if (Literal.hadError) |
| 40 | return ExprResult(true); |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 41 | |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 42 | SmallVector<SourceLocation, 4> StringTokLocs; |
| 43 | for (unsigned i = 0; i != NumStringToks; ++i) |
| 44 | StringTokLocs.push_back(StringToks[i].getLocation()); |
Steve Naroff | 4f88b31 | 2007-03-13 22:37:02 +0000 | [diff] [blame] | 45 | |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 46 | // FIXME: use factory. |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 47 | // Pass &StringTokLocs[0], StringTokLocs.size() to factory! |
Steve Naroff | 4f88b31 | 2007-03-13 22:37:02 +0000 | [diff] [blame] | 48 | return new StringLiteral(Literal.GetString(), Literal.GetStringLength(), |
| 49 | Literal.AnyWide); |
Chris Lattner | 5b183d8 | 2006-11-10 05:03:26 +0000 | [diff] [blame] | 50 | } |
| 51 | |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 52 | |
Chris Lattner | ac18be9 | 2006-11-20 06:49:47 +0000 | [diff] [blame] | 53 | /// ParseIdentifierExpr - The parser read an identifier in expression context, |
| 54 | /// validate it per-C99 6.5.1. HasTrailingLParen indicates whether this |
| 55 | /// identifier is used in an function call context. |
| 56 | Sema::ExprResult Sema::ParseIdentifierExpr(Scope *S, SourceLocation Loc, |
| 57 | IdentifierInfo &II, |
| 58 | bool HasTrailingLParen) { |
Chris Lattner | 17ed487 | 2006-11-20 04:58:19 +0000 | [diff] [blame] | 59 | // Could be enum-constant or decl. |
Chris Lattner | 9561a0b | 2007-01-28 08:20:04 +0000 | [diff] [blame] | 60 | Decl *D = LookupScopedDecl(&II, Decl::IDNS_Ordinary, Loc, S); |
Chris Lattner | 17ed487 | 2006-11-20 04:58:19 +0000 | [diff] [blame] | 61 | if (D == 0) { |
Bill Wendling | 4073ed5 | 2007-02-13 01:51:42 +0000 | [diff] [blame] | 62 | // Otherwise, this could be an implicitly declared function reference (legal |
Chris Lattner | 9561a0b | 2007-01-28 08:20:04 +0000 | [diff] [blame] | 63 | // in C90, extension in C99). |
Chris Lattner | ac18be9 | 2006-11-20 06:49:47 +0000 | [diff] [blame] | 64 | if (HasTrailingLParen && |
| 65 | // Not in C++. |
| 66 | !getLangOptions().CPlusPlus) { |
| 67 | D = ImplicitlyDefineFunction(Loc, II, S); |
| 68 | } else { |
| 69 | // If this name wasn't predeclared and if this is not a function call, |
| 70 | // diagnose the problem. |
| 71 | Diag(Loc, diag::err_undeclared_var_use, II.getName()); |
| 72 | return true; |
| 73 | } |
Chris Lattner | 17ed487 | 2006-11-20 04:58:19 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Chris Lattner | 32d920b | 2007-01-26 02:01:53 +0000 | [diff] [blame] | 76 | if (isa<TypedefDecl>(D)) { |
Chris Lattner | 17ed487 | 2006-11-20 04:58:19 +0000 | [diff] [blame] | 77 | Diag(Loc, diag::err_unexpected_typedef, II.getName()); |
| 78 | return true; |
| 79 | } |
| 80 | |
Chris Lattner | 5efbb33 | 2006-11-20 05:01:40 +0000 | [diff] [blame] | 81 | return new DeclRefExpr(D); |
Chris Lattner | 17ed487 | 2006-11-20 04:58:19 +0000 | [diff] [blame] | 82 | } |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 83 | |
Chris Lattner | 17ed487 | 2006-11-20 04:58:19 +0000 | [diff] [blame] | 84 | Sema::ExprResult Sema::ParseSimplePrimaryExpr(SourceLocation Loc, |
| 85 | tok::TokenKind Kind) { |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 86 | switch (Kind) { |
| 87 | default: |
| 88 | assert(0 && "Unknown simple primary expr!"); |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 89 | case tok::char_constant: // constant: character-constant |
Chris Lattner | 17ed487 | 2006-11-20 04:58:19 +0000 | [diff] [blame] | 90 | // TODO: MOVE this to be some other callback. |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 91 | case tok::kw___func__: // primary-expression: __func__ [C99 6.4.2.2] |
| 92 | case tok::kw___FUNCTION__: // primary-expression: __FUNCTION__ [GNU] |
| 93 | case tok::kw___PRETTY_FUNCTION__: // primary-expression: __P..Y_F..N__ [GNU] |
Chris Lattner | 17ed487 | 2006-11-20 04:58:19 +0000 | [diff] [blame] | 94 | return 0; |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 95 | } |
| 96 | } |
| 97 | |
Steve Naroff | 8160ea2 | 2007-03-06 01:09:46 +0000 | [diff] [blame] | 98 | Action::ExprResult Sema::ParseNumericConstant(const LexerToken &Tok) { |
Steve Naroff | f2fb89e | 2007-03-13 20:29:44 +0000 | [diff] [blame] | 99 | // fast path for a single digit (which is quite common). A single digit |
| 100 | // cannot have a trigraph, escaped newline, radix prefix, or type suffix. |
| 101 | if (Tok.getLength() == 1) { |
| 102 | const char *t = PP.getSourceManager().getCharacterData(Tok.getLocation()); |
| 103 | return ExprResult(new IntegerLiteral(*t-'0', Context.IntTy)); |
| 104 | } |
Steve Naroff | 8160ea2 | 2007-03-06 01:09:46 +0000 | [diff] [blame] | 105 | SmallString<512> IntegerBuffer; |
| 106 | IntegerBuffer.resize(Tok.getLength()); |
| 107 | const char *ThisTokBegin = &IntegerBuffer[0]; |
| 108 | |
| 109 | // Get the spelling of the token, which eliminates trigraphs, etc. Notes: |
| 110 | // - We know that ThisTokBuf points to a buffer that is big enough for the |
| 111 | // whole token and 'spelled' tokens can only shrink. |
| 112 | // - In practice, the local buffer is only used when the spelling doesn't |
| 113 | // match the original token (which is rare). The common case simply returns |
| 114 | // a pointer to a *constant* buffer (avoiding a copy). |
| 115 | |
| 116 | unsigned ActualLength = PP.getSpelling(Tok, ThisTokBegin); |
Steve Naroff | 09ef474 | 2007-03-09 23:16:33 +0000 | [diff] [blame] | 117 | NumericLiteralParser Literal(ThisTokBegin, ThisTokBegin+ActualLength, |
Steve Naroff | 451d8f16 | 2007-03-12 23:22:38 +0000 | [diff] [blame] | 118 | Tok.getLocation(), PP); |
Steve Naroff | f2fb89e | 2007-03-13 20:29:44 +0000 | [diff] [blame] | 119 | if (Literal.hadError) |
| 120 | return ExprResult(true); |
| 121 | |
Steve Naroff | 09ef474 | 2007-03-09 23:16:33 +0000 | [diff] [blame] | 122 | if (Literal.isIntegerLiteral()) { |
| 123 | TypeRef t; |
| 124 | if (Literal.hasSuffix()) { |
| 125 | if (Literal.isLong) |
| 126 | t = Literal.isUnsigned ? Context.UnsignedLongTy : Context.LongTy; |
| 127 | else if (Literal.isLongLong) |
| 128 | t = Literal.isUnsigned ? Context.UnsignedLongLongTy : Context.LongLongTy; |
| 129 | else |
| 130 | t = Context.UnsignedIntTy; |
| 131 | } else { |
| 132 | t = Context.IntTy; // implicit type is "int" |
| 133 | } |
Steve Naroff | 451d8f16 | 2007-03-12 23:22:38 +0000 | [diff] [blame] | 134 | uintmax_t val; |
| 135 | if (Literal.GetIntegerValue(val)) { |
Steve Naroff | f2fb89e | 2007-03-13 20:29:44 +0000 | [diff] [blame] | 136 | return new IntegerLiteral(val, t); |
Steve Naroff | 09ef474 | 2007-03-09 23:16:33 +0000 | [diff] [blame] | 137 | } |
| 138 | } else if (Literal.isFloatingLiteral()) { |
| 139 | // TODO: add floating point processing... |
| 140 | } |
Steve Naroff | f2fb89e | 2007-03-13 20:29:44 +0000 | [diff] [blame] | 141 | return ExprResult(true); |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | Action::ExprResult Sema::ParseParenExpr(SourceLocation L, SourceLocation R, |
| 145 | ExprTy *Val) { |
| 146 | return Val; |
| 147 | } |
| 148 | |
| 149 | |
| 150 | // Unary Operators. 'Tok' is the token for the operator. |
| 151 | Action::ExprResult Sema::ParseUnaryOp(SourceLocation OpLoc, tok::TokenKind Op, |
| 152 | ExprTy *Input) { |
| 153 | UnaryOperator::Opcode Opc; |
| 154 | switch (Op) { |
| 155 | default: assert(0 && "Unknown unary op!"); |
| 156 | case tok::plusplus: Opc = UnaryOperator::PreInc; break; |
| 157 | case tok::minusminus: Opc = UnaryOperator::PreDec; break; |
| 158 | case tok::amp: Opc = UnaryOperator::AddrOf; break; |
| 159 | case tok::star: Opc = UnaryOperator::Deref; break; |
| 160 | case tok::plus: Opc = UnaryOperator::Plus; break; |
| 161 | case tok::minus: Opc = UnaryOperator::Minus; break; |
| 162 | case tok::tilde: Opc = UnaryOperator::Not; break; |
| 163 | case tok::exclaim: Opc = UnaryOperator::LNot; break; |
| 164 | case tok::kw_sizeof: Opc = UnaryOperator::SizeOf; break; |
| 165 | case tok::kw___alignof: Opc = UnaryOperator::AlignOf; break; |
| 166 | case tok::kw___real: Opc = UnaryOperator::Real; break; |
| 167 | case tok::kw___imag: Opc = UnaryOperator::Imag; break; |
| 168 | case tok::ampamp: Opc = UnaryOperator::AddrLabel; break; |
| 169 | case tok::kw___extension__: |
| 170 | return Input; |
| 171 | //Opc = UnaryOperator::Extension; |
| 172 | //break; |
| 173 | } |
| 174 | |
| 175 | return new UnaryOperator((Expr*)Input, Opc); |
| 176 | } |
| 177 | |
| 178 | Action::ExprResult Sema:: |
| 179 | ParseSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof, |
| 180 | SourceLocation LParenLoc, TypeTy *Ty, |
| 181 | SourceLocation RParenLoc) { |
Chris Lattner | 0d8b1a1 | 2006-11-20 04:34:45 +0000 | [diff] [blame] | 182 | // If error parsing type, ignore. |
| 183 | if (Ty == 0) return true; |
Chris Lattner | 6531c10 | 2007-01-23 22:29:49 +0000 | [diff] [blame] | 184 | |
| 185 | // Verify that this is a valid expression. |
| 186 | TypeRef ArgTy = TypeRef::getFromOpaquePtr(Ty); |
| 187 | |
| 188 | if (isa<FunctionType>(ArgTy) && isSizeof) { |
| 189 | // alignof(function) is allowed. |
| 190 | Diag(OpLoc, diag::ext_sizeof_function_type); |
Steve Naroff | 26c8ea5 | 2007-03-21 21:08:52 +0000 | [diff] [blame^] | 191 | return new IntegerLiteral(1, Context.IntTy); |
Chris Lattner | 6531c10 | 2007-01-23 22:29:49 +0000 | [diff] [blame] | 192 | } else if (ArgTy->isVoidType()) { |
| 193 | Diag(OpLoc, diag::ext_sizeof_void_type, isSizeof ? "sizeof" : "__alignof"); |
| 194 | } else if (ArgTy->isIncompleteType()) { |
| 195 | std::string TypeName; |
| 196 | ArgTy->getAsString(TypeName); |
| 197 | Diag(OpLoc, isSizeof ? diag::err_sizeof_incomplete_type : |
| 198 | diag::err_alignof_incomplete_type, TypeName); |
Steve Naroff | 26c8ea5 | 2007-03-21 21:08:52 +0000 | [diff] [blame^] | 199 | return new IntegerLiteral(0, Context.IntTy); |
Chris Lattner | 6531c10 | 2007-01-23 22:29:49 +0000 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | return new SizeOfAlignOfTypeExpr(isSizeof, ArgTy); |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | |
| 206 | Action::ExprResult Sema::ParsePostfixUnaryOp(SourceLocation OpLoc, |
| 207 | tok::TokenKind Kind, |
| 208 | ExprTy *Input) { |
| 209 | UnaryOperator::Opcode Opc; |
| 210 | switch (Kind) { |
| 211 | default: assert(0 && "Unknown unary op!"); |
| 212 | case tok::plusplus: Opc = UnaryOperator::PostInc; break; |
| 213 | case tok::minusminus: Opc = UnaryOperator::PostDec; break; |
| 214 | } |
| 215 | |
| 216 | return new UnaryOperator((Expr*)Input, Opc); |
| 217 | } |
| 218 | |
| 219 | Action::ExprResult Sema:: |
| 220 | ParseArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc, |
| 221 | ExprTy *Idx, SourceLocation RLoc) { |
| 222 | return new ArraySubscriptExpr((Expr*)Base, (Expr*)Idx); |
| 223 | } |
| 224 | |
| 225 | Action::ExprResult Sema:: |
| 226 | ParseMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc, |
| 227 | tok::TokenKind OpKind, SourceLocation MemberLoc, |
| 228 | IdentifierInfo &Member) { |
| 229 | Decl *MemberDecl = 0; |
| 230 | // TODO: Look up MemberDecl. |
| 231 | return new MemberExpr((Expr*)Base, OpKind == tok::arrow, MemberDecl); |
| 232 | } |
| 233 | |
| 234 | /// ParseCallExpr - Handle a call to Fn with the specified array of arguments. |
| 235 | /// This provides the location of the left/right parens and a list of comma |
| 236 | /// locations. |
| 237 | Action::ExprResult Sema:: |
| 238 | ParseCallExpr(ExprTy *Fn, SourceLocation LParenLoc, |
| 239 | ExprTy **Args, unsigned NumArgs, |
| 240 | SourceLocation *CommaLocs, SourceLocation RParenLoc) { |
| 241 | return new CallExpr((Expr*)Fn, (Expr**)Args, NumArgs); |
| 242 | } |
| 243 | |
| 244 | Action::ExprResult Sema:: |
| 245 | ParseCastExpr(SourceLocation LParenLoc, TypeTy *Ty, |
| 246 | SourceLocation RParenLoc, ExprTy *Op) { |
Chris Lattner | 0d8b1a1 | 2006-11-20 04:34:45 +0000 | [diff] [blame] | 247 | // If error parsing type, ignore. |
| 248 | if (Ty == 0) return true; |
| 249 | return new CastExpr(TypeRef::getFromOpaquePtr(Ty), (Expr*)Op); |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | |
| 253 | |
| 254 | // Binary Operators. 'Tok' is the token for the operator. |
| 255 | Action::ExprResult Sema::ParseBinOp(SourceLocation TokLoc, tok::TokenKind Kind, |
| 256 | ExprTy *LHS, ExprTy *RHS) { |
| 257 | BinaryOperator::Opcode Opc; |
| 258 | switch (Kind) { |
| 259 | default: assert(0 && "Unknown binop!"); |
| 260 | case tok::star: Opc = BinaryOperator::Mul; break; |
| 261 | case tok::slash: Opc = BinaryOperator::Div; break; |
| 262 | case tok::percent: Opc = BinaryOperator::Rem; break; |
| 263 | case tok::plus: Opc = BinaryOperator::Add; break; |
| 264 | case tok::minus: Opc = BinaryOperator::Sub; break; |
| 265 | case tok::lessless: Opc = BinaryOperator::Shl; break; |
| 266 | case tok::greatergreater: Opc = BinaryOperator::Shr; break; |
| 267 | case tok::lessequal: Opc = BinaryOperator::LE; break; |
| 268 | case tok::less: Opc = BinaryOperator::LT; break; |
| 269 | case tok::greaterequal: Opc = BinaryOperator::GE; break; |
| 270 | case tok::greater: Opc = BinaryOperator::GT; break; |
| 271 | case tok::exclaimequal: Opc = BinaryOperator::NE; break; |
| 272 | case tok::equalequal: Opc = BinaryOperator::EQ; break; |
| 273 | case tok::amp: Opc = BinaryOperator::And; break; |
| 274 | case tok::caret: Opc = BinaryOperator::Xor; break; |
| 275 | case tok::pipe: Opc = BinaryOperator::Or; break; |
| 276 | case tok::ampamp: Opc = BinaryOperator::LAnd; break; |
| 277 | case tok::pipepipe: Opc = BinaryOperator::LOr; break; |
| 278 | case tok::equal: Opc = BinaryOperator::Assign; break; |
| 279 | case tok::starequal: Opc = BinaryOperator::MulAssign; break; |
| 280 | case tok::slashequal: Opc = BinaryOperator::DivAssign; break; |
| 281 | case tok::percentequal: Opc = BinaryOperator::RemAssign; break; |
| 282 | case tok::plusequal: Opc = BinaryOperator::AddAssign; break; |
| 283 | case tok::minusequal: Opc = BinaryOperator::SubAssign; break; |
| 284 | case tok::lesslessequal: Opc = BinaryOperator::ShlAssign; break; |
| 285 | case tok::greatergreaterequal: Opc = BinaryOperator::ShrAssign; break; |
| 286 | case tok::ampequal: Opc = BinaryOperator::AndAssign; break; |
| 287 | case tok::caretequal: Opc = BinaryOperator::XorAssign; break; |
| 288 | case tok::pipeequal: Opc = BinaryOperator::OrAssign; break; |
| 289 | case tok::comma: Opc = BinaryOperator::Comma; break; |
| 290 | } |
| 291 | |
Steve Naroff | 26c8ea5 | 2007-03-21 21:08:52 +0000 | [diff] [blame^] | 292 | if (BinaryOperator::isMultiplicativeOp(Opc)) |
| 293 | CheckMultiplicativeOperands((Expr*)LHS, (Expr*)RHS); |
| 294 | else if (BinaryOperator::isAdditiveOp(Opc)) |
| 295 | CheckAdditiveOperands((Expr*)LHS, (Expr*)RHS); |
| 296 | else if (BinaryOperator::isShiftOp(Opc)) |
| 297 | CheckShiftOperands((Expr*)LHS, (Expr*)RHS); |
| 298 | else if (BinaryOperator::isRelationalOp(Opc)) |
| 299 | CheckRelationalOperands((Expr*)LHS, (Expr*)RHS); |
| 300 | else if (BinaryOperator::isEqualityOp(Opc)) |
| 301 | CheckEqualityOperands((Expr*)LHS, (Expr*)RHS); |
| 302 | else if (BinaryOperator::isBitwiseOp(Opc)) |
| 303 | CheckBitwiseOperands((Expr*)LHS, (Expr*)RHS); |
| 304 | else if (BinaryOperator::isLogicalOp(Opc)) |
| 305 | CheckLogicalOperands((Expr*)LHS, (Expr*)RHS); |
| 306 | |
Chris Lattner | e168f76 | 2006-11-10 05:29:30 +0000 | [diff] [blame] | 307 | return new BinaryOperator((Expr*)LHS, (Expr*)RHS, Opc); |
| 308 | } |
| 309 | |
| 310 | /// ParseConditionalOp - Parse a ?: operation. Note that 'LHS' may be null |
| 311 | /// in the case of a the GNU conditional expr extension. |
| 312 | Action::ExprResult Sema::ParseConditionalOp(SourceLocation QuestionLoc, |
| 313 | SourceLocation ColonLoc, |
| 314 | ExprTy *Cond, ExprTy *LHS, |
| 315 | ExprTy *RHS) { |
| 316 | return new ConditionalOperator((Expr*)Cond, (Expr*)LHS, (Expr*)RHS); |
| 317 | } |
| 318 | |
Steve Naroff | 26c8ea5 | 2007-03-21 21:08:52 +0000 | [diff] [blame^] | 319 | void Sema::CheckMultiplicativeOperands(Expr *op1, Expr *op2) { |
| 320 | } |
| 321 | |
| 322 | void Sema::CheckAdditiveOperands(Expr *op1, Expr *op2) { |
| 323 | } |
| 324 | |
| 325 | void Sema::CheckShiftOperands(Expr *op1, Expr *op2) { |
| 326 | } |
| 327 | |
| 328 | void Sema::CheckRelationalOperands(Expr *op1, Expr *op2) { |
| 329 | } |
| 330 | |
| 331 | void Sema::CheckEqualityOperands(Expr *op1, Expr *op2) { |
| 332 | } |
| 333 | |
| 334 | void Sema::CheckBitwiseOperands(Expr *op1, Expr *op2) { |
| 335 | } |
| 336 | |
| 337 | void Sema::CheckLogicalOperands(Expr *op1, Expr *op2) { |
| 338 | } |
| 339 | |