summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ArrayRef'ize Sema::ActOnEnumBody. No functionality change.Dmitri Gribenko2013-04-271-9/+9
| | | | | | Patch by Robert Wilhelm. llvm-svn: 180682
* Implement C++1y decltype(auto).Richard Smith2013-04-261-3/+2
| | | | llvm-svn: 180610
* Don't mark 'extern "C" void f(void)' as having extern storage class.Rafael Espindola2013-04-251-10/+16
| | | | | | | | | | Instead, we check for one line extern "C" context in linkage computation and when deciding if a variable is a definition. This hopefully completes the transition to having "as written" semantics for hasExternalStorage. llvm-svn: 180258
* C++1y constexpr extensions, round 1: Allow most forms of declaration andRichard Smith2013-04-221-1/+1
| | | | | | | | statement in constexpr functions. Everything which doesn't require variable mutation is also allowed as an extension in C++11. 'void' becomes a literal type to support constexpr functions which return 'void'. llvm-svn: 180022
* The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith2013-04-211-2/+17
| | | | | | | | | C++1y, so stop adding the 'const' there. Provide a compatibility warning for code relying on this in C++11, with a fix-it hint. Update our lazily-written tests to add the const, except for those ones which were testing our implementation of this rule. llvm-svn: 179969
* Suppress unused warning on static inline function template specializations.Rafael Espindola2013-04-161-1/+4
| | | | | | Patch by Halfdan Ingvarsson! llvm-svn: 179598
* Remove hasExternalLinkageUncached.Rafael Espindola2013-04-151-16/+9
| | | | | | | | It was being used correctly, but it is a very dangerous API to have around. Instead, move the logic from the filtering to when we are deciding if we should link two decls. llvm-svn: 179523
* Local thread_local variables are implicitly 'static'. (This doesn't apply to ↵Richard Smith2013-04-151-2/+11
| | | | | | _Thread_local nor __thread.) llvm-svn: 179517
* Properly check for a constant initializer for a thread-local variable.Richard Smith2013-04-151-1/+2
| | | | llvm-svn: 179516
* Diagnose if a __thread or _Thread_local variable has a non-constant initializerRichard Smith2013-04-141-0/+22
| | | | | | or non-trivial destructor. llvm-svn: 179491
* Handle incompatible redeclarations of library builtins better.John McCall2013-04-141-11/+21
| | | | | | | | | Invalid redeclarations of valid explicit declarations shouldn't take the same path as redeclarations of implicit declarations, and invalid local extern declarations shouldn't foul things up for everybody else. llvm-svn: 179482
* Annotate flavor of TLS variable (statically or dynamically initialized) onto ↵Richard Smith2013-04-131-10/+20
| | | | | | the AST. llvm-svn: 179447
* Don't replace an existing decl in the scope chains with itsJohn McCall2013-04-131-28/+0
| | | | | | | | | local-extern redeclaration; type refinements, default arguments, etc. must all be locally scoped. rdar://13535367 llvm-svn: 179430
* Parsing support for thread_local and _Thread_local. We give them the sameRichard Smith2013-04-121-16/+25
| | | | | | semantics as __thread for now. llvm-svn: 179424
* Sema: Don't crash when trying to emit a warning for a duplicate value in an ↵Benjamin Kramer2013-04-071-1/+1
| | | | | | | | | invalid enum. Fixes PR15693. A null check on a pointer returned from cast<> is a very dubious construct, do we have a checker for this somewhere? llvm-svn: 178975
* Rework how ObjC method inherit deprecated/availability.Ted Kremenek2013-04-061-1/+4
| | | | | | | | | | | | | | | | | | | | | New rule: - Method decls in @implementation are considered "redeclarations" and inherit deprecated/availability from the @interface. - All other cases are consider overrides, which do not inherit deprecated/availability. For example: (a) @interface redeclares a method in an adopted protocol. (b) A subclass redeclares a method in a superclass. (c) A protocol redeclares a method from another protocol it adopts. The idea is that API authors should have the ability to easily move availability/deprecated up and down a class/protocol hierarchy. A redeclaration means that the availability/deprecation is a blank slate. Fixes <rdar://problem/13574571> llvm-svn: 178937
* Add an error to check that all program scope variables are in the constant ↵Tanya Lattner2013-04-051-0/+10
| | | | | | address space in OpenCL. llvm-svn: 178906
* Revert 178811 until I fix the unit tests.Tanya Lattner2013-04-041-10/+0
| | | | llvm-svn: 178813
* Add an error to check that all program scope variables are in the constant ↵Tanya Lattner2013-04-041-0/+10
| | | | | | address space in OpenCL. llvm-svn: 178811
* Don't patch the storage class of static data members.Rafael Espindola2013-04-041-4/+5
| | | | | | | | | | This removes a bit of patching that survived r178663. Without it we can produce better a better error message for const int a = 5; static const int a; llvm-svn: 178795
* Use isExternalLinkage instead of hasExternalLinkage.Rafael Espindola2013-04-041-1/+1
| | | | | | | | | | | | | | | | Having these not be the same makes an easy to misuse API. We should audit the uses and probably rename to something like foo->hasExternalLinkage(): The c++ standard one. That is UniqueExternalLinkage or ExternalLinkage. foo->hasUniqueExternalLinkage(): Is UniqueExternalLinkage. foo->hasCogeGenExternalLinkage(): Is ExternalLinkage. llvm-svn: 178768
* Fix a recent linkage regression.Rafael Espindola2013-04-041-1/+1
| | | | | | | | Now that we don't have a semantic storage class, use the linkage. Thanks to Bruce Stephens for reporting this. llvm-svn: 178766
* Add hasExternalLinkageUncached back with the test that Richard provided, butRafael Espindola2013-04-041-1/+13
| | | | | | keep the call at the current location. llvm-svn: 178741
* Avoid computing the linkage instead of avoiding caching it.Rafael Espindola2013-04-041-14/+1
| | | | | | | | | | | | | | This mostly reverts 178733, but keeps the tests. I don't claim to understand how hidden sub modules work or when we need to see them (is that documented?), but this has the same semantics and avoids adding hasExternalLinkageUncached which has the same foot gun potential as the old hasExternalLinkage. Last but not least, not computing linkage when it is not needed is more efficient. llvm-svn: 178739
* Fix linkage related crash.Rafael Espindola2013-04-041-2/+2
| | | | | | | | This test was exactly the opposite of what it should be. We should check if there old decl has linkage (where it makes sense) and if the new decl has the extern keyword. llvm-svn: 178735
* Fix 41 of the 61 tests which fail with modules enabled: we were computing andRichard Smith2013-04-041-2/+12
| | | | | | | | | caching the linkage for a declaration before we set up its redeclaration chain, when determining whether a declaration could be a redeclaration of something from an unimported submodule. We actually want to look at the declaration as if it were not a redeclaration here, so compute the linkage but don't cache it. llvm-svn: 178733
* Complain about attempts to befriend declarations via a usingJohn McCall2013-04-031-0/+9
| | | | | | declaration. Patch by Stephen Lin! llvm-svn: 178698
* Add 178663 back.Rafael Espindola2013-04-031-94/+30
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-30/+94
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-94/+30
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* Escape more @ signs in Doxygen comments.Jordan Rose2013-04-031-2/+2
| | | | | | | | | | Doxygen treats "@command" the same as "\command" in a doc comment, so whenever we talk about Objective-C things like "@interface" we have to make sure to escape them. Let's try to keep Clang -Wdocumentation-clean! llvm-svn: 178603
* Add -Wstatic-local-in-inline, which warns about using a static localJohn McCall2013-04-021-0/+52
| | | | | | | | | | | | | | variable in a C99 inline (but not static-inline or extern-inline) function definition. The standard doesn't actually say that this doesn't apply to "extern inline" definitions, but that seems like a useful extension, and it at least doesn't have the obvious flaw that a static mutable variable in an externally-available definition does. rdar://13535367 llvm-svn: 178520
* PR15633: Note that we are EnteringContext when parsing the nested nameRichard Smith2013-04-011-0/+5
| | | | | | | specifier for an enumeration. Also fix a crash-on-invalid if a non-dependent name specifier is used to declare an enum template. llvm-svn: 178502
* Only merge down a variable type if the previous declaration wasJohn McCall2013-04-011-9/+40
| | | | | | | | | visible. There's a lot of potential badness in how we're modelling these things, but getting this much correct is reasonably easy. rdar://13535367 llvm-svn: 178488
* Fix thinko (and the bots): We still want to warn in C.Rafael Espindola2013-03-291-2/+2
| | | | llvm-svn: 178335
* Don't special case one line extern "C" decls.Rafael Espindola2013-03-291-0/+1
| | | | | | | | | | | | | | We already avoided warning for extern "C" const char *Version_string = "2.9"; now we also don't produce any warnings for extern "C" { extern const char *Version_string2 = "2.9"; } llvm-svn: 178333
* Warn about more than the first unused variable when -Werror is set.Matt Beaumont-Gay2013-03-281-1/+1
| | | | | | | To do this, thread DiagnosticErrorTrap's hasUnrecoverableErrorOccurred through to Scope. llvm-svn: 178294
* Support C11 _Atomic type qualifier. This is more-or-less just syntactic ↵Richard Smith2013-03-281-5/+12
| | | | | | sugar for the _Atomic type specifier. llvm-svn: 178210
* Handle CXXOperatorCallExpr when checking self referrnce during initialization ofRichard Trieu2013-03-261-0/+8
| | | | | | class types. llvm-svn: 177987
* <rdar://problem/13459871> Allow forward declaration of enums with a fixed ↵Douglas Gregor2013-03-251-1/+2
| | | | | | underlying type in Objective-C (as well as C++11). llvm-svn: 177930
* Fix a crash-on-valid where a block capture copy expression wasJohn McCall2013-03-221-0/+1
| | | | | | | | | | | | picking up cleanups from earlier in the statement. Also fix a crash-on-invalid where a reference to an invalid decl from an enclosing scope was causing an expression to fail to build, but only *after* a cleanup was registered from that statement, causing an assertion downstream. The crash-on-valid is rdar://13459289. llvm-svn: 177692
* Fix indentationDavid Blaikie2013-03-211-3/+3
| | | | llvm-svn: 177665
* <rdar://problem/12368093> Extend module maps with a 'conflict' declaration, ↵Douglas Gregor2013-03-201-1/+2
| | | | | | and warn when a newly-imported module conflicts with an already-imported module. llvm-svn: 177577
* Don't look outside the innermost enclosing namespace whenJohn McCall2013-03-201-0/+23
| | | | | | | | performing unqualified lookup for a friend class declaration. rdar://13393749 llvm-svn: 177473
* Add missing diagnostic for a nested-name-specifier on a free-standing type ↵Richard Smith2013-03-181-68/+95
| | | | | | definition. Bump some related diagnostics from warning to extension in C++, since they're errors there. Add some missing checks for function specifiers on non-function declarations. llvm-svn: 177335
* Diagnose about extern "C" functions returning c++ objectsFariborz Jahanian2013-03-141-1/+2
| | | | | | on first declaration only. // rdar://13364028 llvm-svn: 177127
* Avoid computing the linkage too early. Don't invalidate it.Rafael Espindola2013-03-141-12/+74
| | | | | | | | | | | | | | | | | | Before this patch we would compute the linkage lazily and cache it. When the AST was modified in ways that could change the value, we would invalidate the cache. That was fairly brittle, since any code could ask for the a linkage before the correct value was available. We should change the API to one where the linkage is computed explicitly and trying to get it when it is not available asserts. This patch is a first step in that direction. We still compute the linkage lazily, but instead of invalidating a cache, we assert that the AST modifications didn't change the result. llvm-svn: 176999
* Whitespace cleanup.Rafael Espindola2013-03-121-1/+1
| | | | llvm-svn: 176896
* We already reported an error forRafael Espindola2013-03-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | extern "C" { void test5_f() { extern int test5_b; } } static float test5_b; This patch makes us report one for extern "C" { void test6_f() { extern int test6_b; } } extern "C" { static float test6_b; } Not because we think the declaration would be extern C, but because of the rule: An entity with C language linkage shall not be declared with the same name as an entity in global scope... We were just not looking past the extern "C" to see if the decl was in global scope. llvm-svn: 176875
* Error if an extern C declaration matches a previous hidden extern C declaration.Rafael Espindola2013-03-121-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Without this patch we produce an error for extern "C" { void f() { extern int b; } } extern "C" { extern float b; } but not for extern "C" { void f() { extern int b; } } extern "C" { float b; } llvm-svn: 176867
OpenPOWER on IntegriCloud