summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose2013-03-081-10/+15
| | | | | | No (intended) functionality change. llvm-svn: 176726
* Improve LLDB's implicit cast-to-id to work with C++11 auto and any ↵Douglas Gregor2013-03-071-11/+25
| | | | | | Objective-C object type <rdar://problem/13338107>. llvm-svn: 176665
* When possible, move __block variables to the heap rather than copying them.Douglas Gregor2013-03-071-4/+4
| | | | | | Fixes <rdar://problem/13330126>. llvm-svn: 176663
* Add a hasExternalLinkage helper. No functionality change.Rafael Espindola2013-03-071-6/+6
| | | | llvm-svn: 176607
* PR15390: If a function returns a pointer to a function, that function typeRichard Smith2013-03-061-9/+5
| | | | | | | can't have default arguments even though it's a parameter-declaration-clause in a function declaration. llvm-svn: 176542
* Silence a number of static analyzer warnings with assertions and such.Jordan Rose2013-03-051-1/+1
| | | | | | No functionality change. llvm-svn: 176469
* Process #pragma weak only after we know the linkage of the function or variableRafael Espindola2013-03-021-0/+2
| | | | | | we are looking at. llvm-svn: 176414
* Fix assertion failure when a field is given an address space.Matt Arsenault2013-02-261-2/+7
| | | | llvm-svn: 176122
* Make sure pragmas don't attach visibility attributes to auto variables withRafael Espindola2013-02-221-6/+7
| | | | | | internal linkage. llvm-svn: 175903
* Fix MergeFunctionDecl implicit CC for static methods.Timur Iskhodzhanov2013-02-221-2/+3
| | | | | | Patch by Alexander Zinenko! llvm-svn: 175890
* Implement C++11 [dcl.align]p6-p8, and C11 6.7.5/7. This had to be split out ofRichard Smith2013-02-221-23/+173
| | | | | | | | the normal attribute-merging path, because we can't merge alignment attributes without knowing the complete set of alignment attributes which apply to a particular declaration. llvm-svn: 175861
* [libclang] Fix a crash with invalid code, while skip function bodies is enabled.Argyrios Kyrtzidis2013-02-221-2/+2
| | | | llvm-svn: 175860
* Add a new 'type_visibility' attribute to allow users toJohn McCall2013-02-201-0/+3
| | | | | | | | | | | | | | control the visibility of a type for the purposes of RTTI and template argument restrictions independently of how visibility propagates to its non-type member declarations. Also fix r175326 to not ignore template argument visibility on a template explicit instantiation when a member has an explicit attribute but the instantiation does not. The type_visibility work is rdar://11880378 llvm-svn: 175587
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-23/+23
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* Make helper functions static.Benjamin Kramer2013-02-151-2/+2
| | | | llvm-svn: 175265
* merge hasCLanguageLinkage and isExternC. Keep the shorter name.Rafael Espindola2013-02-141-2/+2
| | | | | | | | | | I added hasCLanguageLinkage while fixing some language linkage bugs some time ago so that I wouldn't have to check all users of isExternC. It turned out to be a much longer detour than expected, but this patch finally merges the two again. The isExternC function now implements just the standard notion of having C language linkage. llvm-svn: 175119
* Add a getLanguageLinkage method to VarDecls and FunctionDecls. Use it to fixRafael Espindola2013-02-141-2/+18
| | | | | | | | | | | | | | | some cases where functions with no language linkage were being treated as having C language linkage. In particular, don't warn in extern "C" { static NonPod foo(); } Since getLanguageLinkage checks the language linkage, the linkage computation cannot use the language linkage. Break the loop by checking just the context in the linkage computation. llvm-svn: 175117
* 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
OpenPOWER on IntegriCloud