summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change a whole lot of diagnostics to take QualType's directly Chris Lattner2008-11-241-3/+3
| | | | | | | | instead of converting them to strings first. This also fixes a bunch of minor inconsistencies in the diagnostics emitted by clang and adds a bunch of FIXME's to DiagnosticKinds.def. llvm-svn: 59948
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-3/+2
| | | | | | | | | | | | | | | | | | | | | with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
* merge some simple call diagnostics.Chris Lattner2008-11-211-7/+9
| | | | llvm-svn: 59831
* remove another old-school Diag method.Chris Lattner2008-11-201-11/+11
| | | | llvm-svn: 59712
* stop calling II::getName() unnecesarily in semaChris Lattner2008-11-191-4/+3
| | | | llvm-svn: 59609
* remove one more old-style Diag method.Chris Lattner2008-11-191-28/+28
| | | | llvm-svn: 59589
* Switch several more Sema Diag methods over. This simplifies theChris Lattner2008-11-191-63/+53
| | | | | | | | __builtin_prefetch code to only emit one diagnostic per builtin_prefetch. While this has nothing to do with the rest of the patch, the code seemed like overkill when I was updating it. llvm-svn: 59588
* Updated IdentifierResolver to deal with DeclarationNames. The names ofDouglas Gregor2008-11-171-1/+6
| | | | | | | | | | | | | | | | | | | | | C++ constructors, destructors, and conversion functions now have a FETokenInfo field that IdentifierResolver can access, so that these special names are handled just like ordinary identifiers. A few other Sema routines now use DeclarationNames instead of IdentifierInfo*'s. To validate this design, this code also implements parsing and semantic analysis for id-expressions that name conversion functions, e.g., return operator bool(); The new parser action ActOnConversionFunctionExpr takes the result of parsing "operator type-id" and turning it into an expression, using the IdentifierResolver with the DeclarationName of the conversion function. ActOnDeclarator pushes those conversion function names into scope so that the IdentifierResolver can find them, of course. llvm-svn: 59462
* Implement initialization of a reference (C++ [dcl.init.ref]) as partDouglas Gregor2008-10-291-1/+1
| | | | | | | | | | | | | | | | | | | of copy initialization. Other pieces of the puzzle: - Try/Perform-ImplicitConversion now handles implicit conversions that don't involve references. - Try/Perform-CopyInitialization uses CheckSingleAssignmentConstraints for C. PerformCopyInitialization is now used for all argument passing and returning values from a function. - Diagnose errors with declaring references and const values without an initializer. (Uses a new Action callback, ActOnUninitializedDecl). We do not yet have implicit conversion sequences for reference binding, which means that we don't have any overloading support for reference parameters yet. llvm-svn: 58353
* Rename ExplicitCCastExpr to CStyleCastExprDouglas Gregor2008-10-281-1/+1
| | | | llvm-svn: 58331
* Refactor the expression class hierarchy for casts. Most importantly:Douglas Gregor2008-10-271-19/+18
| | | | | | | | | | | | | | | | | | | | | | - CastExpr is the root of all casts - ImplicitCastExpr is (still) used for all explicit casts - ExplicitCastExpr is now the root of all *explicit* casts - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++ - CXXFunctionalCastExpr inherits from ExplicitCastExpr - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all of the C++ named cast expression types (static_cast, dynamic_cast, etc.) - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, CXXReinterpretCastExpr, and CXXConstCastExpr to Also, fixed returned-stack-addr.cpp, which broke once when we fixed reinterpret_cast to diagnose double->int* conversions and again when we eliminated implicit conversions to reference types. The fix is in both testcase and SemaChecking.cpp. Most of this patch is simply support for the renaming. There's very little actual change in semantics. llvm-svn: 58264
* Add support for format string checking of object-size checkingDaniel Dunbar2008-10-021-12/+20
| | | | | | | versions of sprintf and friends. - Added FIXME that this mechanism should be generalized. llvm-svn: 56962
* Sema::ActOnBlockReturnStmt(): Need to perform the UsualUnaryConversions on ↵Steve Naroff2008-09-161-1/+6
| | | | | | | | | the return type. Sema::CheckReturnStackAddr(): Make sure we skip over implicit casts. Added some more test cases... llvm-svn: 56254
* More semantic analysis for blocks...Steve Naroff2008-09-101-2/+2
| | | | llvm-svn: 56064
* More type checking for blocks. Still incomplete (will hopefully finish up ↵Steve Naroff2008-09-051-4/+11
| | | | | | this weekend). llvm-svn: 55862
* Add __builtin_object_size support.Daniel Dunbar2008-09-031-4/+29
| | | | | | | - Currently CodeGen always returns a conservative value for this (-1 or 0 depending on the context). llvm-svn: 55735
* Add ExplicitCastExpr to replace the current CastExpr, and have ↵Argyrios Kyrtzidis2008-08-181-8/+2
| | | | | | | | | | | ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr): Expr -> CastExpr -> ExplicitCastExpr -> ImplicitCastExpr llvm-svn: 54955
* More #include cleaningDaniel Dunbar2008-08-111-9/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* More #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | | - Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h - Moved Sema::getCurMethodDecl() out of line (dependent on ObjCMethodDecl via dyn_cast). llvm-svn: 54629
* tighten up some code and some wording on diagnostics.Chris Lattner2008-08-101-27/+19
| | | | llvm-svn: 54607
* Fix <rdar://problem/6125909>.Ted Kremenek2008-08-071-18/+14
| | | | | | Unify logic in return-of-stack-check (Sema) for casts and implicit casts. llvm-svn: 54439
* change more instances of QualType::getCanonicalType to callChris Lattner2008-07-261-2/+2
| | | | | | ASTContext::getCanonicalType instead (PR2189) llvm-svn: 54105
* Format string errors should underling the format string, not the function name.Ted Kremenek2008-07-251-12/+15
| | | | llvm-svn: 54067
* Implement nans, prefetch, and trap builtins. Daniel Dunbar2008-07-211-0/+53
| | | | | | | This closes <rdar://problem/6080720>, support for __builtin_constant_p has been filed separately. llvm-svn: 53885
* Extend va_start checking to include __builtin_stdarg_start.Ted Kremenek2008-07-091-0/+1
| | | | llvm-svn: 53332
* Make a few related changes:Chris Lattner2008-06-301-2/+1
| | | | | | | | | | | | | | 1) add a new ASTContext::getFloatTypeSemantics method. 2) Use it from SemaExpr.cpp, CodeGenTypes.cpp and other places. 3) Change the TargetInfo.h get*Format methods to return their fltSemantics byref instead of by pointer. 4) Change CodeGenFunction::EmitBuiltinExpr to allow builtins which sometimes expand specially and othertimes fall back to libm. 5) Add support for __builtin_nan("") to codegen, cases that don't pass in an empty string are currently lowered to libm calls. 6) Fix codegen of __builtin_infl. llvm-svn: 52914
* Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() ↵Argyrios Kyrtzidis2008-06-281-6/+6
| | | | | | and getCurMethodDecl() that return the appropriate Decl through CurContext. llvm-svn: 52852
* Introduce preliminary support for NSString format-string checking.Ted Kremenek2008-06-161-2/+34
| | | | | | Patch by Nikita Zhuk! llvm-svn: 52336
* Add __builtin_frame_address and __builtin_return_address gcc builtins to Eli Friedman2008-05-201-1/+16
| | | | | | Sema. No codegen yet. llvm-svn: 51307
* Review nit.Eli Friedman2008-05-161-2/+2
| | | | llvm-svn: 51196
* Clean up ownership per review comment.Eli Friedman2008-05-161-24/+13
| | | | llvm-svn: 51195
* Fixed another regression introduced by r51113 caused by some refactoringTed Kremenek2008-05-151-3/+3
| | | | | | | | | | | | | | in Sema::CheckFunctionCall: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080512/005706.html The bug was that the logic from the helper methods used by CheckFunctionCall were being inverted (a subtle bug). This would cause the parser to discard any valid AST nodes involving several builtins (see patch). This removes the last regression failure I'm seeing in the test suite: Analysis-Apple/NoReturn. llvm-svn: 51168
* Implementation of __builtin_shufflevector, a portable builtin capable of Eli Friedman2008-05-141-7/+93
| | | | | | | | | expressing the full flexibility of the LLVM shufflevector instruction. The expected immediate usage is in *mmintrin.h, so that they don't depend on the mess of gcc-inherited (and not completely implemented) shuffle builtins. llvm-svn: 51113
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+802
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
OpenPOWER on IntegriCloud