summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* [OpenMP] Parsing + sema for defaultmap clause.Arpith Chacko Jacob2016-01-262-0/+12
| | | | | | | | | | | Summary: This patch adds parsing + sema for the defaultmap clause associated with the target directive (among others). Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16527 llvm-svn: 258817
* [MS Compat] Don't crash if __GetExceptionInfo is in global scopeDavid Majnemer2016-01-261-2/+1
| | | | | | | | | | | __GetExceptionInfo triggered Sema::LazilyCreateBuiltin which tries to create a non-templated function decl. This is unnecessary and ill-advised, there is no need for us to create a declaration for such a builtin. This fixes PR26298. llvm-svn: 258762
* Fix printing of types in initializers with suppressed tags.Benjamin Kramer2016-01-251-1/+4
| | | | | | | | | | | | | | | | | | Tag and specifier printing can be suppressed in Decl::printGroup, but these suppressions leak into the initializers. Thus int *x = ((void *)0), *y = ((void *)0); gets printed as int *x = ((void *)0), *y = ((*)0); And struct { struct Z z; } z = {(struct Z){}}; gets printed as struct { struct Z z; } z = {(){}}; The stops the suppressions from leaking into the initializers. Patch by Nick Sumner! Differential Revision: http://reviews.llvm.org/D16438 llvm-svn: 258679
* [OpenMP] Detect implicit map type to report unspecified map type for target ↵Samuel Antao2016-01-191-2/+4
| | | | | | | | | | | | | | | | | | | | enter/exit data directives. Support for the following OpenMP 4.5 restriction on 'target enter data' and 'target exit data': - A map-type must be specified in all map clauses. I have to save 'IsMapTypeImplicit' when parsing a map clause to support this constraint and for more informative error messages. This helps me support the following case: #pragma omp target enter data map(r) // expected-error {{map type must be specified for '#pragma omp target enter data'}} and distinguish it from: #pragma omp target enter data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target enter data'}} Patch by Arpith Jacob. Thanks! llvm-svn: 258179
* [OpenMP] Parsing + sema for "target exit data" directive.Samuel Antao2016-01-193-0/+33
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258177
* [OpenMP] Parsing + sema for "target enter data" directive.Samuel Antao2016-01-193-0/+32
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258165
* [MS ABI] Don't crash while mangling recursive lambdasDavid Majnemer2016-01-171-4/+12
| | | | | | | | | | | | | | | We might get into bad situations where we try to embed the signature of an inner lambda into an outer lambda which cannot work: the inner lambda wants to embed the name of the outer lambda! Instead, omit the return type for lambdas. This fixes PR26105. N.B. While we are here, make lambdas nested within functions use an artificial scope so that they can get demangled. llvm-svn: 258003
* [libclang] Introduce APIs for evaluating a cursor and checking if a macro is ↵Argyrios Kyrtzidis2016-01-161-1/+1
| | | | | | | | builtin/function. rdar://24091595 llvm-svn: 257968
* Add OpenMP dist_schedule clause to distribute directive and related ↵Carlo Bertolli2016-01-152-0/+20
| | | | | | regression tests. llvm-svn: 257917
* Fix a -Wparentheses warning in ASTDiagnostic.cpp.James Y Knight2016-01-151-1/+1
| | | | llvm-svn: 257871
* Fixing more issues with template type diffingRichard Trieu2016-01-151-16/+20
| | | | | | | | | | | | 1) Print qualifiers for templates with zero arguments 2) Add a few more tests for the template type diffing refactoring. Specifically, PR24587 has been fixed and has a test case from http://reviews.llvm.org/D15384 3) Adds asserts to check the DiffTree is in correct state when moving nodes 4) Rename the field FromType and ToType since it is heavily used within member functions. llvm-svn: 257870
* Add new diff modes to template type diffing.Richard Trieu2016-01-151-8/+168
| | | | | | | | Remove an old assertion that does not hold. It is possible for a template argument to be a declaration in one instantiation and an integer in another. Create two new diff kinds for these (decl vs int and int vs decl). llvm-svn: 257869
* Save the integer type for integral template arguments.Richard Trieu2016-01-151-25/+64
| | | | | | | | | Save the integer type when diffing integers in template type diffing. When integers are different sizes, print out the type along with the integer value. Also with the type information, print true and false instead of 1 and 0 for boolean values. llvm-svn: 257861
* Make template type diffing use the new desguared iterator.Richard Trieu2016-01-151-322/+158
| | | | | | | | | | | | | If available, use the canonical template argument to fill in information for template type diffing instead of attempting to special case and evaluate Expr's for the value. Since those are the values used in template instantiation, we don't have to worry about difference between our evaluator and theirs. Also move the nullptr template arguments from DiffKind::Expression to DiffKind::Declaration and allow DiffKind::Declaration to set an Expr. The only effect that should result is that a named nullptr will show up as 'ptr aka nullptr' in diagnostics. llvm-svn: 257853
* [CUDA] Warn undeclared identifiers in CUDA kernel callsJustin Lebar2016-01-141-21/+32
| | | | | | | | | | | | | | | | | | Value, type, and instantiation dependence were not being handled correctly for CUDAKernelCallExpr AST nodes. As a result, if an undeclared identifier was used in the triple-angle-bracket kernel call configuration, there would be no error during parsing, and there would be a crash during code gen. This patch makes sure that an error will be issued during parsing in this case, just as there would be for any other use of an undeclared identifier in C++. Patch by Jason Henline. Reviewers: jlebar, rsmith Differential Revision: http://reviews.llvm.org/D15858 llvm-svn: 257839
* Change the TSTiterator in Template Type Diffing.Richard Trieu2016-01-141-80/+117
| | | | | | | | Modify the TSTiterator to have two internal iterators, which will walk the provided sugared type and the desugared type. This will provide better access to the template argument information. No functional changes. llvm-svn: 257838
* Refactor template type diffingRichard Trieu2016-01-141-226/+249
| | | | | | | | | | | | | | | 1) Instead of using pairs of From/To* fields, combine fields into a struct TemplateArgInfo and have two in each DiffNode. 2) Use default initialization in DiffNode so that the constructor shows the only field that is initialized differently on construction. 3) Use Set and Get functions per each DiffKind to make sure all fields for the diff is set. In one case, the Expr fields were not set. 4) Don't print boolean literals for boolean template arguments. This prevents printing 'false aka 0' Only #3 has a functional change, which is reflected in the test change. llvm-svn: 257831
* Update for LLVM function name change.Rui Ueyama2016-01-148-167/+160
| | | | llvm-svn: 257802
* [Bugfix] Fix ICE on constexpr vector splat.George Burgess IV2016-01-132-1/+9
| | | | | | | | | | | | | In {CG,}ExprConstant.cpp, we weren't treating vector splats properly. This patch makes us treat splats more properly. Additionally, this patch adds a new cast kind which allows a bool->int cast to result in -1 or 0, instead of 1 or 0 (for true and false, respectively), so we can sanely model OpenCL bool->int casts in the AST. Differential Revision: http://reviews.llvm.org/D14877 llvm-svn: 257559
* Improve AST dumping:Richard Smith2016-01-121-0/+4
| | | | | | | | 1) When dumping a declaration that declares a name for a type, also dump the named type. 2) Add a #pragma clang __debug dump X, that dumps the lookup results for X in the current context. llvm-svn: 257529
* PR18513: make gcc compatible layout for bit-fields with explicit aligned ↵Alexey Bataev2016-01-121-1/+9
| | | | | | | | | attribute, by Dmitry Polukhin Fix binary compatibility issue with GCC. Differential Revision: http://reviews.llvm.org/D14980 llvm-svn: 257462
* Fix infinite recursion for invalid declaration, by Dmitry PolukhinAlexey Bataev2016-01-121-1/+1
| | | | | | | Fix for a case found by fuzzing PR23057 (comment #25 https://llvm.org/bugs/show_bug.cgi?id=23057#c25). Differential Revision: http://reviews.llvm.org/D16065 llvm-svn: 257461
* [OpenCL] Pipe type supportXiuli Pan2016-01-096-0/+93
| | | | | | | | | | | | | | | Summary: Support for OpenCL 2.0 pipe type. This is a bug-fix version for bader's patch reviews.llvm.org/D14441 Reviewers: pekka.jaaskelainen, Anastasia Subscribers: bader, Anastasia, cfe-commits Differential Revision: http://reviews.llvm.org/D15603 llvm-svn: 257254
* Test CommitXiuli Pan2016-01-091-1/+1
| | | | | | Fix a typo llvm-svn: 257252
* Properly track that a character literal is UTF-8, and pretty print the ↵Aaron Ballman2016-01-071-0/+1
| | | | | | prefix properly. llvm-svn: 257097
* PR26048, PR26050: put non-type template parameters and indirect field declsRichard Smith2016-01-062-3/+18
| | | | | | | | into IDNS_Tag in C++, because they conflict with redeclarations of tags. (This doesn't affect elaborated-type-specifier lookup, which looks for IDNS_Type in C++). llvm-svn: 256985
* Only instantiate a default argument once.John McCall2016-01-061-8/+0
| | | | | | | | | | | | | | | | | | | 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
* ArrayRef-ize a function. NFCCraig Topper2016-01-031-6/+4
| | | | llvm-svn: 256718
* [TrailingObjects] Convert classes in OpenMPClause.hJames Y Knight2016-01-011-72/+24
| | | | llvm-svn: 256683
* [TrailingObjects] Fix bug in "Convert classes in ExprObjC.h"James Y Knight2015-12-311-1/+2
| | | | | | (Detected by asan) llvm-svn: 256665
* [MS ABI] Remove mangleCXXCatchHandlerTypeDavid Majnemer2015-12-311-11/+0
| | | | | | It's dead code, no functional change is intended. llvm-svn: 256664
* [MS ABI] Change the ArgBackRefMap to hold const qualified pointersDavid Majnemer2015-12-311-2/+2
| | | | | | Just a cleanup, no functional change is intended. llvm-svn: 256663
* [MS ABI] Replace dead code with an assertionDavid Majnemer2015-12-311-2/+4
| | | | | | | As per C++ [dcl.ref]p1, cv-qualified references are not valid. As such, change the mangler to assert that this event does not happen. llvm-svn: 256662
* [TrailingObjects] Convert classes in ExprObjC.hJames Y Knight2015-12-311-31/+11
| | | | llvm-svn: 256659
* [TrailingObjects] Convert remaining classes in Expr.h and ExprCXX.hJames Y Knight2015-12-312-88/+59
| | | | llvm-svn: 256658
* Silencing a -Wcast-qual warning; NFC.Aaron Ballman2015-12-301-1/+1
| | | | llvm-svn: 256644
* [ptr-traits] Some compilers (older Clang? unsure) on build bots needChandler Carruth2015-12-301-0/+4
| | | | | | | | | this constructor to be out of line in order to not require the complete type of TemplateDecl. Hopefully this will fix the build bots. llvm-svn: 256629
* [MS ABI] Add variable templates to the NameBackReferencesDavid Majnemer2015-12-301-1/+1
| | | | | | | | Only function template specializations are exempt from being added to the NameBackReferences. Redundant variable template specializations should be appropriately substituted. llvm-svn: 256623
* [MS ABI] Improve our mangling of pass_object_sizeDavid Majnemer2015-12-301-4/+30
| | | | | | | | | | | | | | We didn't add the artificial pass_object_size arguments to the backreference map which bloated the size of manglings which involved pass_object_size with duplicate types. This lets us go from: ?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size1@3@@Z to: ?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z llvm-svn: 256622
* [ptr-traits] Add #includes of headers rather than forward declarationsChandler Carruth2015-12-301-0/+1
| | | | | | | | | | | | | | for types which are used as pointees in PointerUnions, PointerIntPairs, and DenseMap pointer keys. This is part of a series of patches to allow LLVM to check for complete pointee types when computing its pointer traits. This is absolutely necessary to get correct (or reproducible) results for things like how many low bits are guaranteed to be zero. I think this is the last patch for getting Clang clean here!!! llvm-svn: 256615
* [ptr-traits] Move methods manipulating PointerUnions, DenseMap pointerChandler Carruth2015-12-305-0/+157
| | | | | | | | | | | | | | | keys, and PointerIntPairs where the pointee types are incomplete out-of-line to where we have the complete type. This is the standard pattern used throughout the AST library to address the inherently mutually cross referenced nature of the AST. This is part of a series of patches to allow LLVM to check for complete pointee types when computing its pointer traits. This is absolutely necessary to get correct (or reproducible) results for things like how many low bits are guaranteed to be zero. llvm-svn: 256612
* [ptr-traits] Switch from a really wasteful SmallDenseMap ofChandler Carruth2015-12-301-5/+3
| | | | | | | | | | | | | | | | | | | | | | SmallVector<.., 16> (16!!!!) objects to a simple SmallVector of pairs. This no longer de-duplicates the common function pointers used during deallocation, but this doesn't really seem worth the complexity and overhead of managing the map-of-vectors. Notably, there is no reason to assume that functions have the 4-byte alignment that DenseMap relies on, and indeed this prevents checking the alignment of the DenseMap keys because we can't even meaningfully query the alignment of functions using our existing alignment tools. Generally, function pointers don't seem like a great idea for keys in a DenseMap. =] I chatted with Richard Smith about this a bit as well and have written down a FIXME because this *does* waste some memory and in general seems a very clumsy memory management strategy. He would like to see a more fundamental fix eventually here that tries to build a better pattern. llvm-svn: 256610
* [ptr-traits] Stop using two bogus types as stand-ins for flagsChandler Carruth2015-12-302-7/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | indicating the nature of the default argument in a ParmVarDecl. Instead, this adds a proper enum stored exclusively in the ParmVarDecl bits (which we have plenty of) for this. This even allows us to track a previously unrepresented state in Clang when we parse a function declaration with a default argument on a parameter but we cannot even form an invalid expression node (for example, it is an invalid token). Now, we can model this state in the AST at least, and potentially improve recovery in this area in the future. I've also cleaned up the functions managing both variable initializer expressions and parameter default argument expresssions as much as possible. I've left some comments about further improvements based on a discussion with Richard Smith. Lots of credit to him for walking me through exactly which of the *many* tradeoffs here he felt was the best fit. Should be NFC for now. I've tried my best to preserve existing behavior. This is part of a series of patches to allow LLVM to check for complete pointee types when computing its pointer traits. This is absolutely necessary to get correct (or reproducible) results for things like how many low bits are guaranteed to be zero. llvm-svn: 256609
* [TrailingObjects] Convert CastExpr and subclasses.James Y Knight2015-12-302-38/+33
| | | | llvm-svn: 256608
* Model NamespaceAliasDecls as having their nominated namespace as an underlyingRichard Smith2015-12-291-0/+3
| | | | | | | | | | | | | 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-294-21/+19
| | | | | | That necessitated moving the OffsetOfNode class out of OffsetOfExpr. llvm-svn: 256590
* [MS ABI] Invent a mangling for reference temporariesDavid Majnemer2015-12-291-6/+6
| | | | | | | | | MSVC is non-conforming and doesn't have a mangling for these. Invent our own to unblock folks using clang. This fixes PR25795. llvm-svn: 256589
* [TrailingObjects] Convert Decl* classes.James Y Knight2015-12-295-22/+23
| | | | | | | | Also remove now-redundant explicit alignment specification on some of the classes converted prior to TrailingObjects automatically ensuring proper alignment. llvm-svn: 256585
* [MS ABI] Add a mangling for _ComplexDavid Majnemer2015-12-291-5/+10
| | | | | | | | | | | | | MSVC doesn't implement a mangling for C99's _Complex so we must invent our own. For now, treating it like a class type called _Complex in the __clang namespace. This means that 'void f(__Complex int))' will demangle as: 'void f(struct __clang::_Complex<int>)' llvm-svn: 256583
* [MS ABI] Mark an unreachable path appropriatelyDavid Majnemer2015-12-291-8/+2
| | | | | | No functional change is intended, just a small cleanup. llvm-svn: 256582
OpenPOWER on IntegriCloud