summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Silence a number of static analyzer warnings with assertions and such.Jordan Rose2013-03-055-7/+10
| | | | | | No functionality change. llvm-svn: 176469
* Centralize and refine the __unknown_anytype argument rulesJohn McCall2013-03-042-26/+39
| | | | | | | | | and be sure to apply them whether or not the debugger gave us a method declaration. rdar://12565338 llvm-svn: 176432
* Perform non-overload placeholder conversions on the operandsJohn McCall2013-03-041-16/+39
| | | | | | | | to a subscript operator. rdar://13332183 llvm-svn: 176428
* Process #pragma weak only after we know the linkage of the function or variableRafael Espindola2013-03-022-24/+26
| | | | | | we are looking at. llvm-svn: 176414
* Fix typos: [Dd]iagnosic -> [Dd]iagnosticStefanus Du Toit2013-03-012-2/+2
| | | | | | These all appear in comments or (ironically) diagnostics output. llvm-svn: 176383
* Perform the receiver-expression transformations regardless ofJohn McCall2013-03-011-41/+42
| | | | | | | | | | | | | | whether we already have a method. Fixes a bug where we were failing to properly contextually convert a message receiver during template instantiation. As a side-effect, we now actually perform correct method lookup after adjusting a message-send to integral or non-ObjC pointer types (legal outside of ARC). rdar://13305374 llvm-svn: 176339
* Attempt to not place ownership qualifiers on the result typeJohn McCall2013-03-011-9/+100
| | | | | | | | | | | of block declarators. Document the rule we use. Also document the rule that Doug implemented a few weeks ago which drops ownership qualifiers on function result types. rdar://10127067 llvm-svn: 176336
* objective-C code completion. Property accessors may notFariborz Jahanian2013-02-281-1/+6
| | | | | | | | have their own code completion comments. Use those in their properties in this case. // rdar://12791315 llvm-svn: 176271
* PR15360: nullptr as a non-type template argument to a function type non-type ↵David Blaikie2013-02-271-9/+10
| | | | | | template parameter llvm-svn: 176216
* Don't crash when diagnosing path-constrained protectedJohn McCall2013-02-271-104/+153
| | | | | | | | access to a private member to which we have special access. rdar://12926092 llvm-svn: 176146
* Fix assertion failure when a field is given an address space.Matt Arsenault2013-02-262-10/+15
| | | | llvm-svn: 176122
* Fix initializer for variables with attribute address_space set.Matt Arsenault2013-02-261-5/+1
| | | | | | | | | | | | This would error in C++ mode unless the variable also had a cv qualifier. e.g. __attribute__((address_space(2))) float foo = 1.0f; would error but __attribute__((address_space(2))) const float foo = 1.0f; would not. llvm-svn: 176121
* Warn on dropping the return value from a warn_unused_result function, even inMatt Beaumont-Gay2013-02-261-5/+17
| | | | | | macros. llvm-svn: 176114
* Be more careful in applying pragma weak. Fixes pr14974.Rafael Espindola2013-02-261-2/+10
| | | | | | | | | | GCC applies a pragma weak to a decl if it matches the mangled name. We used to apply if it matched the plain name. This patch is a compromise: we apply the pragma only if it matches the name and the decl has C language linkage. llvm-svn: 176110
* Unify clang/llvm attributes for asan/tsan/msan (Clang part)Kostya Serebryany2013-02-261-9/+49
| | | | | | | | | | | | | | | | | | | These are two related changes (one in llvm, one in clang). LLVM: - rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode) - rename thread_safety => sanitize_thread - rename no_uninitialized_checks -> sanitize_memory CLANG: - add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis)) - add __attribute__((no_sanitize_thread)) - add __attribute__((no_sanitize_memory)) for S in address thread memory If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not set llvm attribute sanitize_S llvm-svn: 176076
* In Sema::InstantiateStaticDataMemberDefinition, pass the var decl to the ↵Argyrios Kyrtzidis2013-02-241-3/+13
| | | | | | | | | | | | consumer just using ASTConsumer::HandleCXXStaticMemberVarInstantiation(), don't pass it with ASTConsumer::HandleTopLevelDecl. ASTConsumer::HandleTopLevelDecl is intended for user-written top-level decls; a consumer can treat an instantiated static data member however it wants of course. llvm-svn: 175976
* Remove the CFGElement "Invalid" state.David Blaikie2013-02-231-4/+4
| | | | | | | | | | | | | Use Optional<CFG*> where invalid states were needed previously. In the one case where that's not possible (beginAutomaticObjDtorsInsert) just use a dummy CFGAutomaticObjDtor. Thanks for the help from Jordan Rose & discussion/feedback from Ted Kremenek and Doug Gregor. Post commit code review feedback on r175796 by Ted Kremenek. llvm-svn: 175938
* Remove the hack that avoided mangling static functions in extern C contexts.Rafael Espindola2013-02-231-8/+0
| | | | | | | | | | | | | | | | | Weather we should give C language linkage to functions and variables with internal linkage probably depends on how much code assumes it. The standard says they should have no language linkage, but gcc and msvc assign them C language linkage. This commit removes the hack that was preventing the mangling on static functions declare in extern C contexts. It is an experiment to see if we can implement the rules in the standard. If it turns out that many users depend on these functions and variables having C language linkage, we should change isExternC instead and try to convince the CWG to change the standard. llvm-svn: 175937
* Revert r175912, "Add support for coldcc to clang" at John's request.Peter Collingbourne2013-02-232-13/+0
| | | | llvm-svn: 175936
* objective-C arg: provide fixit support whenFariborz Jahanian2013-02-223-20/+48
| | | | | | | c++'s named cast need be replaced for bridge casting. // rdar://12788838 llvm-svn: 175923
* Add support for coldcc to clangPeter Collingbourne2013-02-222-0/+13
| | | | llvm-svn: 175912
* Make sure pragmas don't attach visibility attributes to auto variables withRafael Espindola2013-02-221-6/+7
| | | | | | internal linkage. llvm-svn: 175903
* [Sema] Semantic analysis for empty-declaration and attribute-declaration.Michael Han2013-02-221-17/+11
| | | | | | | | Introduce a new AST Decl node "EmptyDecl" to model empty-declaration. Have attributes from attribute-declaration appertain to the EmptyDecl node by creating the AST representations of these attributes and attach them to the EmptyDecl node so these attributes can be sema checked just as attributes attached to "normal" declarations. llvm-svn: 175900
* Streamify getNameForDiagnostic and remove the string versions of ↵Benjamin Kramer2013-02-221-6/+10
| | | | | | PrintTemplateArgumentList. llvm-svn: 175894
* Fix MergeFunctionDecl implicit CC for static methods.Timur Iskhodzhanov2013-02-221-2/+3
| | | | | | Patch by Alexander Zinenko! llvm-svn: 175890
* Don't crash if we try to apply 'alignas' to a variable declared with anRichard Smith2013-02-221-1/+1
| | | | | | incomplete type. llvm-svn: 175880
* Handle alignas(foo...) pack expansions.Richard Smith2013-02-222-42/+88
| | | | llvm-svn: 175875
* In LookupResult::resolveKind(), when handling multiple found declarations, ↵Argyrios Kyrtzidis2013-02-221-0/+6
| | | | | | | | | ignore invalid declarations. This reduces the "ambiguous reference" errors (which are rather strange in C/ObjC) and fixes an assertion hit with an invalid code test case. llvm-svn: 175869
* When a parameter list in a C function has an error, recover by forming a K&R ↵Argyrios Kyrtzidis2013-02-221-0/+2
| | | | | | | | function, instead of a non-function type. llvm-svn: 175868
* Don't crash when applying an alloc_size attribute on a K&R function.Argyrios Kyrtzidis2013-02-221-1/+5
| | | | llvm-svn: 175867
* Implement C++11 [dcl.align]p6-p8, and C11 6.7.5/7. This had to be split out ofRichard Smith2013-02-223-29/+179
| | | | | | | | 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
* Only suppress instance context if a member is actuallyJohn McCall2013-02-221-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | accessible in its declaring class; otherwise we might fail to apply [class.protected] when considering accessibility in derived classes. Noticed by inspection; <rdar://13270329>. I had an existing test wrong. Here's why it's wrong: Follow the rules (and notation) of [class.access]p5. The naming class (N) is B and the context (R) is D::getX. - 'x' as a member of B is protected, but R does not occur in a member or friend of a class derived from B. - There does exist a base class of B, A, which is accessible from R, and 'x' is accessible at R when named in A because 'x' as a member of A is protected and R occurs in a member of a class, D, that is derived from A; however, by [class.protected], the class of the object expression must be equal to or derived from that class, and A does not derive from D. llvm-svn: 175858
* objective-C arc: Diagnostic can not say to use bridgeFariborz Jahanian2013-02-221-8/+21
| | | | | | | casts with c++ named casts. Change notes to say use bridge with c-style cast instead. // rdar://12788838 llvm-svn: 175850
* Remove superfluous null pointer check. The pointer is used prior to this check.Ted Kremenek2013-02-211-7/+6
| | | | llvm-svn: 175807
* Teach serialized diagnostics about notes without locations.Ted Kremenek2013-02-211-2/+7
| | | | | | | | Along the way, improve a diagnostic for "previous declaration here" for implicit parameters. Fixes <rdar://problem/13211384>. llvm-svn: 175802
* Replace CFGElement llvm::cast support to be well-defined.David Blaikie2013-02-211-6/+6
| | | | | | See r175462 for another example/more details. llvm-svn: 175796
* Add support to Sema and CodeGen for floating point vector types in OpenCL.Joey Gouly2013-02-211-6/+45
| | | | llvm-svn: 175734
* Avoid implicit conversions of Optional<T> to bool.David Blaikie2013-02-211-3/+3
| | | | | | | This is a precursor to making Optional<T>'s operator bool 'explicit' when building Clang & LLVM as C++11. llvm-svn: 175722
* Use None rather than Optional<T>() where possible.David Blaikie2013-02-216-16/+13
| | | | llvm-svn: 175705
* MCParser: Update method names per coding guidelines.Jim Grosbach2013-02-201-1/+1
| | | | | | s/ParseMSInlineAsm/parseMSInlineAsm/ llvm-svn: 175680
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-209-84/+77
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* Process and handle attributes on conditions and for loop variables. Process andRichard Smith2013-02-202-2/+30
| | | | | | | diagnose attributes on alias declarations, using directives, and attribute declarations. llvm-svn: 175649
* Add a new 'type_visibility' attribute to allow users toJohn McCall2013-02-203-23/+66
| | | | | | | | | | | | | | 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
* [preprocessor] Split the MacroInfo class into two separate concepts, ↵Argyrios Kyrtzidis2013-02-202-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | MacroInfo class for the data specific to a macro definition (e.g. what the tokens are), and MacroDirective class which encapsulates the changes to the "macro namespace" (e.g. the location where the macro name became active, the location where it was undefined, etc.) (A MacroDirective always points to a MacroInfo object.) Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but splitting the concepts allows us to better model the effect of modules to the macro namespace (also as a bonus it allows better modeling of push_macro/pop_macro #pragmas). Modules can have their own macro history, separate from the local (current translation unit) macro history; MacroDirectives will be used to model the macro history (changes to macro namespace). For example, if "@import A;" imports macro FOO, there will be a new local MacroDirective created to indicate that "FOO" became active at the import location. Module "A" itself will contain another MacroDirective in its macro history (at the point of the definition of FOO) and both MacroDirectives will point to the same MacroInfo object. Introducing the separation of macro concepts is the first part towards better modeling of module macros. llvm-svn: 175585
* PR15300: Support C++11 attributes on base-specifiers. We don't support any suchRichard Smith2013-02-192-2/+19
| | | | | | | | attributes yet, so just issue the appropriate diagnostics. Also generalize the fixit for attributes-in-the-wrong-place code and reuse it here, if attributes are placed after the access-specifier or 'virtual' in a base specifier. llvm-svn: 175575
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-1816-131/+128
| | | | | | | | | | | | | | 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
* Prevent crash on multiple user errors (which I cannot reproduce inFariborz Jahanian2013-02-181-0/+4
| | | | | | a small test case). // rdar://13178483. llvm-svn: 175450
* Don't warn on conversion from NULL to nullptr_tDavid Blaikie2013-02-161-1/+1
| | | | llvm-svn: 175331
* Fixed diagnostic nondeterministic order bug (pr14901).Enea Zaffanella2013-02-151-7/+10
| | | | llvm-svn: 175289
OpenPOWER on IntegriCloud