summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [ms-inline asm] Extend the Sema interface to get the size and length of aChad Rosier2013-01-171-5/+19
| | | | | | | VarDecl. Part of rdar://12576868 llvm-svn: 172742
* Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are ↵Joey Gouly2013-01-172-0/+12
| | | | | | not supported. llvm-svn: 172732
* Improve -Wreorder to handle cases of anonymous class member orderingDavid Blaikie2013-01-171-26/+11
| | | | llvm-svn: 172707
* ArrayRef-ize some ctor initializer related APIsDavid Blaikie2013-01-172-32/+24
| | | | llvm-svn: 172701
* Remove some unnecessary castsDavid Blaikie2013-01-171-4/+4
| | | | llvm-svn: 172700
* Suppress all -Wunused-value warnings from macro body expansions.Matt Beaumont-Gay2013-01-171-2/+5
| | | | | | | | | | | | | | | | | | | This is inspired by a number of false positives in real code, including PR14968. I've added test cases reduced from these false positives to test/Sema/unused-expr.c, as well as corresponding test cases that pass the offending expressions as arguments to a no-op macro to ensure that we do warn there. This also removes my previous tweak from r166522/r166534, so that we warn on unused cast expressions in macro arguments. There were several test cases that were using -Wunused-value to test general diagnostic emission features; I changed those to use other warnings or warn on a macro argument expression. I stared at the test case for PR14399 for a while with Richard Smith and we believe the new test case exercises the same codepaths as before. llvm-svn: 172696
* Attempt to work around bug in older GCCs to fix buildbot.Richard Smith2013-01-171-3/+3
| | | | llvm-svn: 172693
* Implement C++11 semantics for [[noreturn]] attribute. This required splittingRichard Smith2013-01-175-30/+84
| | | | | | | | it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as affecting the function type, whereas [[noreturn]] does not). llvm-svn: 172691
* Add -Wunsequenced (with compatibility alias -Wsequence-point) to warn onRichard Smith2013-01-174-3/+422
| | | | | | | expressions which have undefined behavior due to multiple unsequenced modifications or an unsequenced modification and use of a variable. llvm-svn: 172690
* Treat hidden Objective-C protocol definitions as if they wereDouglas Gregor2013-01-171-1/+3
| | | | | | | undefined, and don't find methods or protocols within those protocol definitions. This completes <rdar://problem/10634711>. llvm-svn: 172686
* Implement a fixit for -Wmain-return-typeDmitri Gribenko2013-01-171-1/+29
| | | | llvm-svn: 172684
* Delay linkage checks when validating the weakref attribute.Rafael Espindola2013-01-162-10/+13
| | | | llvm-svn: 172678
* Fixes crash when illegal function definitions are deleted or defaulted. ↵Aaron Ballman2013-01-161-2/+2
| | | | | | Fixes PR14577. llvm-svn: 172676
* Simplify code. No functionality change.Rafael Espindola2013-01-161-20/+1
| | | | llvm-svn: 172673
* Check for internal weak decls after merging.Rafael Espindola2013-01-162-6/+13
| | | | | | | | This fixes pr14946. The problem was that the linkage computation was done too early, so things like "extern int a;" would be given external linkage, even if a previous declaration was static. llvm-svn: 172667
* Rework the traversal of Objective-C categories and extensions toDouglas Gregor2013-01-165-103/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | consider (sub)module visibility. The bulk of this change replaces myriad hand-rolled loops over the linked list of Objective-C categories/extensions attached to an interface declaration with loops using one of the four new category iterator kinds: visible_categories_iterator: Iterates over all visible categories and extensions, hiding any that have their "hidden" bit set. This is by far the most commonly used iterator. known_categories_iterator: Iterates over all categories and extensions, ignoring the "hidden" bit. This tends to be used for redeclaration-like traversals. visible_extensions_iterator: Iterates over all visible extensions, hiding any that have their "hidden" bit set. known_extensions_iterator: Iterates over all extensions, whether they are visible to normal name lookup or not. The effect of this change is that any uses of the visible_ iterators will respect module-import visibility. See the new tests for examples. Note that the old accessors for categories and extensions are gone; there are *Raw() forms for some of them, for those (few) areas of the compiler that have to manipulate the linked list of categories directly. This is generally discouraged. Part two of <rdar://problem/10634711>. llvm-svn: 172665
* Teach global selector lookup to ignore hidden methods, which occurDouglas Gregor2013-01-161-47/+65
| | | | | | | when the methods are declared in a submodule that has not yet been imported. Part of <rdar://problem/10634711>. llvm-svn: 172635
* First step in implementation of mips16 and nomips16 attributes.Reed Kotler2013-01-161-0/+51
| | | | | | Waiting for new llvm attribute code for the next step. llvm-svn: 172626
* One can have an unavailable method overridden by an available method,Douglas Gregor2013-01-161-1/+1
| | | | | | | but not vice-versa. Fix bug introduced in r172567 and noticed by Jordan, thanks! llvm-svn: 172586
* Apply adjustment to function- and array-typed non-type templateDouglas Gregor2013-01-161-0/+13
| | | | | | | parameters (per C++ [temp.param]p8) when computing the type of a reference to a non-type template parameter. Fixes <rdar://problem/13000548>. llvm-svn: 172585
* When checking availability attributes for consistency between anDouglas Gregor2013-01-153-27/+87
| | | | | | | | overriding and overridden method, allow the overridden method to have a narrower contract (introduced earlier, deprecated/obsoleted later) than the overriding method. Fixes <rdar://problem/12992023>. llvm-svn: 172567
* Fix Cast CodeDavid Greene2013-01-151-2/+3
| | | | | | | Eliminate a cast and resulting cast-qual warning by using a temporary as the target of memcpy. llvm-svn: 172557
* Don't crash when binding a reference to a temporary pointer created fromRichard Smith2013-01-151-0/+4
| | | | | | | | resolving an overloaded function reference within an initializer list. Previously we would try to resolve the overloaded function reference without first stripping off the InitListExpr wrapper. llvm-svn: 172517
* PR14950: Fix out-of-bounds function parameter access in literal operator lookup.Richard Smith2013-01-151-1/+1
| | | | llvm-svn: 172514
* Fix behavior of [[gnu::]] function attributes. Per g++'s behavior, theseRichard Smith2013-01-151-0/+14
| | | | | | | | | | | attributes appertain to a declaration, even though they would be much more naturally modelled as appertaining to a function type. Previously, we would try to distribute them from the declarator to the function type, then reject them for being at an incorrect location. Now, we just distribute them as far as the declarator; the existing attribute handling code can actually apply them there just fine. llvm-svn: 172504
* Refactor to call ActOnFinishFullExpr on every full expression. TeachRichard Smith2013-01-145-60/+87
| | | | | | | | ActOnFinishFullExpr that some of its checks only apply to discarded-value expressions. This adds missing checks for unexpanded variadic template parameter packs to a handful of constructs. llvm-svn: 172485
* Fix regression in r172376. Don't try to detect missing 'constexpr' specifiersRichard Smith2013-01-141-2/+1
| | | | | | | on redeclarations, since that makes us pick wrong prior declarations under some circumstances. llvm-svn: 172384
* Accept [[gnu::*]] for all __attribute__((*))s which are:Richard Smith2013-01-141-7/+31
| | | | | | | | | | | 1) Supported by Clang, and 2) Supported by GCC, and 3) Documented in GCC's manual. g++ allows its C++11-style attributes to appertain only to the entity being declared, and never to a type (even for a type attribute), so we do the same. llvm-svn: 172382
* PR12008: defer adding the implicit 'const' to a constexpr member function untilRichard Smith2013-01-144-85/+111
| | | | | | we know whether it is static. llvm-svn: 172376
* ArrayRef'ize Sema APIs related to format string checkingDmitri Gribenko2013-01-132-42/+47
| | | | llvm-svn: 172367
* Remove some duplication in the handling of __attribute__((ext_vector_size(N))).Richard Smith2013-01-132-40/+7
| | | | llvm-svn: 172340
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-1216-67/+67
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Disable caching of visibility.Rafael Espindola2013-01-123-24/+6
| | | | | | | | | | | | | | The testcase in pr14929 shows that this is extremely hard to do. If we choose to apply the attribute, that causes the visibility of some decls to change and that can happen really late (during codegen). Current gcc warns and ignores the attribute in this testcase with a warning. This suggest that the correct solution is to find a point in the compilation where we can compute the visibility and * assert it was never computed before * reject any attempts to compute it again in the future (with warnings). llvm-svn: 172305
* Fix a regression from 171193: main cannot be overloaded.Rafael Espindola2013-01-121-0/+5
| | | | | | Thanks Eli Friedman for noticing it. llvm-svn: 172292
* Provide Decl::getOwningModule(), which determines the (sub)module inDouglas Gregor2013-01-122-3/+20
| | | | | | | | | | | | | which a particular declaration resides. Use this information to customize the "definition of 'blah' must be imported from another module" diagnostic with the module the user actually has to import. Additionally, recover by importing that module, so we don't complain about other names in that module. Still TODO: coming up with decent Fix-Its for these cases, and expand this recovery approach for other name lookup failures. llvm-svn: 172290
* Only produce one -Wc++98-compat warning when initializing a reference from ↵Richard Smith2013-01-121-0/+1
| | | | | | an init list with multiple elements. llvm-svn: 172285
* Fix -Wunused-comparison for comparisons in arguments to function-like macros.Matt Beaumont-Gay2013-01-121-1/+1
| | | | | | | | | | | Previously, -Wunused-comparison ignored comparisons in both macro bodies and macro arguments, but we would still emit a -Wunused-value warning for either. Now we correctly emit -Wunused-comparison for expressions in macro arguments. Also, add isMacroBodyExpansion to SourceManager, to go along with isMacroArgExpansion. llvm-svn: 172279
* Constify parameter of clang::getCursorKindForDeclDmitri Gribenko2013-01-111-2/+2
| | | | llvm-svn: 172249
* Reject incompatible redeclarations of extern C symbols.Rafael Espindola2013-01-111-8/+14
| | | | | | | Before we were only checking if the new declaration itself was marked extern C. Fixes prpr14766. llvm-svn: 172243
* Fixed an assertion failure triggered by invalid code.Enea Zaffanella2013-01-111-0/+4
| | | | | | | | Set invalid type of declarator after emitting error diagnostics, so that it won't be later considered when instantiating the template. Added test5_inst in test/SemaCXX/condition.cpp for non-regression. llvm-svn: 172201
* Truth in advertising: LocallyScopedExternalDecls actually only containsRichard Smith2013-01-102-18/+18
| | | | | | external declarations with C language linkage. llvm-svn: 172150
* [ms-inline asm] Extend the inline asm Sema lookup interface to determine if theChad Rosier2013-01-101-6/+10
| | | | | | | Decl is a VarDecl. Part of rdar://12991541 llvm-svn: 172120
* Provide a better warning when case value overflows.Fariborz Jahanian2013-01-101-2/+2
| | | | | | // rdar://11577384 llvm-svn: 172102
* Issue warning when case value is too large to fitFariborz Jahanian2013-01-091-1/+9
| | | | | | | | | in case condition type. // rdar://11577384. Test is conditionalized on x86_64-apple triple as I am not sure if the INT_MAX/LONG_MAX values in the test will pass this test for other hosts. llvm-svn: 172016
* When name lookup for a redeclaration finds declarations that are knownDouglas Gregor2013-01-091-0/+41
| | | | | | | | | | (because they are part of some module) but have not been made visible (because they are in a submodule that wasn't imported), filter out those declarations unless both the old declaration and the new declaration have external linkage. When one or both has internal linkage, there should be no conflict unless both are imported. llvm-svn: 171925
* put back diagnostics when flexible members are capturedFariborz Jahanian2013-01-091-1/+4
| | | | | | in lambdas. llvm-svn: 171921
* Fix typo (again).Fariborz Jahanian2013-01-081-1/+1
| | | | llvm-svn: 171917
* Remove lambda from my last patch.Fariborz Jahanian2013-01-081-4/+1
| | | | llvm-svn: 171915
* Fixes typo in comment.Fariborz Jahanian2013-01-081-1/+1
| | | | llvm-svn: 171913
* objectiveC blocks: It is impractical to capture Fariborz Jahanian2013-01-081-1/+16
| | | | | | | | struct variables with flexiable array members in blocks (and lambdas). Issue error instead of crashing in IRGen. // rdar://12655829 llvm-svn: 171912
OpenPOWER on IntegriCloud