summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* [index] Avoid another crash that happens when looking up a dependent nameAlex Lorenz2017-05-161-0/+2
| | | | | | | | in a record that has a base without a definition rdar://32224197 llvm-svn: 303192
* [OPENMP] Check DSA for variables captured by value.Alexey Bataev2017-05-151-1/+1
| | | | | | | | Currently clang checks for default data sharing attributes only for variables captured in OpenMP regions by reference. Patch adds checks for variables captured by value. llvm-svn: 303077
* Revert r302965 - [modules] When creating a declaration, cache its owningDaniel Jasper2017-05-153-14/+9
| | | | | | | | | module immediately Also revert dependent r302969. This is leading to crashes. Will provide more details reproduction instructions to Richard. llvm-svn: 303037
* [ASTImporter] Improve handling of incomplete typesSean Callanan2017-05-133-0/+25
| | | | | | | | | | | | | | | | | | | | | ASTImporter has some bugs when it's importing types that themselves come from an ExternalASTSource. This is exposed particularly in the behavior when comparing complete TagDecls with forward declarations. This patch does several things: - Adds a test case making sure that conflicting forward-declarations are resolved correctly; - Extends the clang-import-test harness to test two-level importing, so that we make sure we complete types when necessary; and - Fixes a few bugs I found this way. Failure to complete types was one; however, I also discovered that complete RecordDecls aren't properly added to the redecls chain for existing forward declarations. llvm-svn: 302975
* Add LangOptions method to query whether we are tracking the owning module ↵Richard Smith2017-05-131-2/+2
| | | | | | | | for a local declaration. In preparation for expanding this behavior to cover additional cases. llvm-svn: 302969
* [modules] When creating a declaration, cache its owning module immediatelyRichard Smith2017-05-123-7/+12
| | | | | | | | | | rather than waiting until it's queried. Currently this is only applied to local submodule visibility mode, as we don't yet allocate storage for the owning module in non-local-visibility modules compilations. llvm-svn: 302965
* Fix an assertion failure (PR33020).Alexander Kornienko2017-05-121-2/+3
| | | | | | Adding a test separately (tools/extra/test/clang-tidy/misc-use-after-move.cpp). llvm-svn: 302889
* [index] Index simple dependent declaration referencesAlex Lorenz2017-05-101-18/+94
| | | | | | | | | | | | This commit implements basic support for indexing of dependent declaration references. Now the indexer tries to find a suitable match in the base template for a dependent member ref/decl ref/dependent type. rdar://29158210 Differential Revision: https://reviews.llvm.org/D32972 llvm-svn: 302632
* [Sema] Implement Core 2094: Trivial copy/move constructor for class with ↵Eric Fiselier2017-05-091-5/+2
| | | | | | | | | | | | | | | | volatile member Summary: This patch implements http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2094 which reverts Core 496. Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D32984 llvm-svn: 302593
* [ODRHash] Loosen checks on typedefs.Richard Trieu2017-05-091-1/+1
| | | | | | | When a type in a class is from a typedef, only check the canonical type. Skip checking the intermediate underlying types. This is in response to PR 32965 llvm-svn: 302505
* [ODRHash] Add support for array and decayed types, and parameter names and ↵Richard Trieu2017-05-021-0/+82
| | | | | | types. llvm-svn: 301989
* Revert r301822 (and dependent r301825), which tried to improve theDaniel Jasper2017-05-021-136/+106
| | | | | | | | | | | | | | | | | | | | | | | | handling of constexprs with unknown bounds. This triggers a corner case of the language where it's not yet clear whether this should be an error: struct A { static void *const a[]; static void *const b[]; }; constexpr void *A::a[] = {&b[0]}; constexpr void *A::b[] = {&a[0]}; When discovering the initializer for A::a, the bounds of A::b aren't known yet. It is unclear whether warning about errors should be deferred until the end of the translation unit, possibly resolving errors that can be resolved. In practice, the compiler can know the bounds of all arrays in this example. Credits for reproducers and explanation go to Richard Smith. Richard, please add more info in case my explanation is wrong. llvm-svn: 301963
* Revert r301785 (and r301787) because they caused PR32864.Nick Lewycky2017-05-021-7/+1
| | | | | | The fix is that ExprEvaluatorBase::VisitInitListExpr should handle transparent exprs instead of exprs with one element. Fixing that uncovers one testcase failure because the AST for "constexpr _Complex float test2 = {1};" is wrong (the _Complex prvalue should not be const-qualified), and a number of test failures in test/OpenMP where the captured stmt contains an InitListExpr that is in syntactic form. llvm-svn: 301891
* Silence unused variable warning. NFC.Benjamin Kramer2017-05-011-1/+1
| | | | llvm-svn: 301825
* Improve handling of arrays of unknown bound in constant expressions.Richard Smith2017-05-011-106/+136
| | | | | | | | | | | | | | Do not spuriously reject constexpr functions that access elements of an array of unknown bound; this may later become valid once the bound is known. Permit array-to-pointer decay on such arrays, but disallow pointer arithmetic (since we do not know whether it will have defined behavior). The standard is not clear on how this should work, but this seems to be a decent answer. Patch by Robert Haberlach! llvm-svn: 301822
* Handle expressions with non-literal types like ignored expressions if we are ↵Nick Lewycky2017-05-011-1/+7
| | | | | | | | supposed to continue evaluating them. Also fix a crash casting a derived nullptr to a virtual base. llvm-svn: 301785
* Remove Sema::CheckForIntOverflow, and instead check all full-expressions.Nick Lewycky2017-04-291-4/+9
| | | | | | | | CheckForIntOverflow used to implement a whitelist of top-level expressions to send to the constant expression evaluator, which handled many more expressions than the CheckForIntOverflow whitelist did. llvm-svn: 301742
* ObjCBoxedExpr can't be evaluated by the constant expression evaluator.Nick Lewycky2017-04-291-2/+5
| | | | | | | | A boxed expression evaluates its subexpr and then calls an objc method to transform it into another value with pointer type. The objc method can never be constexpr and therefore this expression can never be evaluated. Fixes a miscompile boxing expressions with side-effects. Also make ObjCBoxedExpr handling a normal part of the expression evaluator instead of being the only case besides full-expression where we check for integer overflow. llvm-svn: 301721
* [ASTImporter] Move structural equivalence context to its own file. NFCIBruno Cardoso Lopes2017-04-283-1413/+1350
| | | | | | | | | | | Create a header and impl file for the structural equivalence context. This is to allow other users outside clang importer. NFCI Differential Revision: https://reviews.llvm.org/D31777 rdar://problem/30167717 llvm-svn: 301604
* [X86] Support of no_caller_saved_registers attributeOren Ben Simhon2017-04-272-0/+4
| | | | | | | | | Implements the Clang part for no_caller_saved_registers attribute as appears here: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5ed3cc7b66af4758f7849ed6f65f4365be8223be. Differential Revision: https://reviews.llvm.org/D31871 llvm-svn: 301535
* [ObjC] Disallow vector parameters and return values in Objective-C methodsAlex Lorenz2017-04-271-10/+28
| | | | | | | | | | | | | | | | | for iOS < 9 and OS X < 10.11 X86 targets This commit adds a new error that disallows methods that have parameters/return values with a vector type for some older X86 targets. This diagnostic is needed because objc_msgSend doesn't support SIMD vector registers/return values on X86 in iOS < 9 and OS X < 10.11. Note that we don't necessarily know if the vector argument/return value will use a SIMD register, so instead we chose to be conservative and prohibit all vector types. rdar://21662309 Differential Revision: https://reviews.llvm.org/D28670 llvm-svn: 301532
* In the expression evaluator, visit the index of an ArraySubscriptExpr even ↵Nick Lewycky2017-04-271-3/+8
| | | | | | if we can't evaluate the base, if the evaluation mode tells us to continue evaluation. llvm-svn: 301522
* In the expression evaluator, descend into both the true and false ↵Nick Lewycky2017-04-271-1/+7
| | | | | | expressions of a ConditionalOperator when the condition can't be evaluated and we're in an evaluation mode that says we should continue evaluating. llvm-svn: 301520
* -Wdocumentation should not check the @returns command for Objective-CAlex Lorenz2017-04-261-2/+4
| | | | | | | | | | | | | | | | function/block pointer properties The commit r300981 allowed @param/@return commands for function/block pointer property declarations. This meant that -Wdocumentation started warning about @return that was used to document properties whose function/block type returned void. However, prior to that commit, we allowed @return for all property declarations, because it can be used to document the value that's returned by the property getter. This commit restores the previous behaviour: now the @return command can be used to document all properties without warnings. rdar://24978538 llvm-svn: 301402
* [AST] Look through attribute type locs when searching for function typeAlex Lorenz2017-04-261-0/+3
| | | | | | | | | | | | loc Prior to this commit -Wdocumentation crashed when checking the @returns command for declarations whose function/block pointer type included an attribute like _Nullable. rdar://31818195 llvm-svn: 301400
* [Modules][ObjC] Check definition from canonical decl on designated initializersBruno Cardoso Lopes2017-04-261-1/+10
| | | | | | | | | | Use definition from canonical decl when checking for designated initializers. This is necessary since deserialization of a interface might reuse the definition from the canonical one (see r281119). rdar://problem/29360655 llvm-svn: 301382
* [PR32667] -Wdocumentation should allow @param/@returns for fields/variablesAlex Lorenz2017-04-212-2/+43
| | | | | | | | | | | | | | | | that have a function/block pointer type This commit improves the -Wdocumentation warning by making sure that @param and @returns commands won't trigger warnings when used for fields, variables, or properties whose type is a function/block pointer type. The function/block pointer type must be specified directly with the declaration, and when a typedef is used the warning is still emitted. In the future we might also want to handle the std::function type as well. rdar://24978538 llvm-svn: 300981
* [modules] Properly look up the owning module for an instantiation of a ↵Richard Smith2017-04-212-29/+39
| | | | | | | | | | | | | | | merged template. When looking for the template instantiation pattern of a templated entity, consistently select the definition of the pattern if there is one. This means we'll pick the same owning module when we start instantiating a template that we'll later pick when determining which modules are visible during that instantiation. This reinstates r300650, reverted in r300659, with a fix for a regression reported by Chandler after commit. llvm-svn: 300938
* [OpenMP] Prepare sema to support combined constructs with omp distribute and ↵Carlo Bertolli2017-04-201-56/+42
| | | | | | | | | | omp for https://reviews.llvm.org/D32237 This patch prepares sema with additional fields to support all those composite and combined constructs of OpenMP that include pragma 'distribute' and 'for', such as 'distribute parallel for'. It also extends the regression tests for 'distribute parallel for' and adds a new one. llvm-svn: 300802
* Corrrect warn_unused_result attribute Erich Keane2017-04-191-3/+1
| | | | | | | | | | | | The original idea was that if the attribute on an operator, that the return-value unused-ness wouldn't matter. However, all of the operators except postfix inc/dec return references! References don't result in this warning anyway, so those are already excluded. Differential Revision: https://reviews.llvm.org/D32207 llvm-svn: 300764
* Remove unnecessary condition as suggested by clang-tidy. NFCGabor Horvath2017-04-191-4/+2
| | | | | | | | Patch by: Gergely Angeli! Differential Revision: https://reviews.llvm.org/D31938 llvm-svn: 300703
* Avoid assert when a non-static member function is qualified with __unalignedRoger Ferrer Ibanez2017-04-191-1/+3
| | | | | | | | | | | | | | | Under -fms-extensions __unaligned is a type-qualifier that can be applied to a non-static member function declaration. This causes an assertion when mangling the name under Itanium, where that qualifier is not mangled. This patch justs makes the minimal change to avoid the crash and avoid mangling __unaligned, as it currently happens with non-member functions. Differential Revision: https://reviews.llvm.org/D31976 llvm-svn: 300686
* Revert r300653 and r300650. The underlying commit fixes one issue withChandler Carruth2017-04-192-39/+29
| | | | | | | | | | modules but exposes much more widespread issues. Example and more information is on the review thread for r300650. Original commit summary: [modules] Properly look up the owning module for an instantiation of a merged template. llvm-svn: 300659
* Fix member function call with null 'this' pointer.Richard Smith2017-04-191-3/+7
| | | | llvm-svn: 300653
* [modules] Properly look up the owning module for an instantiation of a ↵Richard Smith2017-04-192-27/+33
| | | | | | | | | | | | merged template. When looking for the template instantiation pattern of a templated entity, consistently select the definition of the pattern if there is one. This means we'll pick the same owning module when we start instantiating a template that we'll later pick when determining which modules are visible during that instantiation. llvm-svn: 300650
* [ASTPrinter] Print template parameter lists for out-of-line functionsAlex Lorenz2017-04-181-0/+11
| | | | llvm-svn: 300560
* Revert "Address http://bugs.llvm.org/pr30994 so that a non-friend can ↵Benjamin Kramer2017-04-172-19/+0
| | | | | | | | | properly replace a friend, and a visible friend can properly replace an invisible friend but not vice verse, and definitions are not replaced. This fixes the two FIXME in SemaTemplate/friend-template.cpp." This reverts commit r300443. Breaks compiling libc++ with modules in some configurations. llvm-svn: 300497
* Use default ref capture to simplify local lambdas, use a template to avoid ↵David Blaikie2017-04-171-22/+17
| | | | | | std::function overhead, other cleanup llvm-svn: 300461
* Address http://bugs.llvm.org/pr30994 so that a non-friend can properly ↵Yaron Keren2017-04-172-0/+19
| | | | | | | | | | | | replace a friend, and a visible friend can properly replace an invisible friend but not vice verse, and definitions are not replaced. This fixes the two FIXME in SemaTemplate/friend-template.cpp. The code implements Richard Smith suggestion in comment 3 of the PR. reviewer: Vassil Vassilev Differential Revision: https://reviews.llvm.org/D31540 llvm-svn: 300443
* ExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]NAKAMURA Takumi2017-04-131-0/+1
| | | | llvm-svn: 300145
* Revert r300001 "Revert r298824 & r298816, recommit r298742 & r298754"Hans Wennborg2017-04-121-100/+0
| | | | | | It caused PR32640. llvm-svn: 300074
* Silence unused variable warning in release builds.Benjamin Kramer2017-04-111-0/+1
| | | | llvm-svn: 300006
* Revert r298824 & r298816, recommit r298742 & r298754Richard Trieu2017-04-111-0/+100
| | | | | | | | | | | | | r299989 fixes the underlying issue by waiting long enough to late parsed arguments to be processed before doing an calculating the hash. r298742 [ODRHash] Add error messages for mismatched parameters in methods. r298754 [ODRHash] Add support for array and decayed types. llvm-svn: 300001
* [ODRHash] Improve handling of hash valuesRichard Trieu2017-04-111-7/+15
| | | | | | | | | | | Calculating the hash in Sema::ActOnTagFinishDefinition could happen before all sub-Decls were parsed or processed, which would produce the wrong hash value. Change to calculating the hash on the first use and storing the value instead. Also, avoid using the macros that were only for Boolean fields and use an explicit checker during the DefintionData merge. No functional change, but was this blocking other ODRHash patches. llvm-svn: 299989
* Modular Codegen: Support homing debug info for types in modular objectsDavid Blaikie2017-04-111-1/+1
| | | | | | | | | Matching the function-homing support for modular codegen. Any type implicitly (implicit template specializations) or explicitly defined in a module is attached to that module's object file and omitted elsewhere (only a declaration used if necessary for references). llvm-svn: 299987
* [ExternalASTMerger] Removed a move constructor to address MSVC build failureSean Callanan2017-04-111-1/+1
| | | | llvm-svn: 299983
* Modular Codegen: Add/use a bit in serialized function definitions to track ↵David Blaikie2017-04-112-6/+3
| | | | | | | | | | | | | | | | | | | | | whether they are the subject of modular codegen Some decls are created not where they are written, but in other module files/users (implicit special members and function template implicit specializations). To correctly identify them, use a bit next to the definition to track the modular codegen property. Discussed whether the module file bit could be omitted in favor of reconstituting from the modular codegen decls list - best guess today is that the efficiency improvement of not having to deserialize the whole list whenever any function is queried by a module user is worth it for the small size increase of this redundant (list + bit-on-def) representation. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D29901 llvm-svn: 299982
* Add const children() accessors to match the existing non-const children() ↵Aaron Ballman2017-04-111-5/+11
| | | | | | accessors. llvm-svn: 299981
* [ExternalASTMerger] Fix the MSVC buildSean Callanan2017-04-111-3/+3
| | | | llvm-svn: 299977
* [clang-import-test] Lookup inside contextsSean Callanan2017-04-112-0/+184
| | | | | | | | | | | | | | | | | | | clang-import-test has until now been only able to report top-level Decls. This is clearly insufficient; we should be able to look inside structs and namespaces also. This patch adds new test cases for a variety of lookups inside existing ASTContexts, and adds the functionality necessar to make most of these testcases work. (One testcase is known to fail because of ASTImporter limitations when importing templates; I'll look into that separately.) This patch also separates the core functionality out into ExternalASTMerger, an interface that allows clients like LLDB to make use of it. clang-import-test now only has the machinery necessary to set up the tests. Differential revision: https://reviews.llvm.org/D30435 llvm-svn: 299976
OpenPOWER on IntegriCloud