summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Constant expression evaluation: support for evaluation of structs and unions ofRichard Smith2011-11-101-3/+3
| | | | | | | literal types, as well as derived-to-base casts for lvalues and derived-to-virtual-base casts. llvm-svn: 144265
* There's no good reason to track temporaries in ExprWithCleanups,John McCall2011-11-101-0/+6
| | | | | | | but it is sometimes useful to track blocks. Do so. Also optimize the storage of these expressions. llvm-svn: 144263
* Mark the overloaded atomic builtins as having custom type checking,Douglas Gregor2011-11-081-8/+0
| | | | | | | | | which they do. This avoids all of the default argument promotions that we (1) don't want, and (2) undo during that custom type checking, and makes sure that we don't run into trouble during template instantiation. Fixes PR11320. llvm-svn: 144110
* Check pointer types for arguments of Neon load/store macros. rdar://9958031Bob Wilson2011-11-081-3/+54
| | | | | | | | | | | The Neon load/store intrinsics need to be implemented as macros to avoid hiding alignment attributes on the pointer arguments, and the macros can only evaluate those pointer arguments once (in case they have side effects), so it has been hard to get the right type checking for those pointers. I tried various alternatives in the arm_neon.h header, but it's much more straightforward to just check directly in Sema. llvm-svn: 144075
* Clean up type flags for overloaded Neon builtins. No functional change.Bob Wilson2011-11-081-23/+21
| | | | | | | | | This patch just adds a simple NeonTypeFlags class to replace the various hardcoded constants that had been used until now. Unfortunately I couldn't figure out a good way to avoid duplicating that class between clang and TableGen, but since it's small and rarely changes, that's not so bad. llvm-svn: 144054
* Rip out CK_GetObjCProperty.John McCall2011-11-071-16/+0
| | | | llvm-svn: 143910
* Change the AST representation of operations on Objective-CJohn McCall2011-11-061-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
* Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it willRichard Smith2011-10-291-3/+3
| | | | | | | | implicitly perform an lvalue-to-rvalue conversion if used on an lvalue expression. Also improve the documentation of Expr::Evaluate* to indicate which of them will accept expressions with side-effects. llvm-svn: 143263
* Fix for PR9751 to change the behavior of -Wformat warnings. If the formatRichard Trieu2011-10-281-117/+218
| | | | | | | | | | | string is part of the function call, then there is no difference. If the format string is not, the warning will point to the call site and a note will point to where the format string is. Fix-it hints for strings are moved to the note if a note is emitted. This will prevent changes to format strings that may be used in multiple places. llvm-svn: 143168
* Restore r142914 and r142915, now with missing file and apparentJohn McCall2011-10-251-1/+2
| | | | | | GCC compiler workaround. llvm-svn: 142931
* Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi2011-10-251-2/+1
| | | | | | r142914: "Introduce a placeholder type for "pseudo object"" r142915: "Pull the pseudo-object stuff into its own file." llvm-svn: 142921
* Introduce a placeholder type for "pseudo object"John McCall2011-10-251-1/+2
| | | | | | | | | | | | | | | expressions: expressions which refer to a logical rather than a physical l-value, where the logical object is actually accessed via custom getter/setter code. A subsequent patch will generalize the AST for these so that arbitrary "implementing" sub-expressions can be provided. Right now the only client is ObjC properties, but this should be generalizable to similar language features, e.g. Managed C++'s __property methods. llvm-svn: 142914
* Only emit implicit constant conversion truncation warnings in reachable ↵Ted Kremenek2011-10-221-3/+5
| | | | | | code. Apparently this is what GCC does, and some code depends on this. Fixes <rdar://problem/10321089>. llvm-svn: 142716
* Move static array parameter checks to SemaExpr, per Doug's requestPeter Collingbourne2011-10-191-61/+0
| | | | llvm-svn: 142465
* Suggest %zu for size_t args to printf.Hans Wennborg2011-10-181-1/+1
| | | | | | | | For PR11152. Make PrintSpecifier::fixType() suggest "%zu" for size_t, etc. rather than looking at the underlying type and suggesting "%llu" or other platform-specific length modifiers. Applies to C99 and C++11. llvm-svn: 142342
* Add sema checks for calls to functions taking static array parametersPeter Collingbourne2011-10-161-0/+61
| | | | llvm-svn: 142157
* Add template instantiation support for AtomicExpr.Eli Friedman2011-10-141-22/+15
| | | | llvm-svn: 142012
* Only warn in -Wliteral-conversion if the conversion loses informationMatt Beaumont-Gay2011-10-141-19/+7
| | | | llvm-svn: 141955
* Extend -Wno-sizeof-array-argument to strncpy and friends.Nico Weber2011-10-131-4/+43
| | | | | | This finds 2 bugs in chromium and 1 in hunspell, with 0 false positives. llvm-svn: 141902
* Initial implementation of __atomic_* (everything except __atomic_is_lock_free).Eli Friedman2011-10-111-0/+170
| | | | llvm-svn: 141632
* Constant expression evaluation refactoring:Richard Smith2011-10-101-11/+4
| | | | | | | | | | | - Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions, and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert behaviour. - Factor out evaluation of bitfield bit widths. - Fix a few places which would evaluate an expression twice: once to determine whether it is a constant expression, then again to get the value. llvm-svn: 141561
* Don't analyze comparisons in type- or value-dependentDouglas Gregor2011-10-101-0/+3
| | | | | | subexpressions. Fixes PR10291. llvm-svn: 141552
* Rename TagDecl::isDefinition -> isCompleteDefinitionJohn McCall2011-10-071-1/+1
| | | | | | | for better self-documenting code, since the semantics are subtly different from getDefinition(). llvm-svn: 141355
* Refactor the analysis of C++ cast expressions so that evenJohn McCall2011-10-051-7/+8
| | | | | | | | C-style and functional casts are built in SemaCXXCast.cpp. Introduce a helper class to encapsulate most of the random state being passed around, at least one level down. llvm-svn: 141170
* Do not warn about empty format strings when there are no data arguments. ↵Ted Kremenek2011-09-291-7/+6
| | | | | | Fixes <rdar://problem/9473155>. llvm-svn: 140777
* Unnecessary elseDavid Blaikie2011-09-291-2/+1
| | | | llvm-svn: 140775
* Only print _Bool as 'bool' when 'bool' is defined as an object-likeDouglas Gregor2011-09-271-1/+1
| | | | | | macro whose only replacement token is '_Bool'. llvm-svn: 140656
* When 'bool' is not a built-in type but is defined as a macro, printDouglas Gregor2011-09-271-1/+1
| | | | | | | 'bool' rather than '_Bool' within types, to make things a bit more readable. Fixes <rdar://problem/10063263>. llvm-svn: 140650
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-1/+1
| | | | llvm-svn: 140478
* Add a new warning to -Wliteral-conversion to catch cases where a string literalRichard Trieu2011-09-231-5/+21
| | | | | | | | | | | | | | is cast to a boolean. An exception has been made for string literals in logical expressions to allow the common case of use in assert statements. bool x; x = "hi"; // Warn here void foo(bool x); foo("hi"); // Warn here assert(0 && "error"); assert("error); // Warn here llvm-svn: 140405
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-1/+1
| | | | llvm-svn: 140367
* Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.Argyrios Kyrtzidis2011-09-191-1/+1
| | | | | | It already works (and is useful with) macro locs as well. llvm-svn: 140057
* Let -Warray-bounds handle casted array types without false positives.Nico Weber2011-09-171-1/+1
| | | | | | Fixes PR10771. llvm-svn: 139990
* Finish the lex->LHS and rex->RHS cleanup in Sema.Richard Trieu2011-09-151-22/+19
| | | | llvm-svn: 139856
* Refactoring, mostly to give ObjCPropertyDecls stronger invariants forJohn McCall2011-09-131-4/+1
| | | | | | their semantic attributes and then to take advantage of that. llvm-svn: 139615
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-101-3/+3
| | | | llvm-svn: 139466
* Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: canJulien Lerouge2011-09-091-1/+17
| | | | | | | annotate global, local variables, struct fields, or arbitrary statements (using the __builtin_annotation), rdar://8037476. llvm-svn: 139423
* When type-checking a call to an overloaded, builtin atomic operation,Douglas Gregor2011-09-091-4/+11
| | | | | | | construct a new DeclRefExpr rather than re-using the existing DeclRefExpr. Patch by Likai Liu, fixes PR8345. llvm-svn: 139373
* The integer type of an enumeration type isn't always canonicalDouglas Gregor2011-09-081-1/+1
| | | | llvm-svn: 139334
* Extend -Wliteral-conversion to catch "int i = -1.234"Matt Beaumont-Gay2011-09-081-0/+5
| | | | llvm-svn: 139326
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-1/+1
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* The lvalue-to-rvalue on structs in C++ is actually partJohn McCall2011-08-271-0/+29
| | | | | | | of default argument promotion and needs to happen unconditionally. This is particularly semantically important in C++0x. llvm-svn: 138691
* Improve the correctness and accuracy of the message for ↵Matt Beaumont-Gay2011-08-191-10/+13
| | | | | | -Wdynamic-class-memaccess llvm-svn: 138074
* Enhance -Wstrl-incorrect-size to not report a FIXIT for destinations that ↵Ted Kremenek2011-08-181-10/+18
| | | | | | are flexible arrays or have size 1. llvm-svn: 138004
* Reapply r137903, but fix the definition of size_t in the test case to use ↵Ted Kremenek2011-08-181-1/+96
| | | | | | | | __SIZE_TYPE__ (and hence be portable). Also, change the warning to -Wstrl-incorrect-size. llvm-svn: 137980
* Revert r137903, "Add experimental -Wstrlcpy-size warning that looks to see ↵Ted Kremenek2011-08-181-96/+1
| | | | | | | | if the size argument for strlcpy/strlcat is the size of the *source*, and not the size of the *destination*. This warning is off by default (for now)." This currently doesn't work on Windows. llvm-svn: 137920
* Add experimental -Wstrlcpy-size warning that looks to see if the size ↵Ted Kremenek2011-08-171-1/+96
| | | | | | | | argument for strlcpy/strlcat is the size of the *source*, and not the size of the *destination*. This warning is off by default (for now). Warning logic provided by Geoff Keating. llvm-svn: 137903
* Add a test case for the divide-by-zero fix in r137234Kaelyn Uhrain2011-08-101-0/+1
| | | | llvm-svn: 137240
* Make sure ptrarith_typesize is at least 1 to avoid division by zeroKaelyn Uhrain2011-08-101-0/+1
| | | | llvm-svn: 137234
* Only look at decls after the current one when checking if it's the last ↵Benjamin Kramer2011-08-061-10/+6
| | | | | | field in a record. llvm-svn: 137009
OpenPOWER on IntegriCloud