summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* When checking whether a return statement returns a stack-localDouglas Gregor2010-10-211-4/+11
| | | | | | | variable, handle conditional operators involving a throw-expression. Fixes GCC DejaGNU's g++.dg/template/cond4.C. llvm-svn: 117027
* Previously, the printf warnings would say your arguments type was 'int' when ↵Ted Kremenek2010-10-211-2/+5
| | | | | | | | | | it was really a 'char' or a 'short'. This fixes that and allows the hints to suggest 'h' modifiers for small ints. Patch by Justin Bogner! llvm-svn: 116996
* fix PR7885, rejecting invalid uses of __builtin_constant_p.Chris Lattner2010-10-121-0/+10
| | | | llvm-svn: 116317
* Track the location of the context requiring an implicit conversion and use itJohn McCall2010-10-081-29/+46
| | | | | | to white-list conversions required by system headers. rdar://problem/8232669 llvm-svn: 116029
* Fix an infinite loop, caused by unintended syntax bug (the 'break;' after ↵Argyrios Kyrtzidis2010-10-071-7/+3
| | | | | | | | 'default:' was intended to break out of the while loop). Fixes rdar://8518859&8520617. llvm-svn: 115985
* Provide a slightly specialized diagnostic for tautological comparisonsJohn McCall2010-10-061-4/+20
| | | | | | of an enum value. llvm-svn: 115725
* kill off CheckX86BuiltinFunctionCallChris Lattner2010-10-011-9/+0
| | | | llvm-svn: 115382
* move imperative code to declarative definitions.Chris Lattner2010-10-011-22/+0
| | | | llvm-svn: 115381
* diagnose errors when a builtin that require constant arguments don't have them.Chris Lattner2010-10-011-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | For example, on: #include <emmintrin.h> int foo(int N) { __m128i white2; white2 = _mm_slli_si128(white2, N); return 0; } we used to get: fatal error: error in backend: Cannot yet select: intrinsic %llvm.x86.sse2.psll.dq now we get: /Users/sabre/t.c:4:11: error: argument to '__builtin_ia32_pslldqi128' must be a constant integer white2 = _mm_slli_si128(white2, N); ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /Users/sabre/t.c:1: /Volumes/Projects/cvs/llvm/Debug+Asserts/lib/clang/2.9/include/emmintrin.h:781:13: note: instantiated from: ((__m128i)__builtin_ia32_pslldqi128((__m128i)(VEC), (IMM)*8)) ^ ~~~~~~~ 1 error generated. llvm-svn: 115374
* When warning about comparing an unsigned int to being >= 0, don't issue a ↵Ted Kremenek2010-09-231-1/+11
| | | | | | | | | warning if the zero value was an enum or was expanded from a macro. Fixes: <rdar://problem/8414119> llvm-svn: 114695
* fix rdar://8445858 - __sync_* intrinsics erroneously reject ObjC pointersChris Lattner2010-09-171-1/+1
| | | | llvm-svn: 114209
* Check format strings when a called function has more than one FormatAttr ↵Ted Kremenek2010-09-091-7/+10
| | | | | | (one for 'scanf' and one for 'printf'). Fixes <rdar://problem/8409437>. llvm-svn: 113472
* It appears that technically a null format string is not warned under ↵Ted Kremenek2010-09-091-0/+7
| | | | | | | | -Wformat-nonliteral, as the function processing the format string can decided whether or not to accept a null format string (e.g., asl_log). Fixes <rdar://problem/8269537>. llvm-svn: 113469
* Avoid redundant recursive calls in SemaCheckStringLiteral by just updating ↵Ted Kremenek2010-09-091-7/+5
| | | | | | | | the expression and trying again. llvm-svn: 113468
* Have Sema check for validity of CGString literalFariborz Jahanian2010-09-071-4/+17
| | | | | | instead of asserting in IRGen. Fixes radar 8390459. llvm-svn: 113253
* Enhance return-stack-address check (in Sema) to handle fields that ↵Ted Kremenek2010-09-021-3/+8
| | | | | | themselves are references. (Fixes PR 7999; fix by Chandler Carruth). llvm-svn: 112792
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-0/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-39/+39
| | | | | | to the new constants. llvm-svn: 112047
* More incremental progress towards not including Expr.h in Sema.h.John McCall2010-08-251-2/+2
| | | | llvm-svn: 112044
* Split FunctionScopeInfo and BlockScopeInfo into their own header.John McCall2010-08-251-0/+2
| | | | llvm-svn: 112038
* Remove Sema.h's dependency on DeclCXX.h.John McCall2010-08-251-0/+1
| | | | llvm-svn: 112032
* Fix printf format string checking for '%lc' (which expects a wint_t or ↵Ted Kremenek2010-08-241-0/+3
| | | | | | compatible argument). Fixes PR 7981. llvm-svn: 111978
* OwningExprResult -> ExprResult. This patch brought to you byJohn McCall2010-08-241-5/+5
| | | | | | | M-x query-replace-regexp \(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result llvm-svn: 111903
* Generate Attr subclasses with TableGen.Alexis Hunt2010-08-181-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | Now all classes derived from Attr are generated from TableGen. Additionally, Attr* is no longer its own linked list; SmallVectors or Attr* are used. The accompanying LLVM commit contains the updates to TableGen necessary for this. Some other notes about newly-generated attribute classes: - The constructor arguments are a SourceLocation and a Context&, followed by the attributes arguments in the order that they were defined in Attr.td - Every argument in Attr.td has an appropriate accessor named getFoo, and there are sometimes a few extra ones (such as to get the length of a variadic argument). Additionally, specific_attr_iterator has been introduced, which will iterate over an AttrVec, but only over attributes of a certain type. It can be accessed through either Decl::specific_attr_begin/end or the global functions of the same name. llvm-svn: 111455
* Convert all uses of StringLiteral::getStrData() to StringLiteral::getString()Benjamin Kramer2010-08-171-13/+8
| | | | | | and remove getStrData(). Patch by Peter Davies (with some tweaks). llvm-svn: 111229
* Remove dead code, caught by unused function warnings.Argyrios Kyrtzidis2010-08-151-1/+0
| | | | llvm-svn: 111091
* Zap unused UnaryOperator::OffsetOf.Eli Friedman2010-08-131-1/+0
| | | | llvm-svn: 110996
* Implement -Wcast-align. The initial design of this diagnostic diverges John McCall2010-08-121-0/+45
| | | | | | | | from GCC's in that we warn on *any* increase in alignment requirements, not just those that are enforced by hardware. Please let us know if this causes major problems for you (which it shouldn't, since it's an optional warning). llvm-svn: 110959
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-1/+1
| | | | llvm-svn: 110945
* Random temporary string cleanup.Benjamin Kramer2010-08-111-3/+1
| | | | llvm-svn: 110807
* Store inheritance paths after CastExprs instead of inside them.John McCall2010-08-071-5/+5
| | | | | | | | | | | | | | | This takes some trickery since CastExpr has subclasses (and indeed, is abstract). Also, smoosh the CastKind into the bitfield from Expr. Drops two words of storage from Expr in the common case of expressions which don't need inheritance paths. Avoids a separate allocation and another word of overhead in cases needing inheritance paths. Also has the advantage of not leaking memory, since destructors for AST nodes are never run. llvm-svn: 110507
* Teach SemaChecking::CheckReturnStackAddr about ImplicitCastExprs that ↵Ted Kremenek2010-08-041-3/+15
| | | | | | convert values to an lvalue. This allows us to warn (again) about returning references to stack variables. (fixes PR 7812). llvm-svn: 110242
* Add support for VFP status & control operations for ARM.Nate Begeman2010-08-031-0/+3
| | | | llvm-svn: 110153
* Wire up sema checking for __builtin_arm_usat and __builtin_arm_ssat immediates.Nate Begeman2010-07-291-0/+2
| | | | llvm-svn: 109814
* Revert r109428 "Hoist argument type checking into CheckFormatHandler. This ↵Michael J. Spencer2010-07-271-53/+41
| | | | | | | | is prep for scanf format" Got errors about ASTContext being undefined with Visual Studio 2010. llvm-svn: 109491
* Hoist argument type checking into CheckFormatHandler. This is prep for ↵Ted Kremenek2010-07-261-41/+53
| | | | | | | | scanf format string argument type checking. llvm-svn: 109428
* Consolidate #args checking for scanf/printf format strings.Ted Kremenek2010-07-261-30/+31
| | | | llvm-svn: 109427
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-2/+0
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* Vectors are not integer types, so the type system should not classifyDouglas Gregor2010-07-231-5/+5
| | | | | | | | | | | them as such. Type::is(Signed|Unsigned|)IntegerType() now return false for vector types, and new functions has(Signed|Unsigned|)IntegerRepresentation() cover integer types and vector-of-integer types. This fixes a bunch of latent bugs. Patch from Anton Yartsev! llvm-svn: 109229
* Hookup checking for invalid length modifiers in scanf format strings.Ted Kremenek2010-07-201-3/+11
| | | | llvm-svn: 108907
* Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace andTed Kremenek2010-07-201-6/+9
| | | | | | | derived 'PrintfConversionSpecifier' from this class. We will do the same for 'ScanfConversionSpecifier'. llvm-svn: 108903
* Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and ↵Ted Kremenek2010-07-201-1/+1
| | | | | | printf checking). llvm-svn: 108900
* Rename diagnostic so that it can be reused with scanf checking. No ↵Ted Kremenek2010-07-201-1/+1
| | | | | | functionality change. llvm-svn: 108896
* Don't warn when a '%%' or '%*d' (scanf) is used in a format string with ↵Ted Kremenek2010-07-191-22/+26
| | | | | | | | positional arguments, since these don't actually consume an argument. llvm-svn: 108757
* Hook up 'invalid conversion' warning for scanf format strings.Ted Kremenek2010-07-191-23/+59
| | | | llvm-svn: 108750
* Fix a goof in my previous patch -- not all of the builtins return a value, someChandler Carruth2010-07-181-1/+7
| | | | | | fixed return types. llvm-svn: 108657
* Improve the representation of the atomic builtins in a few ways. First, we makeChandler Carruth2010-07-181-34/+7
| | | | | | | | | | | | | | | their call expressions synthetically have the "deduced" types based on their first argument. We only insert conversions in the AST for arguments whose values require conversion to match the value type expected. This keeps PR7600 closed by maintaining the return type, but avoids assertions due to unexpected implicit casts making the type unsigned (test case added from Daniel). The magic is moved into the codegen for the atomic builtin which inserts the casts as needed at the IR level to raise the type to an integer suitable for the LLVM intrinsic. This shouldn't cause any real change in functionality, but now we can make the builtin be more truly polymorphic. llvm-svn: 108638
* Hook up warning for an incomplete scanlist in scanf format strings.Ted Kremenek2010-07-161-0/+8
| | | | llvm-svn: 108542
* Add most of the boilerplate support for scanf format string checking. This ↵Ted Kremenek2010-07-161-196/+292
| | | | | | | | | | | | | includes handling the parsing of scanf format strings and hooking the checking into Sema. Most of this checking logic piggybacks on what was already there for checking printf format strings, but the checking logic has been refactored to support both. What is left to be done is to support argument type checking in format strings and of course fix the usual tail of bugs that will follow. llvm-svn: 108500
* When forming a function call or message send expression, be sure toDouglas Gregor2010-07-131-1/+1
| | | | | | | | | | | | | | | | | strip cv-qualifiers from the expression's type when the language calls for it: in C, that's all the time, while C++ only does it for non-class types. Centralized the computation of the call expression type in QualType::getCallResultType() and some helper functions in other nodes (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant callers of getResultType() to getCallResultType(). Fixes PR7598 and PR7463, along with a bunch of getResultType() call sites that weren't stripping references off the result type (nothing stripped cv-qualifiers properly before this change). llvm-svn: 108234
OpenPOWER on IntegriCloud