summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
Commit message (Collapse)AuthorAgeFilesLines
* Consumed analysis: change class name in test cases.DeLesley Hutchins2013-08-232-55/+55
| | | | | | | The name of a class used in the testing files was updated to actually be descriptive. Patch by chris.wailes@gmail.com. llvm-svn: 189132
* Reword a diagnostic to avoid a confusing implication that it might be talkingRichard Smith2013-08-232-2/+2
| | | | | | about a declaration within a return type. llvm-svn: 189083
* Update to consumed analysis.DeLesley Hutchins2013-08-221-0/+23
| | | | | | | | | | | Patch by chris.wailes@gmail.com. The following functionality was added: * The same functionality is now supported for both CXXOperatorCallExprs and CXXMemberCallExprs. * Factored out some code in StmtVisitor. * Removed variables from the state map when their destructors are encountered. * Started adding documentation for the consumed analysis attributes. llvm-svn: 189059
* Add a constexpr functionality test for static data member templates.Larisse Voufo2013-08-221-0/+19
| | | | llvm-svn: 188975
* Refactor for clarity and simplicity.Larisse Voufo2013-08-222-77/+79
| | | | llvm-svn: 188974
* Improve support for static data member templates. This revision still has at ↵Larisse Voufo2013-08-221-8/+57
| | | | | | least one bug, as it does not respect the variable template specialization hierarchy well. llvm-svn: 188969
* Split isFromMainFile into two functions.Eli Friedman2013-08-221-0/+9
| | | | | | | | | Basically, isInMainFile considers line markers, and isWrittenInMainFile doesn't. Distinguishing between the two is useful when dealing with files which are preprocessed files or rewritten with -frewrite-includes (so we don't, for example, print useless warnings). llvm-svn: 188968
* Fix the end sourcelocation of the call expression in a member access whenNick Lewycky2013-08-211-0/+10
| | | | | | recovering by adding empty parenthesis. Fixes PR16676! llvm-svn: 188920
* Sema: Use the right type for PredefinedExpr when it's in a lambda.Benjamin Kramer2013-08-211-0/+40
| | | | | | | | | | | | | 1. We now print the return type of lambdas and return type deduced functions as "auto". Trailing return types with decltype print the underlying type. 2. Use the lambda or block scope for the PredefinedExpr type instead of the parent function. This fixes PR16946, a strange mismatch between type of the expression and the actual result. 3. Verify the type in CodeGen. 4. The type for blocks is still wrong. They are numbered and the name is not known until CodeGen. llvm-svn: 188900
* If we find an error in the range expression in a range-based for loop, and theRichard Smith2013-08-212-3/+12
| | | | | | | loop variable has a type containing 'auto', set the declaration to be invalid (because we couldn't deduce its type) to prevent follow-on errors. llvm-svn: 188853
* PR16727: don't try to evaluate a potentially value-dependent expression whenRichard Smith2013-08-191-0/+8
| | | | | | checking for missing parens in &&/|| expressions. llvm-svn: 188716
* Refactor all diagnosing of TypoCorrections through a common function, inRichard Smith2013-08-171-4/+4
| | | | | | | preparation for teaching this function how to diagnose a correction that includes importing a module. llvm-svn: 188602
* Don't reject attribute used in an "extern const" variable definition.Rafael Espindola2013-08-161-0/+5
| | | | | | | Before this patch we would warn and drop the attribute in extern const char test3[] __attribute__((used)) = ""; llvm-svn: 188588
* Thread safety analysis: new test caseDeLesley Hutchins2013-08-161-0/+7
| | | | llvm-svn: 188571
* Don't allow unary negation on scoped enums.Eli Friedman2013-08-161-0/+5
| | | | | | PR16900. llvm-svn: 188511
* Thread Safety Analysis: fix bug when using TryLock with && and || expressions.DeLesley Hutchins2013-08-151-40/+83
| | | | llvm-svn: 188505
* PR16875: The return type of a dependent function type is visible when it'sRichard Smith2013-08-141-0/+23
| | | | | | | | | | | referenced as a member of the current instantiation. In that case, deduce the type of the function to a dependent type rather than exposing an undeduced auto type to the rest of the current instantiation. The standard doesn't really say that the type is dependent in this case; I'll bring this up with CWG. llvm-svn: 188410
* Bug fix: note diagnosis on expression narrowing should say "variable ↵Larisse Voufo2013-08-141-1/+10
| | | | | | template" instead of "static data member" when appropriate llvm-svn: 188409
* Bug fix: disallow a variable template to be redeclared as a non-templated ↵Larisse Voufo2013-08-141-1/+4
| | | | | | variable llvm-svn: 188350
* Don't produce duplicate notes if we have deduction failure notes when resolvingRichard Smith2013-08-142-6/+4
| | | | | | the address of an overloaded function template. llvm-svn: 188334
* sizeof(void) etc. should be a hard error in C++.Eli Friedman2013-08-133-6/+4
| | | | | | PR16872. llvm-svn: 188324
* Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:Richard Smith2013-08-131-8/+13
| | | | | | | | | | | | | When a local extern declaration redeclares some other entity, the type of that entity is merged with the prior type if the prior declaration is visible (in C) or is declared in the same scope (in C++). - Make LookupRedeclarationWithLinkage actually work in C++, use it in the right set of cases, and make it track whether it found a shadowed declaration. - Track whether we found a declaration in the same scope (for C++) including across serialization and template instantiation. llvm-svn: 188307
* variable templates updated for PCH serialization... Still working on test ↵Larisse Voufo2013-08-131-0/+5
| | | | | | cases... llvm-svn: 188249
* Fix pretty-printing for unnamed unions.Eli Friedman2013-08-121-0/+11
| | | | | | | This is just a couple of minor fixes to account for the existence of ElaboratedType. llvm-svn: 188209
* Fix crash w/BlockDecl and invalid qualified decl.Eli Friedman2013-08-121-1/+2
| | | | | | | | | I'm not really satisfied with the ad-hoc nature of Sema::diagnoseQualifiedDeclaration, but I'm not sure how to fix it. Fixes <rdar://problem/14639501>. llvm-svn: 188208
* Patch by Chris Wailes <chris.wailes@gmail.com>.DeLesley Hutchins2013-08-123-0/+340
| | | | | | | | | | | | | | | | | | Reviewed by delesley, dblaikie. Add the annotations and code needed to support a basic 'consumed' analysis. Summary: This new analysis is based on academic literature on linear types. It tracks the state of a value, either as unconsumed, consumed, or unknown. Methods are then annotated as CallableWhenUnconsumed, and when an annotated method is called while the value is in the 'consumed' state a warning is issued. A value may be tested in the conditional statement of an if-statement; when this occurs we know the state of the value in the different branches, and this information is added to our analysis. The code is still highly experimental, and the names of annotations or the algorithm may be subject to change. llvm-svn: 188206
* Avoid spurious error messages if parent template class cannot be instantiatedSerge Pavlov2013-08-101-5/+1
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D924 llvm-svn: 188133
* Fix for PR16570: when comparing two function pointers, discard qualifiers whenRichard Trieu2013-08-091-0/+52
| | | | | | | | | | comparing non-reference function parameters. The qualifiers don't matter for comparisons. This is a re-commit of r187769, which was accidentially reverted in r187770, with a simplification at the suggestion of Eli Friedman. llvm-svn: 188112
* Fix alignof computation of large arrays on x86_64.Rafael Espindola2013-08-081-0/+4
| | | | | | | | | | | We were exposing the extra alignment given to large arrays. The new behavior matches gcc, which is a good thing since this is a gcc extension. Thanks to Joerg Sonnenberger for noticing it. While at it, centralize the method description in the .h file. llvm-svn: 187999
* Split the deprecated increment bool warning into a sub-group of -WdeprecatedRichard Trieu2013-08-081-0/+2
| | | | | | so that it can be toggled independently of other deprecated warnings. llvm-svn: 187958
* Emit an error for enum increments and decrements in C++ mode.Richard Trieu2013-08-081-0/+16
| | | | | | Fixes PR16394. llvm-svn: 187955
* Add a new warning to -Wloop-analysis to detect suspicious increments orRichard Trieu2013-08-061-0/+108
| | | | | | | | decrements inside for loops. Idea for this warning proposed in PR15636: http://llvm.org/bugs/show_bug.cgi?id=15636 llvm-svn: 187817
* PR16755: When initializing or modifying a bitfield member in a constantRichard Smith2013-08-062-0/+54
| | | | | | expression, truncate the stored value to the size of the bitfield. llvm-svn: 187782
* Fixing commit r187768: Moved diagnosis of forward declarations of variable ↵Larisse Voufo2013-08-061-52/+0
| | | | | | templates from Parser to Sema. llvm-svn: 187770
* Fix for PR16570: when comparing two function pointers, discard qualifiers whenRichard Trieu2013-08-061-0/+52
| | | | | | | comparing non-reference function parameters. The qualifiers don't matter for comparisons. llvm-svn: 187769
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-066-4/+655
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Implement C++'s restrictions on the type of an expression passed to a varargRichard Smith2013-08-051-0/+4
| | | | | | | | | | | | | function: it can't be 'void' and it can't be an initializer list. We give a hard error for these rather than treating them as undefined behavior (we can and probably should do the same for non-POD types in C++11, but as of this change we don't). Slightly rework the checking of variadic arguments in a function with a format attribute to ensure that certain kinds of format string problem (non-literal string, too many/too few arguments, ...) don't suppress this error. llvm-svn: 187735
* Sema: Don't assume a nested name specifier holds a typeDavid Majnemer2013-08-051-0/+12
| | | | | | | | | Sema::PerformObjectMemberConversion assumed that the Qualifier it was given holds a type. However, the specifier could hold just a namespace. In this case, we should ignore the qualifier and not attempt to cast to it. llvm-svn: 187715
* Check dynamic_cast is not used with -fno-rtti, unless it is a noop or can be ↵Arnaud A. de Grandmaison2013-08-011-0/+14
| | | | | | resolved statically. llvm-svn: 187564
* Fix declaring class template methods with an attributed typedefReid Kleckner2013-07-311-1/+27
| | | | | | | | | | | | | | This change unifies the logic for template instantiation of methods and functions declared with typedefs. It ensures that SubstFunctionType() always fills the Params out param with non-null ParmVarDecls or returns null. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1135 llvm-svn: 187528
* A few small cleanups to r187504. Thanks to dblaikie for the assist.Kaelyn Uhrain2013-07-311-0/+2
| | | | llvm-svn: 187521
* Improve the diagnostic experience, including adding recovery, forKaelyn Uhrain2013-07-311-6/+32
| | | | | | changing '->' to '.' when there is no operator-> defined for a class. llvm-svn: 187504
* Fix a crasher than manifests when typo correction suggests a function template.Richard Trieu2013-07-311-0/+19
| | | | llvm-svn: 187467
* Replacing err_attribute_argument_not_int with err_attribute_not_type_attrAaron Ballman2013-07-301-1/+1
| | | | llvm-svn: 187419
* Don't build expressions for invalid casts.Eli Friedman2013-07-261-2/+8
| | | | | | | | | | This matches how we normally perform semantic analysis for other sorts of invalid expressions: it means we don't have to reason about invalid sub-expressions. Fixes PR16680. llvm-svn: 187276
* Handle a difference in lambda return type deduction between C++11 and C++1y: ifRichard Smith2013-07-261-1/+15
| | | | | | | no return type is specified, C++11 will deduce a cv-qualified return type in some cases, but C++1y never will. llvm-svn: 187275
* PR16708: If a lambda has an implicit return type, don't get confused if its ↵Richard Smith2013-07-261-0/+8
| | | | | | return type has already been determined to be a type containing an 'auto'. llvm-svn: 187266
* Add another C++14 constexpr test case.Richard Smith2013-07-251-0/+32
| | | | llvm-svn: 187096
* C++1y: track object lifetime during constexpr evaluation, and don't allowRichard Smith2013-07-243-1/+75
| | | | | | | objects to be used once their lifetimes end. This completes the C++1y constexpr extensions. llvm-svn: 187025
* Added the attribute name to the err_attribute_wrong_number_arguments ↵Aaron Ballman2013-07-235-19/+19
| | | | | | | | diagnostic for clarity; updated almost all of the affected test cases. Thanks to Fariborz Jahanian for the suggestion! llvm-svn: 186980
OpenPOWER on IntegriCloud