summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Only take NULL macros instead of all macros into account for -Wnull-conversion.Richard Trieu2016-01-091-2/+6
| | | | llvm-svn: 257240
* Exclude function calls for functions which have return type nullptr_t fromRichard Trieu2016-01-081-0/+4
| | | | | | | | | -Wnull-conversion warning. These functions are basically equivalent to other pointer returning fuctions which are already excluded by -Wnull-conversion. llvm-svn: 257231
* Properly track that a character literal is UTF-8, and pretty print the ↵Aaron Ballman2016-01-073-0/+6
| | | | | | prefix properly. llvm-svn: 257097
* [Sema] Teach overload resolution about unaddressable functions.George Burgess IV2016-01-072-4/+39
| | | | | | | | | | | | Given an expression like `(&Foo)();`, we perform overload resolution as if we are calling `Foo` directly. This causes problems if `Foo` is a function that can't have its address taken. This patch teaches overload resolution to ignore functions that can't have their address taken in such cases. Differential Revision: http://reviews.llvm.org/D15590 llvm-svn: 257016
* Properly bind up any cleanups in an ExprWithCleanups afterJohn McCall2016-01-061-6/+5
| | | | | | | | | | instantiating a default argument expression. This was previously just working implicitly by reinstantiating in the current context, but caching means that we weren't registering cleanups in subsequent uses. llvm-svn: 256996
* Only instantiate a default argument once.John McCall2016-01-061-1/+8
| | | | | | | | | | | | | | | | | | | By storing the instantiated expression back in the ParmVarDecl, we remove the last need for separately storing the sub-expression of a CXXDefaultArgExpr. This makes PCH/Modules merging quite simple: CXXDefaultArgExpr records are serialized as references to the ParmVarDecl, and we ignore redundant attempts to overwrite the instantiated expression. This has some extremely marginal impact on user-facing semantics. However, the major effect is that it avoids IRGen errors about conflicting definitions due to lambdas in the argument being instantiated multiple times while sharing the same mangling. It should also slightly improve memory usage and module file size. rdar://23810407 llvm-svn: 256983
* Fix half of PR26048. We don't yet diagnose the case where the anonymous ↵Richard Smith2016-01-061-8/+7
| | | | | | union member is declared first and the tag name is declared second. llvm-svn: 256979
* Improve conditional checking during template instantiation.Richard Trieu2016-01-061-3/+5
| | | | | | | | | | | | | When the condition in an if statement, while statement, or for loop is created during template instantiation, it calls MakeFullExpr with only the condition expression. However, when these conditions are created for non-templated code in the Parser, an additional SourceLocation is passed to MakeFullExpr. The impact of this was that non-dependent templated code could produce diagnostics that the same code outside templates would not. Adding the missing SourceLocation makes diagnostics consistent between templated and non-templated code. llvm-svn: 256976
* [modules] When a tag type that was imported from a module is referenced via anRichard Smith2016-01-061-10/+29
| | | | | | | elaborated-type-specifier, create a declaration of it to track that the current module makes it visible too. llvm-svn: 256907
* Avoid walking all the declarations in the TU when a tag is declared in functionRichard Smith2016-01-051-6/+2
| | | | | | prototype scope in a function definition. llvm-svn: 256803
* Remove an unused parameterDavid Majnemer2016-01-051-4/+1
| | | | | | No functionality change is intended llvm-svn: 256797
* [ms-inline-asm] Handle dependent identifiers in inline asmDavid Majnemer2016-01-041-4/+13
| | | | | | | | | Build up a dependent expression for MS-style inline assembly if the identifier's type is dependent. This fixes PR26001. llvm-svn: 256795
* [MSVC Compat] Diagnose multiple default ctors for dllexport'd classesDavid Majnemer2015-12-311-1/+23
| | | | | | | | | | | | | | | | | The MS ABI emits a special default constructor closure thunk if a default constructor has a weird calling convention or default arguments. The MS ABI has a quirk: there can be only one such thunk because the mangling scheme does not have room for distinct manglings. We must raise a diagnostic in this eventuality. N.B. MSVC sorta gets this right. Multiple default constructors result in the default constructor closure getting emitted but they seem to get confused by which default constructors are reasonable to reference from the closure. We try to be a little more careful which results in mild differences in behavior. llvm-svn: 256661
* [TrailingObjects] Convert classes in ExprObjC.hJames Y Knight2015-12-311-3/+3
| | | | llvm-svn: 256659
* Improve diagnostic for the case where a function template candidate is rejectedRichard Smith2015-12-312-6/+58
| | | | | | | | by overload resolution because deduction succeeds, but the substituted parameter type for some parameter (with deduced type) doesn't exactly match the corresponding adjusted argument type. llvm-svn: 256657
* Implement [temp.deduct.type]p6: if the nested-name-specifier of a type isRichard Smith2015-12-301-10/+14
| | | | | | dependent, the type is a non-deduced context. llvm-svn: 256651
* When performing an implicit from float to bool, the floating point value ↵Aaron Ballman2015-12-301-1/+1
| | | | | | | | must be *exactly* zero in order for the conversion to result in 0. This does not involve a conversion through an integer value, and so truncation of the value is not performed. This patch address PR25876. llvm-svn: 256643
* [OPENMP 4.5] Allow 'ordered' clause on 'loop simd' constructs.Alexey Bataev2015-12-301-0/+7
| | | | | | OpenMP 4.5 allows to use 'ordered' clause without parameter on 'loop simd' constructs. llvm-svn: 256639
* Clean up this code, NFC.Richard Smith2015-12-301-8/+12
| | | | llvm-svn: 256607
* When a namespace alias redeclares a using declaration, point the diagnostic atRichard Smith2015-12-291-4/+4
| | | | | | the using declaration not at the thing it's using. llvm-svn: 256602
* Model NamespaceAliasDecls as having their nominated namespace as an underlyingRichard Smith2015-12-293-25/+24
| | | | | | | | | | | | | declaration. This fixes an issue where we would reject (due to a claimed ambiguity) a case where lookup finds multiple NamespaceAliasDecls from different scopes that nominate the same namespace. The C++ standard doesn't make it clear that such a case is in fact valid (which I'm working on fixing), but there are no relevant rules that distinguish using declarations and namespace alias declarations here, so it makes sense to treat them the same way. llvm-svn: 256601
* [TrailingObjects] Convert OffsetOfExpr.James Y Knight2015-12-292-7/+5
| | | | | | That necessitated moving the OffsetOfNode class out of OffsetOfExpr. llvm-svn: 256590
* fix typos; NFCSanjay Patel2015-12-292-3/+3
| | | | llvm-svn: 256576
* Teach typo correction to properly handle mapping declarations to theirRichard Smith2015-12-297-29/+27
| | | | | | | | | | underlying decls. Preserve the found declaration throughout, and only map to the underlying declaration when we want to check whether it's the right kind. This allows us to provide the right source location for the found declaration, and prepares for the possibility of underlying decls with a different name from the found decl. llvm-svn: 256575
* [ms inline asm] Add support for label names with '$' charsMarina Yatsina2015-12-291-1/+9
| | | | | | | | | In MS inline asm syntax a label with '$' char produces an error, while in AT&T it does not. In AT&T inline asm syntax Clang escapes the '$' char and replaces it with "$$". Adopted same approach for MS syntax. Differential Revision: http://reviews.llvm.org/D15795 llvm-svn: 256545
* Revert r93378, which is incorrect but currently unobservable (because theRichard Smith2015-12-291-3/+0
| | | | | | | underlying declaration of a NamedDecl happens to always have the same name and identifier namespace as the decl itself today). llvm-svn: 256529
* Do not crash if class is defined in wrong scope.Serge Pavlov2015-12-281-1/+3
| | | | | | | | | | | This patch fixes PR16677. The latter represents the case when due to misprinted character class definition occurs in the scope of template arguments. Base class of this class depends on the template parameter in the same scope and cannot be resolved, it causes crash. Right behavior is to make semantic processing even if the definition is wrong, as the code that emits appropriate message is called after the processing. llvm-svn: 256511
* [OPENMP 4.5] Sema/parsing support for extended format of 'schedule' clause.Alexey Bataev2015-12-282-100/+144
| | | | | | | | | OpenMP 4.0-3.1 supports the next format of ‘schedule’ clause: schedule(kind[, chunk_size]) Where kind can be one of ‘static’, ‘dynamic’, ‘guided’, ‘auto’ or ‘runtime’. OpenMP 4.5 defines the format: schedule([modifier [, modifier]:]kind[, chunk_size]) Modifier can be one of ‘monotonic’, ‘nonmonotonic’ or ‘simd’. llvm-svn: 256487
* [OPENMP 4.5] Do not allow 'linear' clause along with 'ordered(expr)' clause.Alexey Bataev2015-12-281-0/+15
| | | | | | According to OpenMP 4.5 "A linear clause or an ordered clause with a parameter can be specified on a loop directive but not both."" llvm-svn: 256485
* [Sema] ArrayRef-ize ActOnBaseSpecifiers. NFCCraig Topper2015-12-272-13/+11
| | | | llvm-svn: 256478
* ArrayRef-ize TemplateParameterList. NFCDavid Majnemer2015-12-274-9/+11
| | | | llvm-svn: 256463
* [OPENMP] Do not allow to use threadprivate or thread local variables as loop ↵Alexey Bataev2015-12-251-6/+4
| | | | | | | | iteration variables. According to OpenMP the loop iteration variable may not appear in a threadprivate directive. llvm-svn: 256417
* Revert r256399 "[Sema] ArrayRef-ize ActOnBaseSpecifiers. NFC"Craig Topper2015-12-252-11/+13
| | | | | | It broke lldb build. llvm-svn: 256403
* [Sema] ArrayRef-ize SubstExprs. NFCCraig Topper2015-12-242-5/+6
| | | | llvm-svn: 256401
* [Sema] ArrayRef-ize ActOnTemplateParameterList. NFCCraig Topper2015-12-241-3/+3
| | | | llvm-svn: 256400
* [Sema] ArrayRef-ize ActOnBaseSpecifiers. NFCCraig Topper2015-12-242-13/+11
| | | | llvm-svn: 256399
* [Sema] ArrayRef-ize BuildObjCDictionaryLiteral. NFCCraig Topper2015-12-242-20/+17
| | | | llvm-svn: 256398
* [Sema] ArrayRef-ize ParseObjCStringLiteral and ↵Craig Topper2015-12-242-13/+10
| | | | | | CodeCompleteObjCProtocolReferences. NFC llvm-svn: 256397
* [TrailingObjects] Convert ASTTemplateKWAndArgsInfo and ↵James Y Knight2015-12-242-3/+3
| | | | | | | | | | | | | | | | | | | ASTTemplateArgumentListInfo. Doing so required separating them so that the former doesn't inherit from the latter anymore. Investigating that, it became clear that the inheritance wasn't actually providing real value in any case. So also: - Remove a bunch of redundant functions (getExplicitTemplateArgs, getOptionalExplicitTemplateArgs) on various Expr subclasses which depended on the inheritance relationship. - Switched external callers to use pre-existing accessors that return the data they're actually interested in (getTemplateArgs, getNumTemplateArgs, etc). - Switched internal callers to use pre-existing getTemplateKWAndArgsInfo. llvm-svn: 256359
* Replace isa+cast with dyn_cast and obey the no else after return rule.Yaron Keren2015-12-231-6/+2
| | | | llvm-svn: 256349
* [OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.Alexey Bataev2015-12-232-58/+198
| | | | | | OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause. llvm-svn: 256330
* [Sema] Make an enum local to the only method that uses it. NFCCraig Topper2015-12-231-7/+5
| | | | llvm-svn: 256319
* [Sema] Use available enum types instead of integers. As one is used in a ↵Craig Topper2015-12-231-3/+2
| | | | | | switch, this makes the compiler ensure the switch is fully covered. NFC llvm-svn: 256318
* [OpenCL] Fix atomic Builtins check for address spaces of non-atomic pointerAnastasia Stulova2015-12-221-2/+11
| | | | | | | | | | | If there are two pointers passed to an atomic Builtin, Clang doesn't allow the second (non-atomic) one to be qualified with an address space. Remove this restriction by recording the address space of passed pointers in atomics type diagnostics. llvm-svn: 256243
* [OPENMP] Revert r256238 to fix the problem with tests on Linux.Alexey Bataev2015-12-222-186/+43
| | | | llvm-svn: 256239
* [OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.Alexey Bataev2015-12-222-43/+186
| | | | | | OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause. llvm-svn: 256238
* [Sema] Use range-based for loops. NFCCraig Topper2015-12-211-56/+39
| | | | llvm-svn: 256135
* Split RequireCompleteType into a function that actually requires that the typeRichard Smith2015-12-1815-114/+96
| | | | | | | | | | | | | | | | | | | is complete (with an error produced if not) and a function that merely queries whether the type is complete. Either way we'll trigger instantiation if necessary, but only the former will diagnose and recover from missing module imports. The intent of this change is to prevent a class of bugs where code would call RequireCompleteType(..., 0) and then ignore the result. With modules, we must check the return value and use it to determine whether the definition of the type is visible. This also fixes a debug info quality issue: calls to isCompleteType do not trigger the emission of debug information for a type in limited-debug-info mode. This allows us to avoid emitting debug information for type definitions in more cases where we believe it is safe to do so. llvm-svn: 256049
* [modules] Don't try to use the definition of a class ifRichard Smith2015-12-183-100/+103
| | | | | | | RequireCompleteType(..., 0) says we're not permitted to do so. The definition might not be visible, even though we know what it is. llvm-svn: 256045
* Wire a SourceLocation into IsDerivedFrom and move the RequireCompleteType callRichard Smith2015-12-189-91/+105
| | | | | | | | for the derived class into it. This is mostly just a cleanup, but could in principle be a bugfix if there is some codepath that reaches here and didn't previously require a complete type (I couldn't find any such codepath, though). llvm-svn: 256037
OpenPOWER on IntegriCloud