summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Improve our uniquing of file entries when files are re-saved or areDouglas Gregor2011-02-051-2/+0
| | | | | | | | | | | | | | overridden via remapping. Thus, when we create a "virtual" file in the file manager, we still stat() the real file that lives behind it so that we can provide proper uniquing based on inodes. This helps keep the file manager much more consistent. To take advantage of this when reparsing files in libclang, we disable the use of the stat() cache when reparsing or performing code completion, since the stat() cache is very likely to be out of date in this use case. llvm-svn: 124971
* Basic implementation of inherited constructors. Only generates declarations, ↵Sebastian Redl2011-02-052-5/+260
| | | | | | and probably only works for very basic use cases. llvm-svn: 124970
* When the out-of-line definition differs from the declaration in the return type,Argyrios Kyrtzidis2011-02-051-1/+5
| | | | | | | | | say "out-of-line definition differ from the declaration in the return type" instead of the silly "functions that differ only in their return type cannot be overloaded". Addresses rdar://7980179. llvm-svn: 124939
* Re-land r124768, with a fix for PR9130.Anders Carlsson2011-02-051-7/+0
| | | | | | We now emit everything except unused implicit virtual member functions when building the vtable. llvm-svn: 124935
* Don't suggest -Wuninitialized fixits for uninitialized enum types.Ted Kremenek2011-02-051-1/+3
| | | | llvm-svn: 124924
* -Wselector should warn on implemented selectors onlyFariborz Jahanian2011-02-041-1/+5
| | | | | | | | when selector metadata is generated, which is triggered by at least on class implementation. This is to match gcc's behavior. // rdar://8851684. llvm-svn: 124909
* Assert during instantiation of blocks that we've captured everything thatJohn McCall2011-02-041-39/+61
| | | | | | we captured in the dependent case. llvm-svn: 124887
* Improve our handling of the current instantiation for qualifiedDouglas Gregor2011-02-041-25/+11
| | | | | | | | | | | | | | id-expression, e.g., CurrentClass<T>::member Previously, if CurrentClass<T> was dependent and not complete, we would treat it as a dependent-scoped declaration reference expression, even if CurrentClass<T> referred to the current instantiation. Fixes PR8966 and improves type checking of templates. llvm-svn: 124867
* Before checking bitfield initialization, make sure that neither theDouglas Gregor2011-02-041-0/+7
| | | | | | | bit-field width nor the initializer value are type- or value-dependent. Fixes PR8712. llvm-svn: 124866
* When calling a bound pointer to member function, check theDouglas Gregor2011-02-041-0/+20
| | | | | | | cv-qualifiers on the object against the cv-qualifiers on the member function. Fixes PR8315. llvm-svn: 124865
* Tweak my fix for PR8748, and update the incorrect PR number in the test case.Douglas Gregor2011-02-042-2/+4
| | | | llvm-svn: 124863
* Downgrade error about attribute 'iboutlet' and 'ibaction' being applied to ↵Ted Kremenek2011-02-041-3/+3
| | | | | | anything but a instance method to a warning. llvm-svn: 124858
* Tighten up the semantics of default template arguments, per C++0xDouglas Gregor2011-02-042-4/+17
| | | | | | [temp.param]p9 and C++ DR226. Fixes PR8747. llvm-svn: 124856
* When a function template's template parameter has a default argument,Douglas Gregor2011-02-041-2/+2
| | | | | | | | | | it's okay for the following template parameters to not have default arguments (since those template parameters can still be deduced). Also, downgrade the error about default template arguments in function templates to an extension warning, since this is a harmless C++0x extension. llvm-svn: 124855
* Implement -Woverloaded-virtual.Argyrios Kyrtzidis2011-02-032-1/+103
| | | | | | | | | | | | The difference with gcc is that it warns if you overload virtual methods only if the method doesn't also override any method. This is to cut down on the number of warnings and make it more useful like reported here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20423. If we want to warn that not all overloads are overriden we can have an additional warning like -Wpartial-override. -Woverloaded-virtual, unlike gcc, is added to -Wmost. Addresses rdar://8757630. llvm-svn: 124805
* Capture a few implicit references to 'self'.John McCall2011-02-031-3/+37
| | | | llvm-svn: 124786
* More capturing of 'this': implicit member expressions. Getting thatJohn McCall2011-02-032-120/+152
| | | | | | | | | | | right for anonymous struct/union members led to me discovering some seemingly broken code in that area of Sema, which I fixed, partly by changing the representation of member pointer constants so that IndirectFieldDecls aren't expanded. This led to assorted cleanups with member pointers in CodeGen, and while I was doing that I saw some random other things to clean up. llvm-svn: 124785
* Revert 124768.Rafael Espindola2011-02-031-0/+7
| | | | | | | This reopens PR99114, but that one at least can be avoided with an #include. PR9130 cannot. llvm-svn: 124780
* Don't try to mark virtual members referenced for classes where the key functionAnders Carlsson2011-02-031-7/+0
| | | | | | | | | | | is not defined in the current translation unit. Doing so lead to compile errors such as PR9114. Instead, when CodeGen is building the vtable, don't try to emit a definition for functions that aren't marked used in the current translation unit. Fixes PR9114. llvm-svn: 124768
* Based on user feedback, swap -Wuninitialized diagnostics to have the warning ↵Ted Kremenek2011-02-021-32/+37
| | | | | | refer to the bad use, and the note to the variable declaration. llvm-svn: 124758
* Revert r124704, which uniqued code-completion strings. The spaceDouglas Gregor2011-02-021-31/+0
| | | | | | | | | savings of 25% sounds impressive, except that this amounted to only about 360k in our standard "large" completion result set (40,000 results). Since code completion is performance-sensitive, the 4% slowdown due to uniquing outweighs the 360k benefit. llvm-svn: 124737
* Don't warn for -Wnon-virtual-dtor for dependent classes.Argyrios Kyrtzidis2011-02-021-1/+1
| | | | llvm-svn: 124735
* An insomniac stab at making block declarations list the variables they closeJohn McCall2011-02-023-110/+170
| | | | | | | on, as well as more reliably limiting invalid references to locals from nested scopes. llvm-svn: 124721
* Remove redundant check to not warn for warn_equality_with_extra_parens if we ↵Ted Kremenek2011-02-021-11/+6
| | | | | | are in a macro. This is checked twice. llvm-svn: 124714
* Unique code-completion strings. On Cocoa.h, this costs us about 4% inDouglas Gregor2011-02-011-0/+31
| | | | | | speed but saves us about 25% of the memory usage for strings. llvm-svn: 124704
* When diagnosing address-space changes, apply array-to-pointer decay first.John McCall2011-02-011-0/+3
| | | | llvm-svn: 124702
* Create a special allocator class for code completion, so that all ofDouglas Gregor2011-02-012-76/+73
| | | | | | | the string copying goes through a single place that can have associated state. llvm-svn: 124698
* Don't warn about extraneous '()' around a comparison if it occurs within a ↵Ted Kremenek2011-02-011-9/+12
| | | | | | | | | macro. Macros frequently contain extra '()' to make instantiation less error prone. This warning was flagging a ton of times on postgresql because of its use of macros. llvm-svn: 124695
* Don't warn for "if ((a == b))" if the parens came from a macro. Thanks to ↵Argyrios Kyrtzidis2011-02-011-0/+5
| | | | | | Fariborz for the hint! llvm-svn: 124689
* Provide constant strings for certain common code completion strings,Douglas Gregor2011-02-011-22/+90
| | | | | | eliminating the need to copy those strings. llvm-svn: 124683
* For "if ((a == b))" only warn if 'a' is a modifiable l-value. Caught by John!Argyrios Kyrtzidis2011-02-011-1/+3
| | | | llvm-svn: 124675
* Allocate CodeCompletionString and all of its components in aDouglas Gregor2011-02-012-870/+820
| | | | | | | | | | | | BumpPtrAllocator, rather than manually new/delete'ing them. This optimization also allows us to avoid allocating memory for and copying constant strings (e.g., "return", "class"). This also required embedding the priority and availability of results within the code completion string, to avoid extra memory allocation within libclang. llvm-svn: 124673
* Warn for "if ((a == b))" where the equality expression is needlessly wrapped ↵Argyrios Kyrtzidis2011-02-011-0/+22
| | | | | | | | | | inside parentheses. It's highly likely that the user intended an assignment used as condition. Addresses rdar://8848646. llvm-svn: 124668
* Add temporary hack to -Wuninitialize to create a separate CFG (for C++ code) ↵Ted Kremenek2011-02-011-1/+18
| | | | | | | | | | | | | that doesn't include implicit dtors. Implicit dtors confuse the ad hoc path-sensitivity of UninitializedValuesV2.cpp. This isn't the ideal solution, as it will directly impact compile time, but should significantly reduce the noise of -Wuninitialized on some code bases. This immediately "fixes" the false positive reported in PR 9063, although this isn't the right fix in the long run. llvm-svn: 124667
* Implement access checking for the "delete" operator. Fixes PR9050,Douglas Gregor2011-02-011-1/+9
| | | | | | from Alex Miller! llvm-svn: 124663
* The code trying to assign a typedef to an anonymous tag declaration wasJohn McCall2011-02-012-15/+46
| | | | | | | | extremely rambunctious, both on parsing and on template instantiation. Calm it down, fixing an internal consistency assert on anonymous enum instantiation manglings. llvm-svn: 124653
* When initializing struct members, the important thing is that the ↵Argyrios Kyrtzidis2011-02-011-1/+2
| | | | | | | | | | "initializing" expression is compatible, not having the same type. Fix rdar://8183908 in which compatible vector types weren't initialized properly leading to a crash. llvm-svn: 124637
* Perform the bad-address-space conversions check as part of John McCall2011-02-012-27/+38
| | | | | | CheckPointerTypesForAssignment. llvm-svn: 124632
* Improve the diagnostic for -Wcustom-atomic-properties. Suggestion by Fariborz!Argyrios Kyrtzidis2011-01-311-2/+2
| | | | llvm-svn: 124620
* Make Check*PointerTypesForAssignment private and tell them that they'reJohn McCall2011-01-311-73/+63
| | | | | | working on canonical types already. llvm-svn: 124618
* Slightly reorganize CheckAssignmentConstraints and remove some redundantJohn McCall2011-01-311-65/+87
| | | | | | logic. llvm-svn: 124615
* Add -Wcustom-atomic-properties which warns if an atomic-by-default property ↵Argyrios Kyrtzidis2011-01-311-4/+30
| | | | | | | | | | | has custom getter or setter. The rationale is that it is highly likely that the user's getter/setter isn't atomically implemented. Off by default. Addresses rdar://8782645. -Wcustom-atomic-properties and -Wimplicit-atomic-properties are under the -Watomic-properties group. llvm-svn: 124609
* Implement reasonable conversion ranking for Objective-C pointerDouglas Gregor2011-01-311-22/+70
| | | | | | | | | | | | | | | | | | | | | | | | conversions (<rdar://problem/8592139>) for overload resolution. The conversion ranking mirrors C++'s conversion ranking fairly closely, except that we use a same pseudo-subtyping relationship employed by Objective-C pointer assignment rather than simple checking derived-to-base conversions. This change covers: - Conversions to pointers to a specific object type are better than conversions to 'id', 'Class', qualified 'id', or qualified 'Class' (note: GCC doesn't perform this ranking, but it matches C++'s rules for ranking conversions to void*). - Conversions to qualified 'id' or qualified 'Class' are better than conversions to 'id' or 'Class', respectively. - When two conversion sequences convert to the same type, rank the conversions based on the relationship between the types we're converting from. - When two conversion sequences convert from the same non-id, non-Class type, rank the conversions based on the relationship of the types we're converting to. (note: GCC allows this ranking even when converting from 'id', which is extremeley dangerous). llvm-svn: 124591
* Only warn for -Wnon-virtual-dtor for public destructors. Thanks to Benjamin ↵Argyrios Kyrtzidis2011-01-311-2/+2
| | | | | | Kramer for the hint! llvm-svn: 124585
* Implement the suggested resolution to core issue 547, extended to alsoDouglas Gregor2011-01-311-33/+71
| | | | | | | | | allow ref-qualifiers on function types used as template type arguments. GNU actually allows cv-qualifiers on function types in many places where it shouldn't, so we currently categorize this as a GNU extension. llvm-svn: 124584
* Warn if the class has virtual methods but non-virtual destructor. Addresses ↵Argyrios Kyrtzidis2011-01-311-0/+8
| | | | | | rdar://8756445. llvm-svn: 124582
* Don't warn that variables in C++ static member functions shadow fields. ↵Argyrios Kyrtzidis2011-01-311-0/+6
| | | | | | Fixes rdar://8900456. llvm-svn: 124581
* Fix the diagnostic when we are shadowing an external variable and there ↵Argyrios Kyrtzidis2011-01-311-13/+24
| | | | | | exists a locally scoped extern with the same name. llvm-svn: 124580
* Diagnose if extern local variable is followed by non-extern and vice-versa.Argyrios Kyrtzidis2011-01-311-0/+14
| | | | llvm-svn: 124579
* 'extern' variables in functions don't shadow externs in global scope. Fixes ↵Argyrios Kyrtzidis2011-01-311-0/+13
| | | | | | rdar://8883302. llvm-svn: 124578
OpenPOWER on IntegriCloud