summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei2013-02-071-0/+8
| | | | | | restrictions. llvm-svn: 174601
* For ModuleLoader::makeModuleVisible() also pass the source location where theArgyrios Kyrtzidis2013-02-011-1/+1
| | | | | | module import occurred. llvm-svn: 174191
* Add a new -Wundefined-inline warning for inline functions which are used but notNick Lewycky2013-02-011-5/+27
| | | | | | defined. Fixes PR14993! llvm-svn: 174158
* Implement [dcl.align]p5 and C11 6.7.5/4: alignas cannot underalign.Richard Smith2013-02-011-1/+14
| | | | | | Also support alignas(0), which C++11 and C11 require us to ignore. llvm-svn: 174157
* Remove elements from Sema.UndefinedInternals as functions are defined. AlsoNick Lewycky2013-01-311-0/+7
| | | | | | | filter the elements before emitting them into a PCH. No user-visible functionality change, except that PCH files may be smaller? llvm-svn: 174034
* Clarify the diagnostic for -Wnested-anon-types.Richard Smith2013-01-311-1/+2
| | | | llvm-svn: 174032
* Add OpenCL error that a kernel function must have void return type. Includes ↵Tanya Lattner2013-01-301-1/+8
| | | | | | a test case. llvm-svn: 173963
* Semantic analysis and CodeGen support for C11's _Noreturn. This is modeled asRichard Smith2013-01-301-0/+10
| | | | | | an attribute for consistency with our other noreturn mechanisms. llvm-svn: 173898
* Provide a fixit for constexpr non-static data members.David Blaikie2013-01-301-3/+0
| | | | | | | | | | | | | | | | If the member has an initializer, assume it was probably intended to be static and suggest/recover with that. If the member doesn't have an initializer, assume it was probably intended to be const instead of constexpr and suggest that. (if the attempt to apply these changes fails, don't make any suggestion & produce the same diagnostic experience as before. The only case where this can come up that I know of is with a mutable constexpr with an initializer, since mutable is incompatible with static (but it's already incompatible with const anyway)) llvm-svn: 173873
* Move -Wstatic-float-init fixit into a note & don't recover as if constexprDavid Blaikie2013-01-291-9/+6
| | | | llvm-svn: 173841
* Don't fixit/recover from -Wstatic-float-init when it's not an error.David Blaikie2013-01-291-5/+9
| | | | | | | Fix to change r173414 that lead to Clang changing const to constexpr even under -Wno-static-float-init. llvm-svn: 173835
* Mark a struct definition in an objc container with the ↵Argyrios Kyrtzidis2013-01-291-1/+5
| | | | | | | | | | | TopLevelDeclInObjCContainer bit. Fixes accurately getting a cursor inside an objc container containing a struct definition, from a PCH/preamble file. rdar://12584613 llvm-svn: 173811
* 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
OpenPOWER on IntegriCloud