summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* [OpenMP] Detect implicit map type to report unspecified map type for target ↵Samuel Antao2016-01-194-30/+41
| | | | | | | | | | | | | | | | | | | | 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-1913-4/+174
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258177
* [CUDA] Handle -O options (more) correctly.Justin Lebar2016-01-191-4/+29
| | | | | | | | | | | | | | Summary: Previously we'd crash the driver if you passed -O0. Now we try to handle all of clang's various optimization flags in a sane way. Reviewers: tra Subscribers: cfe-commits, echristo, jhen Differential Revision: http://reviews.llvm.org/D16307 llvm-svn: 258174
* [OpenMP] Parsing + sema for "target enter data" directive.Samuel Antao2016-01-1913-8/+190
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258165
* Module Debugging: Defer the emission of anonymous tag declsAdrian Prantl2016-01-191-0/+4
| | | | | | | | | | | | | until we are visiting their declcontext. This fixes a regression introduced in r256962: When building debug info for a typdef'd anonymous tag type, we would be visiting the inner anonymous type first thus creating a "typedef changes linkage of anonymous type, but linkage was already computed" error. rdar://problem/24199640 llvm-svn: 258152
* Activate OpenMP private clause for target construct and a regression test.Carlo Bertolli2016-01-191-1/+1
| | | | llvm-svn: 258140
* Add -Wexpansion-to-undefined: warn when using `defined` in a macro definition.Nico Weber2016-01-191-2/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [cpp.cond]p4: Prior to evaluation, macro invocations in the list of preprocessing tokens that will become the controlling constant expression are replaced (except for those macro names modified by the 'defined' unary operator), just as in normal text. If the token 'defined' is generated as a result of this replacement process or use of the 'defined' unary operator does not match one of the two specified forms prior to macro replacement, the behavior is undefined. This isn't an idle threat, consider this program: #define FOO #define BAR defined(FOO) #if BAR ... #else ... #endif clang and gcc will pick the #if branch while Visual Studio will take the #else branch. Emit a warning about this undefined behavior. One problem is that this also applies to function-like macros. While the example above can be written like #if defined(FOO) && defined(BAR) #defined HAVE_FOO 1 #else #define HAVE_FOO 0 #endif there is no easy way to rewrite a function-like macro like `#define FOO(x) (defined __foo_##x && __foo_##x)`. Function-like macros like this are used in practice, and compilers seem to not have differing behavior in that case. So this a default-on warning only for object-like macros. For function-like macros, it is an extension warning that only shows up with `-pedantic`. (But it's undefined behavior in both cases.) llvm-svn: 258128
* Fix formatting of fully qualified names in array subscripts.Manuel Klimek2016-01-191-1/+2
| | | | | | | | | | Before: a[ ::b::c]; After: a[::b::c]; llvm-svn: 258123
* Fix PR26134: When substituting into default template arguments, keep ↵Faisal Vali2016-01-191-1/+0
| | | | | | | | | | | | | | | CurContext unchanged. Or, do not set Sema's CurContext to the template declaration's when substituting into default template arguments of said template declaration. If we do push the template declaration context on to Sema, and the template declaration is at namespace scope, Sema can get confused and try and do odr analysis when substituting into default template arguments, even though the substitution could be occurring within a dependent context. I'm not sure why this was being done, perhaps there was concern that if a default template argument referred to a previous template parameter, it might not be found during substitution - but all regression tests pass, and I can't craft a test that would cause it to fails (if some one does, please inform me, and i'll craft a different fix for the PR). This patch removes a single line of code, but unfortunately adds more than it removes, because of the tests. Some day I still hope to commit a patch that removes far more lines than it adds, while leaving clang better for it ;) Sorry that r253590 ("Change the expression evaluation context from Unevaluated to ConstantEvaluated while substituting into non-type template argument defaults") caused the PR! llvm-svn: 258110
* [AVX512] Fix typo in r226298Adam Nemet2016-01-191-2/+2
| | | | | | | Hal noticed that the double/float got mixed up on the parameters for these. llvm-svn: 258108
* Fix local variable name /NFCXinliang David Li2016-01-192-3/+3
| | | | llvm-svn: 258106
* fix formatting; NFCSanjay Patel2016-01-181-7/+5
| | | | llvm-svn: 258097
* Add an AST matcher for checking whether a function is defaulted.Aaron Ballman2016-01-181-0/+1
| | | | | | Patch by Jonathan Coe. llvm-svn: 258072
* [analyzer] Nullability: Look through implicit casts when suppressing ↵Devin Coughlin2016-01-181-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | warnings on return. In r256567 I changed the nullability checker to suppress warnings about returning a null value from a function/method with a non-null return type when the type of the returned expression is itself nonnull. This enables the programmer to silence nullability warnings by casting to _Nonnull: return (SomeObject * _Nonnull)nil; Unfortunately, under ObjC automated reference counting, Sema adds implicit casts to _Nonnull to return expressions of nullable or unspecified types in functions with non-null function/method return types. With r256567, these casts cause all nullability warnings for returns of reference-counted types to be suppressed under ARC, leading to false negatives. This commit updates the nullability checker to look through implicit casts before determining the type of the returned expression. It also updates the tests to turn on ARC for the nullability_nullonly.mm testfile and adds a new testfile to test when ARC is turned off. rdar://problem/24200117 llvm-svn: 258061
* Add forEachArgumentWithParam AST matcher.Manuel Klimek2016-01-181-0/+1
| | | | | | | | | | | | The new matcher allows users to provide a matcher for both the argument of a CallExpr/CxxConstructExpr a well as the ParmVarDecl of the argument. Patch by Felix Berger. Differential Revision: http://reviews.llvm.org/D13845 llvm-svn: 258042
* [analyzer] Fix an off-by-one in evalIntegralCast()Artem Dergachev2016-01-181-1/+1
| | | | | | | | | Make sure that we do not add SymbolCast at the very boundary of the range in which the cast would not certainly happen. Differential Revision: http://reviews.llvm.org/D16178 llvm-svn: 258039
* [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
* [Cygwin] Use -femulated-tls by default since r257718 introduced the new pass.NAKAMURA Takumi2016-01-161-1/+1
| | | | | | FIXME: Add more targets to use emutls into clang/test/Driver/emulated-tls.cpp. FIXME: Add cygwin tests into llvm/test/CodeGen/X86. Working in progress. llvm-svn: 257984
* Respect bound archs, even when they don't alter the toolchain.Justin Lebar2016-01-161-2/+9
| | | | | | | | | | | | | | | | | | Summary: It's possible to BindArch without changing the toolchain at all. For example, armv7 and armv7s have exactly the same toolchain triple. Therefore the code in the Driver that checks that we're not creating a job for the same Action twice needs to consider (Action, Toolchain, BoundArch) tuples. Reviewers: tra Subscribers: aemerson, echristo, beanz, cfe-commits Differential Revision: http://reviews.llvm.org/D16250 llvm-svn: 257983
* Introduce -fsanitize-stats flag.Peter Collingbourne2016-01-1614-18/+123
| | | | | | | | | This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16175 llvm-svn: 257971
* [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
* OpaquePtr: Use nullptr construction for ParsedType OpaquePtr typedefDavid Blaikie2016-01-1514-184/+143
| | | | llvm-svn: 257958
* OpaquePtr: Use nullptr construction for TemplateTy OpaquePtr typedefDavid Blaikie2016-01-151-5/+4
| | | | llvm-svn: 257957
* OpaquePtr: Use nullptr construction for DeclGroupPtrTy OpaquePtr typedefDavid Blaikie2016-01-157-73/+73
| | | | llvm-svn: 257956
* Make -Wdelete-non-virtual-dtor warn on explicit `a->~A()` dtor calls too.Nico Weber2016-01-152-24/+54
| | | | | | | | | | | | | | | | | | | | | | | -Wdelete-non-virtual-dtor warns if A is a type with virtual functions but without virtual dtor has its constructor called via `delete a`. This makes the warning also fire if the dtor is called via `a->~A()`. This would've found a security bug in Chromium at compile time. Fixes PR26137. To fix the warning, add a virtual destructor, make the class final, or remove its other virtual methods. If you want to silence the warning, there's also a fixit that shows how: test.cc:12:3: warning: destructor called on 'B' ... [-Wdelete-non-virtual-dtor] b->~B(); ^ test.cc:12:6: note: qualify call to silence this warning b->~B(); ^ B:: http://reviews.llvm.org/D16206 llvm-svn: 257939
* [analyzer] Check for return of nil in ObjC methods with nonnull return type.Devin Coughlin2016-01-151-20/+20
| | | | | | | | | | | | Update NullabilityChecker so that it checks return statements in ObjC methods. Previously it was returning early because methods do not have a function type. Also update detection of violated parameter _Nonnull preconditions to handle ObjC methods. rdar://problem/24200560 llvm-svn: 257938
* Add OpenMP dist_schedule clause to distribute directive and related ↵Carlo Bertolli2016-01-159-2/+156
| | | | | | regression tests. llvm-svn: 257917
* [analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion, v2.Artem Dergachev2016-01-151-34/+51
| | | | | | | | | | | | | | | | Provide separate visitor templates for the three hierarchies, and also the `FullSValVisitor' class, which is a union of all three visitors. Additionally, add a particular example visitor, `SValExplainer', in order to test the visitor templates. This visitor is capable of explaining the SVal, SymExpr, or MemRegion in a natural language. Compared to the reverted r257605, this fixes the test that used to fail on some triples, and fixes build failure under -fmodules. Differential Revision: http://reviews.llvm.org/D15448 llvm-svn: 257893
* 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
* PR26111: segmentation fault with __attribute__((mode(QI))) on function ↵Alexey Bataev2016-01-151-8/+3
| | | | | | | | | declaration, by Denis Zobnin Allow "mode" attribute to be applied to VarDecl, not ValueDecl (which includes FunctionDecl and EnumConstantDecl), emit an error if this attribute is used with function declarations and enum constants. Differential Revision: http://reviews.llvm.org/D16112 llvm-svn: 257868
* [X86] Support 'interrupt' attribute for x86Alexey Bataev2016-01-153-6/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This attribute may be attached to a function definition and instructs the backend to generate appropriate function entry/exit code so that it can be used directly as an interrupt handler. The IRET instruction, instead of the RET instruction, is used to return from interrupt or exception handlers. All registers, except for the EFLAGS register which is restored by the IRET instruction, are preserved by the compiler. Any interruptible-without-stack-switch code must be compiled with -mno-red-zone since interrupt handlers can and will, because of the hardware design, touch the red zone. interrupt handler must be declared with a mandatory pointer argument: struct interrupt_frame; __attribute__ ((interrupt)) void f (struct interrupt_frame *frame) { ... } and user must properly define the structure the pointer pointing to. exception handler: The exception handler is very similar to the interrupt handler with a different mandatory function signature: #ifdef __x86_64__ typedef unsigned long long int uword_t; #else typedef unsigned int uword_t; #endif struct interrupt_frame; __attribute__ ((interrupt)) void f (struct interrupt_frame *frame, uword_t error_code) { ... } and compiler pops the error code off stack before the IRET instruction. The exception handler should only be used for exceptions which push an error code and all other exceptions must use the interrupt handler. The system will crash if the wrong handler is used. Differential Revision: http://reviews.llvm.org/D15709 llvm-svn: 257867
* [CodeGen] Attach attributes to thread local wrapper function.Akira Hatanaka2016-01-151-4/+20
| | | | | | | | | | This commit is a follow-up to r251734, r251476, and r249735, which fixes a bug where function attributes were not attached to thread local wrapper functions. rdar://problem/20828324 llvm-svn: 257865
* When copying whitespace flags from the token naming a macro argument onto theRichard Smith2016-01-151-0/+1
| | | | | | | | first token of the expansion, don't forget to copy the "is at the start of a line" token (which is always false, as newlines cannot appear within a macro body); otherwise, stringizing the result can insert spurious whitespace. llvm-svn: 257863
* 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
* [CUDA] Invoke ptxas and fatbinary during compilation.Justin Lebar2016-01-148-26/+184
| | | | | | | | | | | | | | | | | | | | Summary: Previously we compiled CUDA device code to PTX assembly and embedded that asm as text in our host binary. Now we compile to PTX assembly and then invoke ptxas to assemble the PTX into a cubin file. We gather the ptx and cubin files for each of our --cuda-gpu-archs and combine them using fatbinary, and then embed that into the host binary. Adds two new command-line flags, -Xcuda_ptxas and -Xcuda_fatbinary, which pass args down to the external tools. Reviewers: tra, echristo Subscribers: cfe-commits, jhen Differential Revision: http://reviews.llvm.org/D16082 llvm-svn: 257809
* Don't build jobs for the same Action + ToolChain twice.Justin Lebar2016-01-141-14/+36
| | | | | | | | | | | | | | | Summary: Right now if the Action graph is a DAG and we encounter an action twice, we will run it twice. This patch is difficult to test as-is, but I have testcases for this as used within CUDA compilation. Reviewers: Subscribers: llvm-svn: 257808
* Update for LLVM function name change.Rui Ueyama2016-01-1419-215/+205
| | | | llvm-svn: 257802
* [WebAssembly] Configure some simple include paths and runtime library settings.Dan Gohman2016-01-142-0/+31
| | | | llvm-svn: 257774
* clang-format: Fix incorrectly enforced linebreak with ColumnLimit 0.Daniel Jasper2016-01-141-1/+1
| | | | | | | | | | | Before: aaaa[bbbb] .cccc(); After: aaaa[bbbb].cccc(); llvm-svn: 257763
* [mips] Added support for -Wa,-mips32 and similar.Scott Egerton2016-01-141-1/+25
| | | | | | | | | | Reviewers: vkalintiris, dsanders Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15070 llvm-svn: 257762
* Correct setting of UserLabelPrefix for MCU target.Andrey Bokhanko2016-01-141-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D16138 llvm-svn: 257756
* PR25910: clang allows two var definitions with the same mangled nameAndrey Bokhanko2016-01-142-32/+95
| | | | | | | | | | | Proper diagnostic and resolution of mangled names' conflicts in variables. When there is a declaration and a definition using the same name but different types, we emit what is in the definition. When there are two conflicting definitions, we issue an error. Differential Revision: http://reviews.llvm.org/D15686 llvm-svn: 257754
* clang-format: [JS] Fix incorrect line break leading to semicolon insertion.Daniel Jasper2016-01-141-0/+2
| | | | | | | | | | | | | | | | clang-format only works for JavaScript code, if all the semicolons are present anyway, so this linebreak can never be desired. Before (with appropriate statement lengths or column limit): return [ aaa ]; After: return [ aaaa ]; llvm-svn: 257741
* Driver: Remove SanitizerArgs::clear() function and SanitizerSet ctor,Peter Collingbourne2016-01-141-17/+0
| | | | | | replace with in-class initializers. llvm-svn: 257739
OpenPOWER on IntegriCloud