summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* PR0091R3: Implement parsing support for using templates as types.Richard Smith2017-01-2643-128/+699
| | | | | | | | | | | | | | | This change adds a new type node, DeducedTemplateSpecializationType, to represent a type template name that has been used as a type. This is modeled around AutoType, and shares a common base class for representing a deduced placeholder type. We allow deduced class template types in a few more places than the standard does: in conditions and for-range-declarators, and in new-type-ids. This is consistent with GCC and with discussion on the core reflector. This patch does not yet support deduced class template types being named in typename specifiers. llvm-svn: 293207
* Turn on -Wblock-capture-autoreleasing by default.Akira Hatanaka2017-01-262-2/+2
| | | | | | | | | | Turning on the warning by default helps the users as it's a common mistake to capture out-parameters in a block without ensuring the object assigned doesn't get released. rdar://problem/30200058 llvm-svn: 293199
* [Sema][ObjC] Make sure -Wblock-capture-autoreleasing issues a warningAkira Hatanaka2017-01-262-4/+42
| | | | | | | | | | | | | | | even in the presence of nullability qualifiers. This commit fixes bugs in r285031 where -Wblock-capture-autoreleasing wouldn't issue warnings when the function parameters were annotated with nullability qualifiers. Specifically, look through the sugar and see if there is an AttributedType of kind attr_objc_ownership to determine whether __autoreleasing was explicitly specified or implicitly added by the compiler. rdar://problem/30193488 llvm-svn: 293194
* Use TargetMachine adjustPassManager hookStanislav Mekhanoshin2017-01-261-6/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D28340 llvm-svn: 293190
* [OpenMP] Codegen support for 'target teams' on the NVPTX device.Arpith Chacko Jacob2017-01-262-0/+223
| | | | | | | | | | This is a simple patch to teach OpenMP codegen to emit the construct in Generic mode. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29143 llvm-svn: 293183
* Further fixes to test from r293146Adam Nemet2017-01-261-3/+4
| | | | | | Require aarch64 and avoid filename in YAML since it may require quotation. llvm-svn: 293149
* Fix test from r293146Adam Nemet2017-01-261-1/+1
| | | | llvm-svn: 293147
* Support MIR opt-remarks with -fsave-optimization-recordAdam Nemet2017-01-262-33/+78
| | | | | | | | | | The handler that deals with IR passed/missed/analysis remarks is extended to also handle the corresponding MIR remarks. The more thorough testing in done via llc (rL293113, rL293121). Here we just make sure that the functionality is accessible through clang. llvm-svn: 293146
* [index] When indexing an ObjC method declaration use its base name for the ↵Argyrios Kyrtzidis2017-01-267-20/+27
| | | | | | | | | location. Instead of using the location of the beginning '-'/'+'. This is consistent with location used for function decls and ObjC method calls where we use the base name as the location as well. llvm-svn: 293134
* Remove and replace DiagStatePoint tracking and lookup data structure.Richard Smith2017-01-267-162/+330
| | | | | | | | | | | | | | | | | | | | | | | Rather than storing a single flat list of SourceLocations where the diagnostic state changes (in source order), we now store a separate list for each FileID in which there is a diagnostic state transition. (State for other files is built and cached lazily, on demand.) This has two consequences: 1) We can now sensibly support modules, and properly track the diagnostic state for modular headers (this matters when, for instance, triggering instantiation of a template defined within a module triggers diagnostics). 2) It's much faster than the old approach, since we can now just do a binary search on the offsets within the FileID rather than needing to call isBeforeInTranslationUnit to determine source order (which is surprisingly slow). For some pathological (but real world) files, this reduces total compilation time by more than 10%. For now, the diagnostic state points for modules are loaded eagerly. It seems feasible to defer this until diagnostic state information for one of the module's files is needed, but that's not part of this patch. llvm-svn: 293123
* Fix test case committed in r293106 so that it passes on targets whoseAkira Hatanaka2017-01-251-1/+4
| | | | | | pointers are 4-bytes instead of 8-bytes. llvm-svn: 293111
* Remove the return type from the check string in test case.Akira Hatanaka2017-01-251-1/+1
| | | | | | Bots were failing because some targets emit signext before i32. llvm-svn: 293108
* [CodeGen] Suppress emission of lifetime markers if a label has been seenAkira Hatanaka2017-01-253-11/+51
| | | | | | | | | | | | | | | | | | | | | | | | | in the current lexical scope. clang currently emits the lifetime.start marker of a variable when the variable comes into scope even though a variable's lifetime starts at the entry of the block with which it is associated, according to the C standard. This normally doesn't cause any problems, but in the rare case where a goto jumps backwards past the variable declaration to an earlier point in the block (see the test case added to lifetime2.c), it can cause mis-compilation. To prevent such mis-compiles, this commit conservatively disables emitting lifetime variables when a label has been seen in the current block. This problem was discussed on cfe-dev here: http://lists.llvm.org/pipermail/cfe-dev/2016-July/050066.html rdar://problem/30153946 Differential Revision: https://reviews.llvm.org/D27680 llvm-svn: 293106
* [CodeGen] [CUDA] Add the ability set default attrs on functions in linked ↵Justin Lebar2017-01-257-150/+282
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modules. Summary: Now when you ask clang to link in a bitcode module, you can tell it to set attributes on that module's functions to match what we would have set if we'd emitted those functions ourselves. This is particularly important for fast-math attributes in CUDA compilations. Each CUDA compilation links in libdevice, a bitcode library provided by nvidia as part of the CUDA distribution. Without this patch, if we have a user-function F that is compiled with -ffast-math that calls a function G from libdevice, F will have the unsafe-fp-math=true (etc.) attributes, but G will have no attributes. Since F calls G, the inliner will merge G's attributes into F's. It considers the lack of an unsafe-fp-math=true attribute on G to be tantamount to unsafe-fp-math=false, so it "merges" these by setting unsafe-fp-math=false on F. This then continues up the call graph, until every function that (transitively) calls something in libdevice gets unsafe-fp-math=false set, thus disabling fastmath in almost all CUDA code. Reviewers: echristo Subscribers: hfinkel, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D28538 llvm-svn: 293097
* [OpenMP] Support for the proc_bind-clause on 'target parallel' on the NVPTX ↵Arpith Chacko Jacob2017-01-253-0/+123
| | | | | | | | | | | | | | device. This patch adds support for the proc_bind clause on the Spmd construct 'target parallel' on the NVPTX device. Since the parallel region is created upon kernel launch, this clause can be safely ignored on the NVPTX device at codegen time for level 0 parallelism. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29128 llvm-svn: 293069
* Clarify how to forward-declare __llvm_profile symbols.Nico Weber2017-01-251-0/+2
| | | | llvm-svn: 293065
* [clang-format] Implement comment reflowing.Krasimir Georgiev2017-01-2511-294/+1377
| | | | | | | | | | | | | | | | | | Summary: This presents a version of the comment reflowing with less mutable state inside the comment breakable token subclasses. The state has been pushed into the driving breakProtrudingToken method. For this, the API of BreakableToken is enriched by the methods getSplitBefore and getLineLengthAfterSplitBefore. Reviewers: klimek Reviewed By: klimek Subscribers: djasper, klimek, mgorny, cfe-commits, ioeric Differential Revision: https://reviews.llvm.org/D28764 llvm-svn: 293055
* [test] Add HAVE_LIBZ to canonicalized booleansMichal Gorny2017-01-251-1/+2
| | | | | | Canonicalize HAVE_LIBZ as well to fix buildbot failures. llvm-svn: 293053
* [test] Port clang tests to canonicalized booleansMichal Gorny2017-01-258-31/+21
| | | | | | | | | | | Use the new llvm_canonicalize_cmake_booleans() function to canonicalize booleans for lit tests. Replace the duplicate ENABLE_CLANG* variables used to hold canonicalized values with in-place canonicalization. Use implicit logic in Python code to avoid overrelying on exact 0/1 values. Differential Revision: https://reviews.llvm.org/D28529 llvm-svn: 293052
* [Driver] Prevent no-arc-exception-silence.m test from writing output.Martin Bohme2017-01-251-1/+1
| | | | | | | | | | | | Summary: This enables the test to run on systems where output cannot be written. Reviewers: compnerd Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29123 llvm-svn: 293051
* [OpenCL] Diagnose write_only image3d when extension is disabledAnastasia Stulova2017-01-254-7/+58
| | | | | | | | | | | | | | Prior to OpenCL 2.0, image3d_t can only be used with the write_only access qualifier when the cl_khr_3d_image_writes extension is enabled, see e.g. OpenCL 1.1 s6.8b. Require the extension for write_only image3d_t types and guard uses of write_only image3d_t in the OpenCL header. Patch by Sven van Haastregt! Review: https://reviews.llvm.org/D28860 llvm-svn: 293050
* [OpenMP] Support for thread_limit-clause on the 'target teams' directive.Arpith Chacko Jacob2017-01-259-10/+453
| | | | | | | | | | | The thread_limit-clause on the combined directive applies to the 'teams' region of this construct. We modify the ThreadLimitClause class to capture the clause expression within the 'target' region. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29087 llvm-svn: 293049
* [OpenMP] Support for num_teams-clause on the 'target teams' directive.Arpith Chacko Jacob2017-01-259-9/+439
| | | | | | | | | | | The num_teams-clause on the combined directive applies to the 'teams' region of this construct. We modify the NumTeamsClause class to capture the clause expression within the 'target' region. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29085 llvm-svn: 293048
* [analyzer] Fix MacOSXAPIChecker fp with static locals seen from nested blocks.Artem Dergachev2017-01-255-3/+56
| | | | | | | | | | | | | | This is an attempt to avoid new false positives caused by the reverted r292800, however the scope of the fix is significantly reduced - some variables are still in incorrect memory spaces. Relevant test cases added. rdar://problem/30105546 rdar://problem/30156693 Differential revision: https://reviews.llvm.org/D28946 llvm-svn: 293043
* Revert "Use filename in linemarker when compiling preprocessed source"Diana Picus2017-01-253-58/+3
| | | | | | | | | | | | | | | | | | | | | This reverts commit r293004 because it broke the buildbots with "unknown CPU" errors. I tried to fix it in r293026, but that broke on Green Dragon with this kind of error: error: expected string not found in input // CHECK: l{{ +}}df{{ +}}*ABS*{{ +}}{{0+}}{{.+}}preprocessed-input.c{{$}} ^ <stdin>:2:1: note: scanning from here /Users/buildslave/jenkins/sharedspace/incremental@2/clang-build/tools/clang/test/Frontend/Output/preprocessed-input.c.tmp.o: file format Mach-O 64-bit x86-64 ^ <stdin>:2:67: note: possible intended match here /Users/buildslave/jenkins/sharedspace/incremental@2/clang-build/tools/clang/test/Frontend/Output/preprocessed-input.c.tmp.o: file format Mach-O 64-bit x86-64 I suppose this means that llvm-objdump doesn't support Mach-O, so the test should indeed check for linux (but not for x86). I'll leave it to someone that knows better. llvm-svn: 293032
* Try to fix test from r293004Diana Picus2017-01-251-1/+1
| | | | | | | | This test broke on a lot of non-x86 buildbots with "unknowm CPU" errors. I don't see anything platform-specific about this test, and it seems to work fine on ARM if we just remove the -triple i686 flags from the run line. llvm-svn: 293026
* Driver: ignore -fno-objc-arc-exception when -fno-objc-arc setSaleem Abdulrasool2017-01-252-0/+8
| | | | | | | | | | | Sometime clang would be supplied -fobjc-arc -f(no)objc-arc-exceptions and then later disable ARC with -fno-objc-arc, which only negate first option, but not the latter, resulting usused argument warning. Silence this warning only when -fno-objc-arc option is present. Patch by Onha Choe! llvm-svn: 293014
* [OpenMP] Codegen support for 'target teams' on the host.Arpith Chacko Jacob2017-01-258-41/+1423
| | | | | | | | | | | | | | | This patch adds support for codegen of 'target teams' on the host. This combined directive has two captured statements, one for the 'teams' region, and the other for the 'parallel'. This target teams region is offloaded using the __tgt_target_teams() call. The patch sets the number of teams as an argument to this call. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29084 llvm-svn: 293005
* Use filename in linemarker when compiling preprocessed sourceDavid Callahan2017-01-253-3/+58
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Clang appears to always use name as specified on the command line, whereas gcc uses the name as specified in the linemarker at the first line when compiling a preprocessed source. This results mismatch between two compilers in FILE symbol table entry. This patch makes clang to resemble gcc's behavior in finding the original source file name and use it as an input file name. Even with this patch, values of FILE symbol table entry may still be different because clang uses dirname+basename for the entry whlie gcc uses basename only. I'll write a patch for that once this patch is committed. Reviewers: dblaikie, inglorion Reviewed By: inglorion Subscribers: inglorion, aprantl, bruno Differential Revision: https://reviews.llvm.org/D28796 llvm-svn: 293004
* Reverting commit because an NVPTX patch sneaked in. Break up into twoArpith Chacko Jacob2017-01-259-1424/+41
| | | | | | patches. llvm-svn: 293003
* [OpenMP] Codegen support for 'target teams' on the host.Arpith Chacko Jacob2017-01-259-41/+1424
| | | | | | | | | | | | | | | This patch adds support for codegen of 'target teams' on the host. This combined directive has two captured statements, one for the 'teams' region, and the other for the 'parallel'. This target teams region is offloaded using the __tgt_target_teams() call. The patch sets the number of teams as an argument to this call. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29084 llvm-svn: 293001
* [OpenMP] Support for the num_threads-clause on 'target parallel' on the ↵Arpith Chacko Jacob2017-01-253-0/+145
| | | | | | | | | | | | | | NVPTX device. This patch adds support for the Spmd construct 'target parallel' on the NVPTX device. This involves ignoring the num_threads clause on the device since the number of threads in this combined construct is already set on the host through the call to __tgt_target_teams(). Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29083 llvm-svn: 292999
* [OpenMP] Support for the num_threads-clause on 'target parallel'.Arpith Chacko Jacob2017-01-2512-52/+555
| | | | | | | | | | | | | | | The num_threads-clause on the combined directive applies to the 'parallel' region of this construct. We modify the NumThreadsClause class to capture the clause expression within the 'target' region. The offload runtime call for 'target parallel' is changed to __tgt_target_teams() with 1 team and the number of threads set by this clause or a default if none. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29082 llvm-svn: 292997
* PR31742: Don't emit a bogus "zero size array" extwarn when initializing aRichard Smith2017-01-242-2/+4
| | | | | | runtime-sized array from an empty list in an array new. llvm-svn: 292991
* Strengthen test from r292632 to also check we get the mangling correct for ↵Richard Smith2017-01-241-2/+3
| | | | | | this case. llvm-svn: 292978
* IRGen: Factor out function CodeGenAction::loadModule. NFCI.Peter Collingbourne2017-01-242-28/+40
| | | | llvm-svn: 292972
* IRGen: Factor out function clang::FindThinLTOModule. NFCI.Peter Collingbourne2017-01-242-21/+26
| | | | llvm-svn: 292970
* [docs] Add TableGen-based generator for command line argument documentation,Richard Smith2017-01-2410-64/+3823
| | | | | | | and generate documentation for all (non-hidden) options supported by the 'clang' driver. llvm-svn: 292968
* Fix test/Driver/embed-bitcode.c on non-Darwin host by setting the target ↵Mehdi Amini2017-01-241-2/+2
| | | | | | explicitly llvm-svn: 292964
* Forward -bitcode_process_mode to ld64 in marker-only modeMehdi Amini2017-01-242-2/+13
| | | | | | | | | | Reviewers: steven_wu Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29066 llvm-svn: 292961
* Split isUsingLTO() outside of embedBitcodeInObject() and ↵Mehdi Amini2017-01-243-11/+8
| | | | | | | | | | | | | | embedBitcodeMarkerOnly(). Summary: These accessors maps directly to the command line option. Reviewers: steven_wu Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29065 llvm-svn: 292960
* [CodeCompletion] Ensure that ObjC root class completes instanceAlex Lorenz2017-01-242-30/+79
| | | | | | | | | | | | | | | methods from protocols and categories as well Code completion results for class methods already include instance methods from Objective-C root classes. This commit ensures that the results also include instance methods from protocols that the root class implements and root class categories as well. rdar://28012953 Differential Revision: https://reviews.llvm.org/D27257 llvm-svn: 292932
* [Sema] Fix assumption about typo corrections containing no decl.Benjamin Kramer2017-01-241-3/+6
| | | | | | | This can happen when the typo correction is coming from an external sema source. Test case will follow in clang-tools-extra. llvm-svn: 292927
* Replace use of chdir with llvm::sys::fs::set_current_pathPavel Labath2017-01-241-12/+1
| | | | | | NFCI llvm-svn: 292914
* Revert "[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`."Greg Parker2017-01-241-1/+1
| | | | | | The underlying `lit` change needs to be better-coordinated with libc++. llvm-svn: 292898
* [test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`.Greg Parker2017-01-241-1/+1
| | | | | | Requires the new `lit` boolean expressions in LLVM r292896. llvm-svn: 292897
* Revert "[analyzer] Fix memory space of static locals seen from nested blocks."Devin Coughlin2017-01-242-42/+19
| | | | | | | | | This reverts commit r292800. It is causing null pointer dereference false positives when a block that captures a static local is evaluated at the top level. llvm-svn: 292874
* Switch TableGen to emit calls to ASTRecordReader for AttrPCHRead.David L. Jones2017-01-243-28/+34
| | | | | | | | | | | | | | | Summary: This patch changes TableGen-generated code in AttrPCHRead to call functions on ASTRecordReader, instead of passing separate parameters to ASTReader. This is a follow-up to r290217. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28007 llvm-svn: 292868
* [sanitizer-coverage] emit __sanitizer_cov_trace_pc_guard w/o a preceding ↵Kostya Serebryany2017-01-241-6/+12
| | | | | | 'if' by default. Update the docs, also add deprecation notes around other parts of sanitizer coverage llvm-svn: 292862
* Re-commit "Don't inline dllimport functions referencing non-imported methods"Hans Wennborg2017-01-232-0/+20
| | | | | | | This re-commits r292522 with the addition that it also handles calls through pointer to member functions without crashing. llvm-svn: 292856
OpenPOWER on IntegriCloud