summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix PR6159 and several other problems with value-dependent non-type templateChandler Carruth2010-01-311-9/+31
| | | | | | | | | | | | | arguments. This both prevents meaningless checks on these arguments and ensures that they are represented as an expression by the instantiation. Cleaned up and added standard text to the relevant test case. Also started adding tests for *rejected* cases. At least one FIXME here where (I think) we allow something we shouldn't. More to come in the area of rejecting crazy arguments with decent diagnostics. Suggestions welcome for still better diagnostics on these errors! llvm-svn: 94953
* Rework base and member initialization in constructors, with severalDouglas Gregor2010-01-315-249/+385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (necessarily simultaneous) changes: - CXXBaseOrMemberInitializer now contains only a single initializer rather than a set of initialiation arguments + a constructor. The single initializer covers all aspects of initialization, including constructor calls as necessary but also cleanup of temporaries created by the initializer (which we never handled before!). - Rework + simplify code generation for CXXBaseOrMemberInitializers, since we can now just emit the initializer as an initializer. - Switched base and member initialization over to the new initialization code (InitializationSequence), so that it - Improved diagnostics for the new initialization code when initializing bases and members, to match the diagnostics produced by the previous (special-purpose) code. - Simplify the representation of type-checked constructor initializers in templates; instead of keeping the fully-type-checked AST, which is rather hard to undo at template instantiation time, throw away the type-checked AST and store the raw expressions in the AST. This simplifies instantiation, but loses a little but of information in the AST. - When type-checking implicit base or member initializers within a dependent context, don't add the generated initializers into the AST, because they'll look like they were explicit. - Record in CXXConstructExpr when the constructor call is to initialize a base class, so that CodeGen does not have to infer it from context. This ensures that we call the right kind of constructor. There are also a few "opportunity" fixes here that were needed to not regress, for example: - Diagnose default-initialization of a const-qualified class that does not have a user-declared default constructor. We had this diagnostic specifically for bases and members, but missed it for variables. That's fixed now. - When defining the implicit constructors, destructor, and copy-assignment operator, set the CurContext to that constructor when we're defining the body. llvm-svn: 94952
* Handle instantiation of templates with non-type arguments expressed with anChandler Carruth2010-01-311-0/+16
| | | | | | | explicit '&' by introducing an address-of operator prior to checking the argument's type. llvm-svn: 94947
* Remove the SmallVectors from AsmStmt. Fixes PR6105.Anders Carlsson2010-01-301-3/+3
| | | | llvm-svn: 94926
* Use IdentifierInfo * instead of std::string for the AsmStmt names.Anders Carlsson2010-01-303-8/+16
| | | | llvm-svn: 94925
* More asm cleanup.Anders Carlsson2010-01-301-1/+7
| | | | llvm-svn: 94920
* Combine AsmStmt::setOutputsAndInputs and AsmStmt::setClobbers.Anders Carlsson2010-01-301-6/+3
| | | | llvm-svn: 94918
* StringRef-ize the TargetInfo::ConstraintInfo constructor.Anders Carlsson2010-01-301-5/+2
| | | | llvm-svn: 94916
* Eliminate yet another old-school PerformCopyInitialization.Anders Carlsson2010-01-301-1/+3
| | | | llvm-svn: 94874
* Add basic type checking of format string conversion specifiers and their ↵Ted Kremenek2010-01-301-6/+63
| | | | | | arguments. Thanks to Cristian Draghici for his help with this patch! llvm-svn: 94864
* Be a little more permissive than C99: allow 'unsigned' to be used forTed Kremenek2010-01-291-2/+6
| | | | | | | the field width and precision of a format specifier instead of just 'int'. This matches GCC, and fixes <rdar://problem/6079850>. llvm-svn: 94856
* Switch Sema over to using the new implementation of format stringTed Kremenek2010-01-292-275/+39
| | | | | | | | | checking. It passes all existing tests, and the diagnostics have been refined to provide better range information (we now highlight individual format specifiers) and more precise wording in the diagnostics. llvm-svn: 94837
* Fix reference-binding when we have a reference to const volatile type;Douglas Gregor2010-01-292-1/+3
| | | | | | | previously, we were allowing this to bind to a temporary. Now, we don't; add test-cases and improve diagnostics. llvm-svn: 94831
* Fix reference binding of const lvalue references to bit-fields, whichDouglas Gregor2010-01-292-3/+207
| | | | | | | | | | | | | | | | | requires a temporary. Previously, we were building an initialization sequence that bound to the bit-field as if it were a real lvalue. Note that we previously (and still) diagnose binding of non-const references to bit-fields, as we should. There's no real way to test that this code is correct, since reference binding does not *currently* have any representation in the AST. This fix should make it easier for that to happen, so I've verified this fix with... Added InitializationSequence::dump(), to print an initialization sequence for debugging purposes. llvm-svn: 94826
* And yet another call.Anders Carlsson2010-01-291-2/+8
| | | | llvm-svn: 94824
* Another PerformCopyInitialization call bites the dust.Anders Carlsson2010-01-291-4/+12
| | | | llvm-svn: 94823
* Get rid of another old PerformCopyInitialization call.Anders Carlsson2010-01-291-4/+12
| | | | llvm-svn: 94819
* When naming a function template via a qualified-id (or any other wayDouglas Gregor2010-01-291-1/+1
| | | | | | | | that ADL is suppressed), we need to build an UnresolvedLookupExpr. Fixes PR6063, which was hitting Boost headers pretty hard. llvm-svn: 94814
* Alternate format string checking: issue warnings for incomplete format ↵Ted Kremenek2010-01-291-12/+19
| | | | | | | | | | specifiers. In addition, move ParseFormatString() and FormatStringHandler() from the clang::analyze_printf to the clang namespace. Hopefully this will resolve some link errors on Linux. llvm-svn: 94794
* Simplify InitListChecker::CheckReferenceTypeAnders Carlsson2010-01-291-11/+10
| | | | llvm-svn: 94793
* Alternate format string checking: issue a warning for invalid conversion ↵Ted Kremenek2010-01-291-8/+27
| | | | | | specifiers. llvm-svn: 94792
* Add an CXXBindReferenceExpr (not used just yet).Anders Carlsson2010-01-291-0/+10
| | | | llvm-svn: 94791
* Alternate format string checking: check for excess data arguments.Ted Kremenek2010-01-291-0/+11
| | | | llvm-svn: 94787
* Alternate format string checking: check if the number of format specifiers ↵Ted Kremenek2010-01-291-0/+12
| | | | | | exceeds the number of arguments. llvm-svn: 94785
* Alternate format string checking: warn of '%n' as being potentially insecure.Ted Kremenek2010-01-291-1/+11
| | | | llvm-svn: 94782
* Add precision/field width checking to AlternateCheckPrintfString().Ted Kremenek2010-01-291-3/+68
| | | | llvm-svn: 94774
* Start fleshing out Sema::AlternateCheckPrintfString():Ted Kremenek2010-01-282-2/+99
| | | | | | | | | | - Add an anonymous class 'CheckPrintfHandler' which will do the checking of specific format specifiers - Add checking for using the '@' conversion specifier outside an ObjC string literal - Add checking for null characters within the string llvm-svn: 94761
* Access control for surrogate function calls. Required a moderately gross hackJohn McCall2010-01-282-3/+8
| | | | | | to get the access bits set properly in conversion sets. llvm-svn: 94744
* Access control for overloaded call operators. Not for surrogates yet,John McCall2010-01-281-0/+5
| | | | | | | | mostly because we're going to want a better diagnostic for conversions. Also this API needs to go back to sanity. llvm-svn: 94730
* Access checking for overloaded operators.John McCall2010-01-283-5/+32
| | | | llvm-svn: 94725
* Add placeholder function in Sema for new format string checking logic.Ted Kremenek2010-01-282-1/+25
| | | | | | | | This function will use the format string parsing logic in libAnalysis, and once it is shown to be better than the current implementation it will replace AlternateCheckPrintfString() entirely. llvm-svn: 94721
* Fix 80 col violation.Ted Kremenek2010-01-281-1/+3
| | | | llvm-svn: 94717
* Remove invalid conversion specifiers from format string checking.Ted Kremenek2010-01-281-5/+0
| | | | llvm-svn: 94707
* Fix a major oversight in the comparison of standard conversionDouglas Gregor2010-01-274-39/+81
| | | | | | | | | | | | | | sequences, where we would occasionally determine (incorrectly) that one standard conversion sequence was a proper subset of another when, in fact, they contained completely incomparable conversions. This change records the types in each step within a standard conversion sequence, so that we can check the specific comparison types to determine when one sequence is a proper subset of the other. Fixes this testcase (thanks, Anders!), which was distilled from PR6095 (also thanks to Anders). llvm-svn: 94660
* Implement access-check delays for out-of-line member definitionsJohn McCall2010-01-273-28/+136
| | | | | | using the same framework we use for deprecation warnings. llvm-svn: 94659
* Implement access control for overloaded functions. Suppress access controlJohn McCall2010-01-277-95/+182
| | | | | | | diagnostics in "early" lookups, such as during typename checks and when building unresolved lookup expressions. llvm-svn: 94647
* Avoid some unnecessary copying of unresolved lookup results.John McCall2010-01-261-16/+12
| | | | llvm-svn: 94531
* Handle redeclarations found by ADL deterministically and reasonably.John McCall2010-01-264-16/+87
| | | | | | | | | This solution relies on an O(n) scan of redeclarations, which means it might scale poorly in crazy cases with tons of redeclarations brought in by a ton of distinct associated namespaces. I believe that avoiding this is not worth the common-case cost. llvm-svn: 94530
* Correctly treat 64 bit integers specified via the mode attribute as the 'long'Chandler Carruth2010-01-261-2/+8
| | | | | | | | | | type when that type is 64 bits wide, and the 'long long' type when 'long' is only 32 bits wide. This fixes PR6108. Also adds a bunch of test cases to ensure proper conversion between equally sized standard types and mode-specified types on both 32 and 64 bit targets. llvm-svn: 94527
* Allow ADL to find functions imported by using decls. Leave wordy commentJohn McCall2010-01-262-12/+21
| | | | | | about interaction between ADL and default arguments. Shrug shoulders, commit. llvm-svn: 94524
* Preserve access bits through overload resolution much better. SomeJohn McCall2010-01-266-103/+86
| | | | | | general refactoring in operator resolution. llvm-svn: 94498
* Pass access specifiers around in overload resolution.John McCall2010-01-267-54/+107
| | | | llvm-svn: 94485
* Code simplification; this should have no visible effects.Eli Friedman2010-01-251-33/+2
| | | | llvm-svn: 94427
* Split libAnalysis into two libraries: libAnalysis and libChecker.Ted Kremenek2010-01-253-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | (1) libAnalysis is a generic analysis library that can be used by Sema. It defines the CFG, basic dataflow analysis primitives, and inexpensive flow-sensitive analyses (e.g. LiveVariables). (2) libChecker contains the guts of the static analyzer, incuding the path-sensitive analysis engine and domain-specific checks. Now any clients that want to use the frontend to build their own tools don't need to link in the entire static analyzer. This change exposes various obvious cleanups that can be made to the layout of files and headers in libChecker. More changes pending. :) This change also exposed a layering violation between AnalysisContext and MemRegion. BlockInvocationContext shouldn't explicitly know about BlockDataRegions. For now I've removed the BlockDataRegion* from BlockInvocationContext (removing context-sensitivity; although this wasn't used yet). We need to have a better way to extend BlockInvocationContext (and any LocationContext) to add context-sensitivty. llvm-svn: 94406
* -fno-rtti is now the default.Chris Lattner2010-01-241-1/+0
| | | | llvm-svn: 94379
* Implement [dcl.fct.spec]p6.Anders Carlsson2010-01-241-0/+22
| | | | llvm-svn: 94365
* Implement instantiation of AsmStmts (Crazy, I know)Anders Carlsson2010-01-243-5/+90
| | | | llvm-svn: 94361
* fix PR6034, a crash on invalid where the switch stack would get Chris Lattner2010-01-242-0/+12
| | | | | | unbalanced. llvm-svn: 94347
* Use new initialization code when dealing with [dcl.init.aggr]p12. This fixes ↵Anders Carlsson2010-01-241-16/+28
| | | | | | the bug where array elements and member initializers weren't copied correctly. llvm-svn: 94340
* Change all InitializedEntity pointers over to be references.Anders Carlsson2010-01-231-137/+81
| | | | llvm-svn: 94335
OpenPOWER on IntegriCloud