summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a diagnostic for an OpenCL kernel with a pointer pointer argument.Joey Gouly2013-01-291-7/+16
| | | | | | Also refactor the surrounding code a little. llvm-svn: 173791
* PR15100: look through type sugar when determining whether we have one of theRichard Smith2013-01-291-1/+2
| | | | | | forms of 'main' which we accept as an extension. llvm-svn: 173758
* Finish semantic analysis for [[carries_dependency]] attribute.Richard Smith2013-01-281-4/+38
| | | | | | | | | | This required plumbing through a new flag to determine whether a ParmVarDecl is actually a parameter of a function declaration (as opposed to a function typedef etc, where the attribute is prohibited). Weirdly, this attribute (just like [[noreturn]]) cannot be applied to a function type, just to a function declaration (and its parameters). llvm-svn: 173726
* Undo my re-wording of the "ARC forbids Objective-C objects in ..."Douglas Gregor2013-01-281-1/+1
| | | | | | error. Jordan is right. llvm-svn: 173713
* Forbid the use of objects in unions in Objective-C++ ARC. FixesDouglas Gregor2013-01-281-32/+30
| | | | | | <rdar://problem/13098104>. llvm-svn: 173708
* Add a -pedantic warning: an anonymous union within an anonymous union is notRichard Smith2013-01-281-0/+6
| | | | | | | permitted in standard C++, despite being silently accepted by many (all?) major C++ implementations. llvm-svn: 173643
* patch for PR9027 and // rdar://11861085Fariborz Jahanian2013-01-251-0/+4
| | | | | | | | | | | Title: [PR9027] volatile struct bug: member is not loaded at -O; This is caused by last flag passed to @llvm.memcpy being false, not honoring that aggregate has at least one 'volatile' data member (even though aggregate itself has not been qualified as 'volatile'. As a result, optimization optimizes away the memcpy altogether. Patch review by John MaCall (I still need to fix up a test though). llvm-svn: 173535
* The standard ARM C++ ABI dictates that inline functions areJohn McCall2013-01-251-2/+24
| | | | | | | | never key functions. We did not implement that rule for the iOS ABI, which was driven by what was implemented in gcc-4.2. However, implement it now for other ARM-based platforms. llvm-svn: 173515
* Sync 'in class initialization of static const double' extension up with GCC,Richard Smith2013-01-251-8/+14
| | | | | | | | | | | | | and split it out of -Wgnu into its own warning flag. * In C++11, this is now a hard error (GCC has no extension here in C++11 mode). The error can be disabled with -Wno-static-float-init, and has a fixit to add 'constexpr'. * In C++98, this is still an ExtWarn, but is now controlled by -Wstatic-float-init as well as -Wgnu. llvm-svn: 173414
* Patch to check for integer overflow. It has beenFariborz Jahanian2013-01-241-1/+3
| | | | | | commented on and approved by Richard Smith. llvm-svn: 173377
* PR14922: when printing an attribute, use the real syntax of the attribute ↵Michael Han2013-01-241-6/+13
| | | | | | | | | | | | | (GNU, C++11, MS Declspec) instead of hardcoded GNU syntax. Introduce a spelling index to Attr class, which is an index into the attribute spelling list of an attribute defined in Attr.td. This index will determine the actual spelling used by an attribute, as it incorporates both the syntax and naming of the attribute. When constructing an attribute AST node, the spelling index is computed based on attribute kind, scope (if it's a C++11 attribute), and name, then passed to Attr that will use the index to print itself. Thanks to Richard Smith for the idea and review. llvm-svn: 173358
* Add a new LangOpt NativeHalfType. This option allows for native half/fp16Joey Gouly2013-01-231-0/+11
| | | | | | | | operations (as opposed to storage only half/fp16). Also add some semantic checks for OpenCL half types. llvm-svn: 173254
* Add a fixit for _Noreturn main,Dmitri Gribenko2013-01-211-2/+8
| | | | | | add tests for fixits removing static and inline from main llvm-svn: 173024
* Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei2013-01-201-6/+44
| | | | | | OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
* Reapply r172878 with test case.Ted Kremenek2013-01-191-3/+9
| | | | llvm-svn: 172888
* Whitespace.NAKAMURA Takumi2013-01-191-1/+1
| | | | llvm-svn: 172881
* Revert r172878, "Reword warning about using a *static* variable within its ↵NAKAMURA Takumi2013-01-191-10/+4
| | | | | | | | own initialization." It broke, at least, linux, msvc and mingw bots. llvm-svn: 172879
* Reword warning about using a *static* variable within its own initialization.Ted Kremenek2013-01-191-4/+10
| | | | | | | | | The warning is still under -Wuninitialized (although technically this is defined behavior), but under a subgroup -Wstatic-self-init. This addresses PR 10265. llvm-svn: 172878
* Parsing support for C11's _Noreturn keyword. No semantics yet.Richard Smith2013-01-171-2/+9
| | | | llvm-svn: 172761
* Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are ↵Joey Gouly2013-01-171-0/+6
| | | | | | not supported. llvm-svn: 172732
* Implement C++11 semantics for [[noreturn]] attribute. This required splittingRichard Smith2013-01-171-0/+12
| | | | | | | | 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
* 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-161-4/+11
| | | | llvm-svn: 172678
* Check for internal weak decls after merging.Rafael Espindola2013-01-161-0/+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-161-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* When checking availability attributes for consistency between anDouglas Gregor2013-01-151-11/+23
| | | | | | | | 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
* Refactor to call ActOnFinishFullExpr on every full expression. TeachRichard Smith2013-01-141-4/+18
| | | | | | | | 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
* PR12008: defer adding the implicit 'const' to a constexpr member function untilRichard Smith2013-01-141-38/+62
| | | | | | we know whether it is static. llvm-svn: 172376
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-9/+9
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Disable caching of visibility.Rafael Espindola2013-01-121-8/+4
| | | | | | | | | | | | | | 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
* Provide Decl::getOwningModule(), which determines the (sub)module inDouglas Gregor2013-01-121-0/+12
| | | | | | | | | | | | | 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
* 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
* Truth in advertising: LocallyScopedExternalDecls actually only containsRichard Smith2013-01-101-16/+16
| | | | | | external declarations with C language linkage. llvm-svn: 172150
* 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
* Tighten types a bit. No functionality change.Rafael Espindola2013-01-081-10/+6
| | | | llvm-svn: 171902
* Tighten types a bit. No functionality change.Rafael Espindola2013-01-081-2/+2
| | | | llvm-svn: 171894
* Clear the LV cache when merging the availability attribute.Rafael Espindola2013-01-081-2/+6
| | | | | | | The availability implies default visibility, so it can change the computed visibility. llvm-svn: 171840
* Fixes a breakage in dejagnu++ test suite where it includedFariborz Jahanian2013-01-051-0/+1
| | | | | | | | <objc/Protocol.h>. Caused by my recent changes for various builtin declarations of objc_msgSendSuper variety. // rdar://12489098 llvm-svn: 171638
* Fix up various builtin declaration of objc_msgSend familiesFariborz Jahanian2013-01-041-0/+20
| | | | | | | to match those foung in objc.h an avoid spurious warnings. // rdar://12489098 llvm-svn: 171492
* Warn on unused auto variables.Rafael Espindola2013-01-031-2/+3
| | | | | | | | To do so we have to wait until we know that the type of a variable has been deduced. Sema::FinalizeDeclaration is the first callback that is used for decl with or without initializers. llvm-svn: 171458
* Use early returns to reduce indentation.Rafael Espindola2013-01-031-31/+34
| | | | llvm-svn: 171457
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-12/+12
| | | | llvm-svn: 171367
* Use hasCLanguageLinkage when warning about non C return types.Rafael Espindola2012-12-301-1/+1
| | | | llvm-svn: 171263
* Reject overloading of two static extern C functions.Rafael Espindola2012-12-281-28/+2
| | | | | | | | This patch moves hasCLanguageLinkage to be VarDecl and FunctionDecl methods so that they can be used from SemaOverload.cpp and then fixes the logic in Sema::IsOverload. llvm-svn: 171193
* Implement dcl.link paragraph 5.Rafael Espindola2012-12-271-0/+40
| | | | | | | The language linkage of redeclarations must match. GCC was already reporting an error for this. llvm-svn: 171139
* Add 171048 back but invalidate the cache of all redeclarations when settingRafael Espindola2012-12-251-3/+7
| | | | | | | | | | | | | | | | | | the body of a functions. The problem was that hasBody looks at the entire chain and causes problems to -fvisibility-inlines-hidden if the cache was not invalidated. Original message: Cache visibility of decls. This unifies the linkage and visibility caching. I first implemented this when working on pr13844, but the previous fixes removed the performance advantage of this one. This is still a step in the right direction for making linkage and visibility cheap to use. llvm-svn: 171053
* Revert r171048, "Cache visibility of decls."NAKAMURA Takumi2012-12-251-7/+3
| | | | | | It broke stage2. llvm-svn: 171050
* Cache visibility of decls.Rafael Espindola2012-12-251-3/+7
| | | | | | | | | | | This unifies the linkage and visibility caching. I first implemented this when working on pr13844, but the previous fixes removed the performance advantage of this one. This is still a step in the right direction for making linkage and visibility cheap to use. llvm-svn: 171048
* Move a declaration closer to its use. No functionality change.Nico Weber2012-12-231-2/+2
| | | | llvm-svn: 170992
* Add back -Wduplicate-enum which I mistakenly removed.Ted Kremenek2012-12-221-0/+178
| | | | | | | | | | | | This was removed with -Wunique-enum, which is still removed. The corresponding thread on cfe-comments for that warning is here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-September/024224.html If we get specific user feedback for -Wduplicate-enum we can evaluate whether or not to keep it. llvm-svn: 170974
OpenPOWER on IntegriCloud