summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Reject uses of __int128 on platforms that don't support it. Also move the uglyRichard Smith2012-11-293-3/+9
| | | | | | | 'getPointerWidth(0) >= 64' test to be a method on TargetInfo, ready to be properly cleaned up. llvm-svn: 168856
* Fix crash-on-invalid. <rdar://problem/12765391>.Eli Friedman2012-11-291-4/+3
| | | | llvm-svn: 168851
* The declaration of a special member can require overload resolution to beRichard Smith2012-11-291-0/+54
| | | | | | | | | | | performed, to determine whether that special member is deleted or constexpr. That overload resolution process can in turn trigger the instantiation of a template, which can do anything, including triggering the declaration of that very same special member function. When this happens, do not try to recursively declare the special member -- that's impossible. Instead, only try to realise the truth. There is no special member. llvm-svn: 168847
* Per C++11 [except.spec]p2, rvalue references are not permitted in exception ↵Richard Smith2012-11-281-33/+34
| | | | | | specifications. llvm-svn: 168824
* PR14388: An array or function type in an exception specification should beRichard Smith2012-11-281-12/+23
| | | | | | | decayed to a pointer type. Patch by WenHan Gu, with a little tweaking and additional testcases by me. llvm-svn: 168822
* PR13098: If we're instantiating an overloaded binary operator and we couldRichard Smith2012-11-281-1/+6
| | | | | | | | | determine which member function would be the callee from within the template definition, don't pass that function as a "non-member function" to CreateOverloadedBinOp. Instead, just rely on it to select the member function for itself. llvm-svn: 168818
* Store on the CXXRecordDecl whether the class has, or would have, a copyRichard Smith2012-11-281-141/+4
| | | | | | | constructor/assignment operator with a const-qualified parameter type. The prior method for determining this incorrectly used overload resolution. llvm-svn: 168775
* Don't return a pointer to an UnresolvedSetImpl in the CXXRecordDecl interface,Argyrios Kyrtzidis2012-11-286-49/+55
| | | | | | expose only the iterators instead. llvm-svn: 168770
* C++ core issue 1344, PR10618: promote "addition of default argument makes thisRichard Smith2012-11-281-9/+16
| | | | | | | | | | | | a special member" diagnostic from warning to error, and fix the cases where it produced diagnostics with incorrect wording. We don't support this as an extension, and we ban it even in C++98 mode. This breaks too much (for instance, the ABI-specified calling convention for a type can change if it acquires a copy constructor through the addition of a default argument). llvm-svn: 168769
* objective-C arc: Underline the selector when issuingFariborz Jahanian2012-11-281-1/+2
| | | | | | | arc specific diagnostic on the selector. This is objc-arc part of // rdar://11303469 llvm-svn: 168756
* objective-C arc: load of a __weak object happens via call toFariborz Jahanian2012-11-272-7/+25
| | | | | | | | | | | objc_loadWeak. This retains and autorelease the weakly-refereced object. This hidden autorelease sometimes makes __weak variable alive even after the weak reference is erased, because the object is still referenced by an autorelease pool. This patch overcomes this behavior by loading a weak object via call to objc_loadWeakRetained(), followng it by objc_release at appropriate place, thereby removing the hidden autorelease. // rdar://10849570 llvm-svn: 168740
* Allow an ASTConsumer to selectively skip function bodies while parsing. PatchRichard Smith2012-11-271-0/+3
| | | | | | by Olivier Goffart! llvm-svn: 168726
* Simplify checking for whether we should implicitly declare special members andRichard Smith2012-11-272-17/+13
| | | | | | add some assertions. No functionality change. llvm-svn: 168725
* PR14428: When instantiating a 'new' expression, if we had a non-dependentRichard Smith2012-11-262-22/+19
| | | | | | | | initialization, don't rebuild it. Remove a couple of hacks which were trying to work around this. Fix the special case for one-argument CXXConstructExprs to not apply if the one argument is a default argument. llvm-svn: 168582
* Add r168519 back, but with a fix to also merge the used flag in variables.Rafael Espindola2012-11-251-0/+8
| | | | llvm-svn: 168564
* Revert r168519, "Merge used flags so that we don't have to iterate on ↵NAKAMURA Takumi2012-11-241-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | isUsed. With this change" It brought bunch of (possibly false) warnings. llvm/unittests/VMCore/PassManagerTest.cpp:60:22: warning: variable 'ID' is not needed and will not be emitted [-Wunneeded-internal-declaration] char ModuleNDNM::ID=0; ^ llvm/unittests/VMCore/PassManagerTest.cpp:86:22: warning: variable 'ID' is not needed and will not be emitted [-Wunneeded-internal-declaration] char ModuleNDM2::ID=0; ^ llvm/unittests/VMCore/PassManagerTest.cpp:106:21: warning: variable 'ID' is not needed and will not be emitted [-Wunneeded-internal-declaration] char ModuleDNM::ID=0; ^ llvm/unittests/VMCore/PassManagerTest.cpp:217:16: warning: variable 'initcount' is not needed and will not be emitted [-Wunneeded-internal-declaration] int LPass::initcount=0; ^ llvm/unittests/VMCore/PassManagerTest.cpp:218:16: warning: variable 'fincount' is not needed and will not be emitted [-Wunneeded-internal-declaration] int LPass::fincount=0; ^ llvm/unittests/VMCore/PassManagerTest.cpp:259:16: warning: variable 'inited' is not needed and will not be emitted [-Wunneeded-internal-declaration] int BPass::inited=0; ^ llvm/unittests/VMCore/PassManagerTest.cpp:260:16: warning: variable 'fin' is not needed and will not be emitted [-Wunneeded-internal-declaration] int BPass::fin=0; ^ llvm/unittests/VMCore/PassManagerTest.cpp:283:24: warning: variable 'ID' is not needed and will not be emitted [-Wunneeded-internal-declaration] char OnTheFlyTest::ID=0; ^ 8 warnings generated. llvm-svn: 168549
* Sema: Provide a valid source location when instantiating templates based on ↵Benjamin Kramer2012-11-231-1/+1
| | | | | | | | a CXXDefaultArgExpr. Fixes PR13758. llvm-svn: 168521
* Merge used flags so that we don't have to iterate on isUsed. With this changeRafael Espindola2012-11-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | "clang -cc1 -fsyntax-only" on the preprocessed output of #define M extern int a; #define M2 M M #define M4 M2 M2 #define M8 M4 M4 #define M16 M8 M8 #define M32 M16 M16 #define M64 M32 M32 #define M128 M64 M64 #define M256 M128 M128 #define M512 M256 M256 #define M1024 M512 M512 #define M2048 M1024 M1024 #define M4096 M2048 M2048 #define M8192 M4096 M4096 #define M16384 M8192 M8192 M16384 goes from 2.994s to 1.416s. GCC is at 0.022s, so we still have a long way to go. llvm-svn: 168519
* Fix regression in r168477. Use canonical decl when looking for base classRichard Smith2012-11-221-1/+1
| | | | | | specified as a qualified name. llvm-svn: 168479
* Fix CXXRecordDecl::forallBases to not look through bases which are dependentRichard Smith2012-11-222-45/+29
| | | | | | | | and defined within the current instantiation, but which are not part of the current instantiation. Previously, it would look at bases which could be specialized separately from the current template. llvm-svn: 168477
* SemaCXX: an enumeral type can be of character or boolean type in a C++11 ↵Benjamin Kramer2012-11-211-25/+24
| | | | | | | | enum class. Make sure we create a literal of the right type. Fixes PR14386. llvm-svn: 168441
* Fix some trailing whitespace (on a blank line) to cycle/test bots.David Blaikie2012-11-191-1/+1
| | | | llvm-svn: 168340
* PR14381: Never skip constexpr function bodies when code-completing. We may needRichard Smith2012-11-191-0/+16
| | | | | | them in order to parse the rest of the file. llvm-svn: 168327
* When adding a NamedDecl to a correction, add the underlying Decl (viaKaelyn Uhrain2012-11-191-1/+1
| | | | | | | | getUnderlyingDecl()) so that derivatives of CorrectionCandidateCallback::ValidateCandidate(...) don't have to worry about being thrown by UsingDecls and such. llvm-svn: 168317
* Remove redundant (duplicated) check.Dmitri Gribenko2012-11-181-1/+1
| | | | llvm-svn: 168293
* objective-C: Do not issue deprecated warning about implementationFariborz Jahanian2012-11-171-2/+15
| | | | | | | of a deprecated method in original class (or category), only in overrides. // rdar://12717705 llvm-svn: 168270
* Store this Decl* as a Decl* instead of a uintptr_t. No functionality change.Nick Lewycky2012-11-162-23/+21
| | | | llvm-svn: 168145
* Take into account the zero sign bit for positive numbers when computing the bitRichard Trieu2012-11-161-1/+5
| | | | | | | width of an enum with negative values in IntRange. Include a test for -Wtautological-constant-out-of-range-compare where this had manifested. llvm-svn: 168126
* A step towards sorting out handling of triviality of special members in C++11.Richard Smith2012-11-163-23/+29
| | | | | | | | | | | | | | Separate out the notions of 'has a trivial special member' and 'has a non-trivial special member', and use them appropriately. These are not opposites of one another (there might be no special member, or in C++11 there might be a trivial one and a non-trivial one). The CXXRecordDecl predicates continue to produce incorrect results, but do so in fewer cases now, and they document the cases where they might be wrong. No functionality changes are intended here (they will come when the predicates start producing the right answers...). llvm-svn: 168119
* Do not cache a pointer to ExprEvalContexts.back().Benjamin Kramer2012-11-151-7/+9
| | | | | | | | | | It may become a dangling pointer if the underlying SmallVector reallocates. Sadly the testcase is really large and doesn't reduce well because of SmallVector's reallocation patterns. Fixes PR14336. llvm-svn: 168045
* Teach the uninitialized field warning about anonymous structs and union members.Nick Lewycky2012-11-151-9/+23
| | | | | | Fixes PR14073! llvm-svn: 168031
* Fix an off-by-one error by switching < to <= in ↵Richard Trieu2012-11-151-1/+1
| | | | | | -Wtautological-constant-out-of-range-compare and added test case. llvm-svn: 168023
* Per [basic.lookup.classref]p3, in an expression of the form p->~type-name, theRichard Smith2012-11-151-1/+1
| | | | | | | | | | type-name is looked up in the context of the complete postfix-expression. Don't forget to pass the scope into this lookup when the type-name is a template-id; it might name an alias template which can't be found within the class itself. Bug spotted by Johannes Schaub on #llvm. llvm-svn: 168011
* Fix DiagnoseBitwisePrecedence so it doesn't cast "-1" to the typeEli Friedman2012-11-151-24/+16
| | | | | | | | | BinaryOperator::Opcode. This is bad form, and the behavior of the static_cast in this case is unspecified according to the standard. Fixes a warning that showed up from r167992 on self-host. llvm-svn: 168010
* Improve -Wtautological-constant-out-of-range-compare by taking into accountRichard Trieu2012-11-141-15/+73
| | | | | | | | | type conversion between integers. This allows the warning to be more accurate. Also, turned the warning off in an analyzer test. The relavent test cases are covered by the tests in Sema. llvm-svn: 167992
* s/tranform/transform/Benjamin Kramer2012-11-143-5/+5
| | | | llvm-svn: 167929
* When we have a MemberExpr referring to an overloaded static member function,Richard Smith2012-11-141-0/+1
| | | | | | | | | and we resolve it to a specific function based on the type which it's used as, don't forget to mark it as referenced. Fixes a regression introduced in r167514. llvm-svn: 167918
* SemaTemplateDeduction.cpp: Prune two obsolete descriptions. [-Wdocumentation]NAKAMURA Takumi2012-11-141-9/+0
| | | | | | | | | | | | | | | | | * getMostSpecialized() /// \param Index if non-NULL and the result of this function is non-nULL, /// receives the index corresponding to the resulting function template /// specialization. * DeduceTemplateArguments() /// \param Name the name of the function being called. This is only significant /// when the function template is a conversion function template, in which /// case this routine will also perform template argument deduction based on /// the function to which llvm-svn: 167909
* Provide the correct mangling and linkage for certain unnamed nested classes.David Blaikie2012-11-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This corrects the mangling and linkage of classes (& their member functions) in cases like this: struct foo { struct { void func() { ... } } x; }; we were accidentally giving this nested unnamed struct 'no' linkage where it should've had the linkage of the outer class. The mangling was incorrecty too, mangling as TU-wide unnamed type mangling of $_X rather than class-scoped mangling of UtX_. This also fixes -Wunused-member-function which would incorrectly diagnose 'func' as unused due to it having no linkage & thus appearing to be TU-local when in fact it might be correctly used in another TU. Similar mangling should be applied to function local classes in similar cases but I've deferred that for a subsequent patch. Review/discussion by Richard Smith, John McCall, & especially Eli Friedman. llvm-svn: 167906
* Remove another questionable use of hasTrivial*. The relevant thing for thisRichard Smith2012-11-141-93/+114
| | | | | | | test was whether the /selected/ operator= was trivial, not whether the class had any trivial (or any non-trivial) operator=s. llvm-svn: 167897
* Accept and pass arguments to __unknown_anytype in argumentJohn McCall2012-11-142-0/+29
| | | | | | | | | | | | | | | | | | | | | positions of Objective-C methods. It is possible to recover a lot of type information about Objective-C methods from the reflective metadata for their implementations. This information is not rich when it comes to struct types, however, and it is not possible to produce a type in the debugger's round-tripped AST which will really do anything useful during type-checking. Therefore we allow __unknown_anytype in these positions, which essentially disables type-checking for that argument. We infer the parameter type to be the unqualified type of the argument expression unless that expression is an explicit cast, in which case it becomes the type-as-written of that cast. rdar://problem/12565338 llvm-svn: 167896
* Don't try to save the assigned value in a Objective-C property assignmentEli Friedman2012-11-131-7/+15
| | | | | | | | | if the type of the value is a non-trivial class type. Fixes PR14318. (There's a minor ObjC++ language change here: given that we can't save the value, the type of the assignment expression is void in such cases.) llvm-svn: 167884
* For classes that have the warn_unused_result attribute, don't apply theKaelyn Uhrain2012-11-131-1/+5
| | | | | | | attribute to the class' methods even when they return an instance of the class (e.g. assignment operators). llvm-svn: 167873
* Copy the decls returned by DeclContext::lookup_result to aArgyrios Kyrtzidis2012-11-131-12/+27
| | | | | | | | | new container so we can safely iterate over them. The container holding the lookup decls can under certain conditions be changed while iterating (e.g. because of deserialization). llvm-svn: 167816
* Fix some wrong-code bugs in implicitly-defined assignment operators:Richard Smith2012-11-131-35/+43
| | | | | | | - In C++11, perform overload resolution over all assignment operators, rather than just looking for copy/move assignment operators. - Clean up after temporaries produced by operator= immediately, rather than accumulating them until the end of the function. llvm-svn: 167798
* A couple of small fixes to r167783Kaelyn Uhrain2012-11-131-1/+1
| | | | llvm-svn: 167791
* When filtering the list of associated namespaces so that we don't suggest peopleNick Lewycky2012-11-131-11/+9
| | | | | | | add functions to namespace 'std', also filter out namespaces with '__' anywhere in the name. llvm-svn: 167786
* Enable C++11 attribute syntax for warn_unused_result and allow it to beKaelyn Uhrain2012-11-122-1/+11
| | | | | | | | | | | | | applied to CXXRecordDecls, where functions with that return type will inherit the warn_unused_result attribute. Also includes a tiny fix (with no discernable behavior change for existing code) to re-sync AttributeDeclKind enum and err_attribute_wrong_decl_type with warn_attribute_wrong_decl_type since the enum is used with both diagnostic messages to chose the correct description. llvm-svn: 167783
* Factor duplicated implicit memcpy call generation code out of copy/moveRichard Smith2012-11-121-200/+69
| | | | | | | | assignment generation. This incidentally avoids reusing the same Expr* across multiple statements in the same object; that was generating slightly broken ASTs, but I couldn't trigger any observable bad behavior, so no test. llvm-svn: 167779
* Finish reverting r167761, it's causing test failures.Eric Christopher2012-11-121-0/+3
| | | | llvm-svn: 167777
OpenPOWER on IntegriCloud