]> granicus.if.org Git - clang/log
clang
7 years agoPR28739: Check that integer values fit into 64 bits before extracting them as 64...
Richard Smith [Mon, 30 Jan 2017 23:30:26 +0000 (23:30 +0000)]
PR28739: Check that integer values fit into 64 bits before extracting them as 64 bit values for pointer arithmetic.

This fixes various ways to tickle an assertion in constant expression
evaluation when using __int128. Longer term, we need to figure out what should
happen here: either any kind of overflow in offset calculation should result in
a non-constant value or we should truncate to 64 bits. In C++11 onwards, we're
effectively already checking for overflow because we strictly enforce array
bounds checks, but even there some forms of overflow can slip past undetected.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293568 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSerialization: use range based for loop (NFC)
Saleem Abdulrasool [Mon, 30 Jan 2017 22:25:28 +0000 (22:25 +0000)]
Serialization: use range based for loop (NFC)

Just a small clean up noticed when doing post-commit review of Duncan's
previous change for ModuleFile memory ownership semantics.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293556 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] Fix regression that breaks comments without a comment prefix
Krasimir Georgiev [Mon, 30 Jan 2017 21:00:01 +0000 (21:00 +0000)]
[clang-format] Fix regression that breaks comments without a comment prefix

Summary:
Consider formatting the following code fragment with column limit 20:
```
{
  // line 1
  // line 2\
  // long long long line
}
```
Before this fix the output is:
```
{
  // line 1
  // line 2\
  // long long
  long line
}
```
This patch fixes a regression that breaks the last comment line without
adding the '//' prefix.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29298

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293548 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTowards P0091R3: parsing support for class template argument deduction in typename...
Richard Smith [Mon, 30 Jan 2017 20:39:26 +0000 (20:39 +0000)]
Towards P0091R3: parsing support for class template argument deduction in typename-specifiers.

This reinstates r293455, reverted in r293455, with a fix for cv-qualifier
handling on dependent typename-specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293544 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] Separate line comment sections after a right brace from comment sectio...
Krasimir Georgiev [Mon, 30 Jan 2017 19:18:55 +0000 (19:18 +0000)]
[clang-format] Separate line comment sections after a right brace from comment sections in the scope.

Summary:
The following two comment lines form a single comment section:
```
if (1) { // line 1
   // line 2
}
```
This is because the break of a comment section was based on the original column
of the first token of the previous line (in this case, the 'if').
This patch splits these two comment lines into different sections by taking into
account the original column of the right brace preceding the first line comment
where applicable.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D29291

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293539 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AST] Give TemplateArgumentLoc a constexpr ctor.
Benjamin Kramer [Mon, 30 Jan 2017 18:32:46 +0000 (18:32 +0000)]
[AST] Give TemplateArgumentLoc a constexpr ctor.

This removes the thread-safe static from
clang::TemplateTemplateParmDecl::getDefaultArgument() const::None

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293523 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ASTMatchers] Sprinkle some constexpr on the global matcher constructors.
Benjamin Kramer [Mon, 30 Jan 2017 18:20:00 +0000 (18:20 +0000)]
[ASTMatchers] Sprinkle some constexpr on the global matcher constructors.

This dramatically reduces the size of the global constructors we emit
for those variables in debug mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293518 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdjust tests after folding inlining analysis into missed remarks
Adam Nemet [Mon, 30 Jan 2017 16:22:50 +0000 (16:22 +0000)]
Adjust tests after folding inlining analysis into missed remarks

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293493 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AST] Make header standalone.
Benjamin Kramer [Mon, 30 Jan 2017 16:00:57 +0000 (16:00 +0000)]
[AST] Make header standalone.

Most implementations get ptrdiff_t transitively, some don't. Explicitly
include cstddef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293488 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IRGen] Make header standalone.
Benjamin Kramer [Mon, 30 Jan 2017 15:39:18 +0000 (15:39 +0000)]
[IRGen] Make header standalone.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293485 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "r293343 - [ubsan] Sanity-check shift amounts before truncation
Alex Lorenz [Mon, 30 Jan 2017 11:37:18 +0000 (11:37 +0000)]
Revert "r293343 - [ubsan] Sanity-check shift amounts before truncation
(fixes PR27271)"

After r293343 clang fails to compile itself with -fsanitize=undefined (
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_build/).

rdar://30259929

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293475 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r293455, which breaks v8 with a spurious error. Testcase added.
Sam McCall [Mon, 30 Jan 2017 10:44:11 +0000 (10:44 +0000)]
Revert r293455, which breaks v8 with a spurious error. Testcase added.

Summary: Revert r293455, which breaks v8 with a spurious error. Testcase added.

Reviewers: klimek

Subscribers: cfe-commits, rsmith

Differential Revision: https://reviews.llvm.org/D29271

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293473 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[c-index-test] CMake: add missing reference to clangSerialization library.
Argyrios Kyrtzidis [Mon, 30 Jan 2017 07:11:27 +0000 (07:11 +0000)]
[c-index-test] CMake: add missing reference to clangSerialization library.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293466 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: [JavaScript] Undo r291974 for JavaScript.
Daniel Jasper [Mon, 30 Jan 2017 07:08:40 +0000 (07:08 +0000)]
clang-format: [JavaScript] Undo r291974 for JavaScript.

This had significant negative consequences and I don't have a good
solution for it yet.

Before:
  var string =
      [
        'aaaaaa',
        'bbbbbb',
      ]
          .join('+');

After:
  var string = [
    'aaaaaa',
    'bbbbbb',
  ].join('+');

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293465 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[index] CMake: add missing reference to clangSerialization library.
Argyrios Kyrtzidis [Mon, 30 Jan 2017 06:48:27 +0000 (06:48 +0000)]
[index] CMake: add missing reference to clangSerialization library.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293463 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReapply "DebugInfo: Omit class definitions even in the presence of available_external...
David Blaikie [Mon, 30 Jan 2017 06:36:08 +0000 (06:36 +0000)]
Reapply "DebugInfo: Omit class definitions even in the presence of available_externally vtables"

Accounts for a case that caused an assertion failure by attempting to
query for the vtable linkage of a non-dynamic type.t

This reverts commit r292801.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293462 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[c-index-test] Provide capability to index module file imports and dump their input...
Argyrios Kyrtzidis [Mon, 30 Jan 2017 06:05:58 +0000 (06:05 +0000)]
[c-index-test] Provide capability to index module file imports and dump their input files.

This ensures the capability to index a module file using an existing ASTReader from a compiler instance or ASTUnit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293461 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTidy up codegen modules test & make it x86 specific since it relies on Itanium name...
David Blaikie [Mon, 30 Jan 2017 05:33:51 +0000 (05:33 +0000)]
Tidy up codegen modules test & make it x86 specific since it relies on Itanium name manglings

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293457 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPrototype of modules codegen
David Blaikie [Mon, 30 Jan 2017 05:00:26 +0000 (05:00 +0000)]
Prototype of modules codegen

First pass at generating weak definitions of inline functions from module files
(& skipping (-O0) or emitting available_externally (optimizations)
definitions where those modules are used).

External functions defined in modules are emitted into the modular
object file as well (this may turn an existing ODR violation (if that
module were imported into multiple translations) into valid/linkable
code).

Internal symbols (static functions, for example) are not correctly
supported yet. The symbol will be produced, internal, in the modular
object - unreferenceable from the users.

Reviewers: rsmith

Differential Revision: https://reviews.llvm.org/D28845

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293456 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTowards P0091R3: parsing support for class template argument deduction in typename...
Richard Smith [Mon, 30 Jan 2017 04:38:28 +0000 (04:38 +0000)]
Towards P0091R3: parsing support for class template argument deduction in typename-specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293455 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP][NVPTX][CUDA] Adding support for printf for an NVPTX OpenMP device.
Arpith Chacko Jacob [Sun, 29 Jan 2017 20:49:31 +0000 (20:49 +0000)]
[OpenMP][NVPTX][CUDA] Adding support for printf for an NVPTX OpenMP device.

Support for CUDA printf is exploited to support printf for
an NVPTX OpenMP device.

To reflect the support of both programming models, the file
CGCUDABuiltin.cpp has been renamed to CGGPUBuiltin.cpp, and
the call EmitCUDADevicePrintfCallExpr has been renamed to
EmitGPUDevicePrintfCallExpr.

Reviewers: jlebar
Differential Revision: https://reviews.llvm.org/D17890

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293444 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[windows] [asan] Add linker flag when including "asan_dynamic_runtime_thunk".
Marcos Pividori [Sun, 29 Jan 2017 06:03:05 +0000 (06:03 +0000)]
[windows] [asan] Add linker flag when including "asan_dynamic_runtime_thunk".

I modify clang driver for windows to include:
"-wholearchive:asan_dynamic_runtime_thunk", so all object files in the
static library: asan_dynamic_runtime_thunk are considered by the linker.
This is necessary, because some object files only include linker pragmas,
and doesn't resolve any symbol. If we don't include that flag, the
linker will ignore them, and won't read the linker pragmas.

Differential Revision: https://reviews.llvm.org/D29159

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293420 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[scan-build-py] remove not used flag
Laszlo Nagy [Sun, 29 Jan 2017 04:59:32 +0000 (04:59 +0000)]
[scan-build-py] remove not used flag

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293418 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[c-index-test] Provide capability for 'c-index-test core' to dump symbol information...
Argyrios Kyrtzidis [Sun, 29 Jan 2017 04:50:35 +0000 (04:50 +0000)]
[c-index-test] Provide capability for 'c-index-test core' to dump symbol information from a PCH/module file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293416 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Fix a minor performance bug from r293393
Duncan P. N. Exon Smith [Sun, 29 Jan 2017 04:42:21 +0000 (04:42 +0000)]
Modules: Fix a minor performance bug from r293393

Oops... r293393 started calling ReadSignature in
ModuleManager::addModule even when there was no ExpectedSignature.

Whether or not this would have a measurable performance impact (I
spotted this by inspection, and ReadSignature should be fairly fast), we
might as well get what we can.  Add an extra check against
ExpectedSignature to avoid the hit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293415 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Simplify the ModuleFile constructor; likely NFC
Duncan P. N. Exon Smith [Sun, 29 Jan 2017 00:39:09 +0000 (00:39 +0000)]
Modules: Simplify the ModuleFile constructor; likely NFC

Zero-initialize ModuleFile members directly in the class definition, and
move the (now uninteresting) constructor into the class definition.

There were a few members that weren't being initialized at all.  I
zero-initialized them for consistency, but it's likely that they were
somehow initialized before their first use; i.e., there's likely no
functionality change here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293404 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Return early in ModuleManager::addModule; NFC
Duncan P. N. Exon Smith [Sat, 28 Jan 2017 23:22:40 +0000 (23:22 +0000)]
Modules: Return early in ModuleManager::addModule; NFC

Invert the main branch in ModuleManager::addModule to return early and
reduce indentation, and clean up a bunch of logic as a result.  I split
out a function called updateModuleImports to avoid triggering code
duplication.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293400 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Clean up ModuleFile::Imports in ModuleManager::removeModules
Duncan P. N. Exon Smith [Sat, 28 Jan 2017 23:12:13 +0000 (23:12 +0000)]
Modules: Clean up ModuleFile::Imports in ModuleManager::removeModules

I don't have a testcase for this (and I'm not sure if it's an observable
bug), but it seems obviously wrong that ModuleManager::removeModules is
failing to clean up deleted modules from ModuleFile::Imports.  See the
code in ModuleManager::addModule that inserts into ModuleFile::Imports;
we need the inverse operation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293399 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Enforce that ModuleManager::removeModules deletes the tail
Duncan P. N. Exon Smith [Sat, 28 Jan 2017 23:02:12 +0000 (23:02 +0000)]
Modules: Enforce that ModuleManager::removeModules deletes the tail

ModuleManager::removeModules always deletes a tail of the
ModuleManager::Chain.  Change the API to enforce that so that we can
simplify the code inside.

There's no real functionality change, although there's a slight
performance hack to loop to the First deleted module instead of the
final module in the chain (skipping the about-to-be-deleted tail).

Also document something suspicious: we fail to clean deleted modules out
of ModuleFile::Imports.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293398 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[scan-build-py] remove batch files
Laszlo Nagy [Sat, 28 Jan 2017 22:55:25 +0000 (22:55 +0000)]
[scan-build-py] remove batch files

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293397 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[scan-build-py] use subprocess wrapper
Laszlo Nagy [Sat, 28 Jan 2017 22:48:26 +0000 (22:48 +0000)]
[scan-build-py] use subprocess wrapper

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293396 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Clarify ownership of ModuleFile instances in ModuleManager, NFC
Duncan P. N. Exon Smith [Sat, 28 Jan 2017 22:24:01 +0000 (22:24 +0000)]
Modules: Clarify ownership of ModuleFile instances in ModuleManager, NFC

Use std::unique_ptr to clarify the ownership of the ModuleFile instances in
ModuleManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293395 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Return ModuleFile& from ModuleManager::begin, etc.; NFC
Duncan P. N. Exon Smith [Sat, 28 Jan 2017 22:15:22 +0000 (22:15 +0000)]
Modules: Return ModuleFile& from ModuleManager::begin, etc.; NFC

Hide the pointer indirection in ModuleManager::begin, ModuleManager::end,
ModuleManager::rbegin, and ModuleManager::rend.  Besides tidying up the call
sites, this is preparation for making ownership of ModuleFile explicit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293394 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoModules: Separate out a checkSignature helper, almost NFC
Duncan P. N. Exon Smith [Sat, 28 Jan 2017 21:34:28 +0000 (21:34 +0000)]
Modules: Separate out a checkSignature helper, almost NFC

The main point is to move the delete-the-new-module logic into the same block
that creates it, so I can simplify the memory management in a follow-up, but I
think it's clearer to use use a checkSignature helper here anyway.

There is a minor functionality change: we now scan ahead to pull the signature
out of the control block *only* if this is a new ModuleFile.  For old ones,
ASTReader::ReadControlBlock will have already read the signature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293393 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unused 'using' declaration. Found by clang-tidy: misc-unused-using-decls NFC
Sylvestre Ledru [Sat, 28 Jan 2017 13:41:50 +0000 (13:41 +0000)]
Remove unused 'using' declaration. Found by clang-tidy: misc-unused-using-decls NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293381 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPass a char instead of a string to the find function. clang-tidy: performance-faster...
Sylvestre Ledru [Sat, 28 Jan 2017 13:36:34 +0000 (13:36 +0000)]
Pass a char instead of a string to the find function. clang-tidy: performance-faster-string-find

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293379 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix typo introduced in r292960 that may affect -flto -save-temps (saving the optimize...
Mehdi Amini [Sat, 28 Jan 2017 06:07:17 +0000 (06:07 +0000)]
Fix typo introduced in r292960 that may affect -flto -save-temps (saving the optimized bitcode)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293370 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAttempt to unbreak buildbots.
George Burgess IV [Sat, 28 Jan 2017 04:16:32 +0000 (04:16 +0000)]
Attempt to unbreak buildbots.

r293360 broke some ARM bots, because size_t on those targets is
apparently `unsigned int`, not `unsigned long`. `sizeof(whatever)`
should to give us a `size_t`, so we can just use the type of that
instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293369 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSwitch the template specialization kind for a non-defining declaration of a
Richard Smith [Sat, 28 Jan 2017 02:56:07 +0000 (02:56 +0000)]
Switch the template specialization kind for a non-defining declaration of a
non-template function instantiated from a friend declaration in a class
template from TSK_ImplicitInstantiation to TSK_Undeclared.

It doesn't make sense for a non-template function to be flagged as being
instantiated from a template; that property really belongs to the entity
as a whole and not an individual declaration of it. There's some history
here:

 * r137934 started marking these functions as instantiations in order to
   work around an issue where we might instantiate a class template while
   we're still parsing its member definitions, and would otherwise fail
   to instantiate the friend definition

 * r177003 fixed the same issue but for friend templates, but did so by
   making the friends claim to be definitions even before we'd parsed
   their actual bodies; this made the r137934 change redundant

 * r293558 worked around a problem caused by the marking of a non-template
   function as a template instantiation in r137934

This change reverts the code changes from r293358 and r137934 and retains
all the tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293367 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAvoid calling dump() in normal code
Matthias Braun [Sat, 28 Jan 2017 02:36:00 +0000 (02:36 +0000)]
Avoid calling dump() in normal code

dump() is only available in debug builds and meant for debugger usage,
normal code should use something like print(errs());

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293364 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChange how we handle diagnose_if attributes.
George Burgess IV [Sat, 28 Jan 2017 02:19:40 +0000 (02:19 +0000)]
Change how we handle diagnose_if attributes.

This patch changes how we handle argument-dependent `diagnose_if`
attributes. In particular, we now check them in the same place that we
check for things like passing NULL to Nonnull args, etc. This is
basically better in every way than how we were handling them before. :)

This fixes PR31638, PR31639, and PR31640.

Differential Revision: https://reviews.llvm.org/D28889

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293360 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago-Wunused-func-template: do not warn on non-template function declarations that
Richard Smith [Sat, 28 Jan 2017 01:50:33 +0000 (01:50 +0000)]
-Wunused-func-template: do not warn on non-template function declarations that
were nonetheless instantiated (particularly, non-template friends declared
within class templates).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293358 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSupport '#pragma clang __debug dump' within C++ classes.
Richard Smith [Sat, 28 Jan 2017 01:20:57 +0000 (01:20 +0000)]
Support '#pragma clang __debug dump' within C++ classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293355 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoConvert sequence of 'if's on the same value to a switch. No functionality change...
Richard Smith [Sat, 28 Jan 2017 01:12:10 +0000 (01:12 +0000)]
Convert sequence of 'if's on the same value to a switch. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293354 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWhen converting a template argument representing &array to an expression for a
Richard Smith [Sat, 28 Jan 2017 00:38:35 +0000 (00:38 +0000)]
When converting a template argument representing &array to an expression for a
pointer typed template parameter, form &array rather than an array-to-pointer
decay on array.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293350 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix linkage of static locals in available_externally functions to be DiscardableODR...
David Blaikie [Fri, 27 Jan 2017 23:11:10 +0000 (23:11 +0000)]
Fix linkage of static locals in available_externally functions to be DiscardableODR/linkonce_odr

As Mehdi put it, entities should either be
available_externally+weak_odr, or linkonce_odr+linkonce_odr. While some
functions are emitted a_e/weak, their local variables were emitted
a_e/linkonce_odr.

While it might be nice to emit them a_e/weak, the Itanium ABI (& best
guess at MSVC's behavior as well) requires the local to be
linkonce/linkonce.

Reviewers: rsmith, mehdi_amini

Differential Revision: https://reviews.llvm.org/D29233

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293344 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ubsan] Sanity-check shift amounts before truncation (fixes PR27271)
Vedant Kumar [Fri, 27 Jan 2017 23:02:44 +0000 (23:02 +0000)]
[ubsan] Sanity-check shift amounts before truncation (fixes PR27271)

Ubsan does not report UB shifts in some cases where the shift exponent
needs to be truncated to match the type of the shift base. We perform a
range check on the truncated shift amount, leading to false negatives.

Fix the issue (PR27271) by performing the range check on the original
shift amount.

Differential Revision: https://reviews.llvm.org/D29234

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293343 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPR31783: Don't request the alignment of an invalid declaration.
Richard Smith [Fri, 27 Jan 2017 21:28:37 +0000 (21:28 +0000)]
PR31783: Don't request the alignment of an invalid declaration.

Fixes an assertion failure on PS4 targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293333 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoARM-Darwin: re-enable -momit-leaf-frame-pointer.
Tim Northover [Fri, 27 Jan 2017 17:53:42 +0000 (17:53 +0000)]
ARM-Darwin: re-enable -momit-leaf-frame-pointer.

In r279546 I disabled all frame pointer elimination at the front-end on
ARM-Darwin (and warned about it) because before that the backend had been
silently ignoring these options. It turns out we didn't ignore
-momit-leaf-frame-pointer though, just the more general -fomit-frame-pointer.

So this re-enables passing that down to CodeGen so that everything really does
continue working as before (with better diagnostics).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293311 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-cl: Warn about /U flags that look like filenames (PR31662)
Hans Wennborg [Fri, 27 Jan 2017 17:09:41 +0000 (17:09 +0000)]
clang-cl: Warn about /U flags that look like filenames (PR31662)

Both on Mac and Windows, it's common to have a 'Users' directory in the
root of the filesystem, so one might specify a filename as
'/Users/me/myfile.c'. clang-cl (as well as MSVC's cl.exe) will interpret
that as invoking the '/U' option, which is probably not what the user
wanted. Add a warning about this.

Differential Revision: https://reviews.llvm.org/D29198

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293305 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL] Add missing address spaces in IR generation of blocks
Anastasia Stulova [Fri, 27 Jan 2017 15:11:34 +0000 (15:11 +0000)]
[OpenCL] Add missing address spaces in IR generation of blocks

Modify ObjC blocks impl wrt address spaces as follows:

- keep default private address space for blocks generated
as local variables (with captures);

- add global address space for global block literals (no captures);

- make the block invoke function and enqueue_kernel prototype with
the generic AS block pointer parameter to accommodate both
private and global AS cases from above;

- add block handling into default AS because it's implemented as
a special pointer type (BlockPointer) in the frontend and therefore
it is used as a pointer everywhere. This is also needed to accommodate
both private and global AS blocks for the two cases above.

- removes ObjC RT specific symbols (NSConcreteStackBlock and
NSConcreteGlobalBlock) in the OpenCL mode.

Review: https://reviews.llvm.org/D28814

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293286 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips] Add support for static model on N64
Simon Dardis [Fri, 27 Jan 2017 15:05:25 +0000 (15:05 +0000)]
[mips] Add support for static model on N64

The patch teaches the Clang driver how to handle the N64 static
relocation model properly. It enforces the correct target feature
(+noabicalls) when -fno-pic is used. This is required as non-pic
N64 code as the abi extension to call PIC code (CPIC) is unsupported.

Make PIC the default for mips64 and mips64el, this affects both N32
& N64 ABIs, to better match GCC.

As part of this effort, clean up the assembler invocation command
builder, so the correct flags are used.

This and r293279 in LLVM resolves PR/23485.

Thanks to Brooks Davis for reporting the issue!

Reviewers: slthakur, seanbruno

Differential Revision: https://reviews.llvm.org/D29031

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293285 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Consider function call arguments while building CallGraph.
Artem Dergachev [Fri, 27 Jan 2017 12:14:56 +0000 (12:14 +0000)]
[analyzer] Consider function call arguments while building CallGraph.

Function call can appear in the arguments of another function call, eg.:

  foo(bar());

This patch adds support for such cases.

Patch by Ivan Sidorenko!

Differential revision: https://reviews.llvm.org/D28905

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293280 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: [JS] do not format MPEG transport streams.
Martin Probst [Fri, 27 Jan 2017 09:09:11 +0000 (09:09 +0000)]
clang-format: [JS] do not format MPEG transport streams.

Summary:
The MPEG transport stream file format also uses ".ts" as its file extension.
This change detects its specific framing format (0x47 every 189 bytes) and
simply ignores MPEG TS files.

Reviewers: djasper, sammccall

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D29186

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293270 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[docs] Add help text and refine grouping for various options.
Richard Smith [Fri, 27 Jan 2017 02:08:37 +0000 (02:08 +0000)]
[docs] Add help text and refine grouping for various options.

Also accept -G= (and -msmall-data-threshold=) as an alias for -G on MIPS as well as Hexagon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293254 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoImprove workaround for Sphinx's lack of support for command line options containing...
Richard Smith [Fri, 27 Jan 2017 01:54:42 +0000 (01:54 +0000)]
Improve workaround for Sphinx's lack of support for command line options containing '+', '.' etc. to be more stable as the set of options changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293252 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-apply r292662, "IRGen: Start using the WriteThinLTOBitcode pass."
Peter Collingbourne [Thu, 26 Jan 2017 23:51:50 +0000 (23:51 +0000)]
Re-apply r292662, "IRGen: Start using the WriteThinLTOBitcode pass."

The internal build issue has been resolved.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293231 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[modules] Additional tests.
Richard Smith [Thu, 26 Jan 2017 23:07:59 +0000 (23:07 +0000)]
[modules] Additional tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293223 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd files forgotten in r293219.
Richard Smith [Thu, 26 Jan 2017 23:06:10 +0000 (23:06 +0000)]
Add files forgotten in r293219.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293222 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[modules] When reading / writing a typedef that is a name for linkage for
Richard Smith [Thu, 26 Jan 2017 22:39:55 +0000 (22:39 +0000)]
[modules] When reading / writing a typedef that is a name for linkage for
another declaration, ensure we actually serialize / deserialize that
declaration.

Before this patch, if another copy of the typedef were merged with the parsed
version, we would emit type information referring to the merged version and
consequently emit nothing about the parsed anonymous struct. This resulted in
us losing information, particularly the visible merged module set for the
parsed definition. Force that information to be emitted and to be loaded when
the typedef is used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293219 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd missing x86 requirement.
Peter Collingbourne [Thu, 26 Jan 2017 21:38:48 +0000 (21:38 +0000)]
Add missing x86 requirement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293210 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIRGen: When loading the main module in the distributed ThinLTO backend, look for...
Peter Collingbourne [Thu, 26 Jan 2017 21:09:48 +0000 (21:09 +0000)]
IRGen: When loading the main module in the distributed ThinLTO backend, look for the module containing the summary.

Differential Revision: https://reviews.llvm.org/D29067

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293209 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPR0091R3: Implement parsing support for using templates as types.
Richard Smith [Thu, 26 Jan 2017 20:40:47 +0000 (20:40 +0000)]
PR0091R3: Implement parsing support for using templates as types.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293207 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTurn on -Wblock-capture-autoreleasing by default.
Akira Hatanaka [Thu, 26 Jan 2017 18:51:10 +0000 (18:51 +0000)]
Turn on -Wblock-capture-autoreleasing by default.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293199 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema][ObjC] Make sure -Wblock-capture-autoreleasing issues a warning
Akira Hatanaka [Thu, 26 Jan 2017 18:13:06 +0000 (18:13 +0000)]
[Sema][ObjC] Make sure -Wblock-capture-autoreleasing issues a warning
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293194 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse TargetMachine adjustPassManager hook
Stanislav Mekhanoshin [Thu, 26 Jan 2017 16:49:21 +0000 (16:49 +0000)]
Use TargetMachine adjustPassManager hook

Differential Revision: https://reviews.llvm.org/D28340

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293190 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Codegen support for 'target teams' on the NVPTX device.
Arpith Chacko Jacob [Thu, 26 Jan 2017 15:43:27 +0000 (15:43 +0000)]
[OpenMP] Codegen support for 'target teams' on the NVPTX device.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293183 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFurther fixes to test from r293146
Adam Nemet [Thu, 26 Jan 2017 04:34:07 +0000 (04:34 +0000)]
Further fixes to test from r293146

Require aarch64 and avoid filename in YAML since it may require quotation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293149 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix test from r293146
Adam Nemet [Thu, 26 Jan 2017 04:14:04 +0000 (04:14 +0000)]
Fix test from r293146

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293147 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSupport MIR opt-remarks with -fsave-optimization-record
Adam Nemet [Thu, 26 Jan 2017 04:07:11 +0000 (04:07 +0000)]
Support MIR opt-remarks with -fsave-optimization-record

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293146 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[index] When indexing an ObjC method declaration use its base name for the location.
Argyrios Kyrtzidis [Thu, 26 Jan 2017 02:11:50 +0000 (02:11 +0000)]
[index] When indexing an ObjC method declaration use its base name for the 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293134 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove and replace DiagStatePoint tracking and lookup data structure.
Richard Smith [Thu, 26 Jan 2017 01:01:01 +0000 (01:01 +0000)]
Remove and replace DiagStatePoint tracking and lookup data structure.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293123 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix test case committed in r293106 so that it passes on targets whose
Akira Hatanaka [Wed, 25 Jan 2017 23:36:15 +0000 (23:36 +0000)]
Fix test case committed in r293106 so that it passes on targets whose
pointers are 4-bytes instead of 8-bytes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293111 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove the return type from the check string in test case.
Akira Hatanaka [Wed, 25 Jan 2017 23:16:32 +0000 (23:16 +0000)]
Remove the return type from the check string in test case.

Bots were failing because some targets emit signext before i32.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293108 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeGen] Suppress emission of lifetime markers if a label has been seen
Akira Hatanaka [Wed, 25 Jan 2017 22:55:13 +0000 (22:55 +0000)]
[CodeGen] Suppress emission of lifetime markers if a label has been seen
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293106 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeGen] [CUDA] Add the ability set default attrs on functions in linked modules.
Justin Lebar [Wed, 25 Jan 2017 21:29:48 +0000 (21:29 +0000)]
[CodeGen] [CUDA] Add the ability set default attrs on functions in linked 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293097 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Support for the proc_bind-clause on 'target parallel' on the NVPTX device.
Arpith Chacko Jacob [Wed, 25 Jan 2017 16:55:10 +0000 (16:55 +0000)]
[OpenMP] Support for the proc_bind-clause on 'target parallel' on the NVPTX 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293069 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoClarify how to forward-declare __llvm_profile symbols.
Nico Weber [Wed, 25 Jan 2017 16:01:32 +0000 (16:01 +0000)]
Clarify how to forward-declare __llvm_profile symbols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293065 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] Implement comment reflowing.
Krasimir Georgiev [Wed, 25 Jan 2017 13:58:58 +0000 (13:58 +0000)]
[clang-format] Implement comment reflowing.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293055 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[test] Add HAVE_LIBZ to canonicalized booleans
Michal Gorny [Wed, 25 Jan 2017 13:31:53 +0000 (13:31 +0000)]
[test] Add HAVE_LIBZ to canonicalized booleans

Canonicalize HAVE_LIBZ as well to fix buildbot failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293053 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[test] Port clang tests to canonicalized booleans
Michal Gorny [Wed, 25 Jan 2017 13:11:45 +0000 (13:11 +0000)]
[test] Port clang tests to canonicalized booleans

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293052 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Prevent no-arc-exception-silence.m test from writing output.
Martin Bohme [Wed, 25 Jan 2017 12:55:53 +0000 (12:55 +0000)]
[Driver] Prevent no-arc-exception-silence.m test from writing output.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293051 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL] Diagnose write_only image3d when extension is disabled
Anastasia Stulova [Wed, 25 Jan 2017 12:18:50 +0000 (12:18 +0000)]
[OpenCL] Diagnose write_only image3d when extension is disabled

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293050 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Support for thread_limit-clause on the 'target teams' directive.
Arpith Chacko Jacob [Wed, 25 Jan 2017 11:44:35 +0000 (11:44 +0000)]
[OpenMP] Support for thread_limit-clause on the 'target teams' directive.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293049 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Support for num_teams-clause on the 'target teams' directive.
Arpith Chacko Jacob [Wed, 25 Jan 2017 11:28:18 +0000 (11:28 +0000)]
[OpenMP] Support for num_teams-clause on the 'target teams' directive.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293048 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Fix MacOSXAPIChecker fp with static locals seen from nested blocks.
Artem Dergachev [Wed, 25 Jan 2017 10:21:45 +0000 (10:21 +0000)]
[analyzer] Fix MacOSXAPIChecker fp with static locals seen from nested blocks.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293043 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Use filename in linemarker when compiling preprocessed source"
Diana Picus [Wed, 25 Jan 2017 07:27:05 +0000 (07:27 +0000)]
Revert "Use filename in linemarker when compiling preprocessed source"

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293032 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTry to fix test from r293004
Diana Picus [Wed, 25 Jan 2017 06:23:50 +0000 (06:23 +0000)]
Try to fix test from r293004

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293026 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDriver: ignore -fno-objc-arc-exception when -fno-objc-arc set
Saleem Abdulrasool [Wed, 25 Jan 2017 03:36:28 +0000 (03:36 +0000)]
Driver: ignore -fno-objc-arc-exception when -fno-objc-arc set

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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293014 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Codegen support for 'target teams' on the host.
Arpith Chacko Jacob [Wed, 25 Jan 2017 02:18:43 +0000 (02:18 +0000)]
[OpenMP] Codegen support for 'target teams' on the host.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293005 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse filename in linemarker when compiling preprocessed source
David Callahan [Wed, 25 Jan 2017 01:55:28 +0000 (01:55 +0000)]
Use filename in linemarker when compiling preprocessed source

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293004 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReverting commit because an NVPTX patch sneaked in. Break up into two
Arpith Chacko Jacob [Wed, 25 Jan 2017 01:45:59 +0000 (01:45 +0000)]
Reverting commit because an NVPTX patch sneaked in.  Break up into two
patches.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293003 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Codegen support for 'target teams' on the host.
Arpith Chacko Jacob [Wed, 25 Jan 2017 01:38:33 +0000 (01:38 +0000)]
[OpenMP] Codegen support for 'target teams' on the host.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293001 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Support for the num_threads-clause on 'target parallel' on the NVPTX device.
Arpith Chacko Jacob [Wed, 25 Jan 2017 01:18:34 +0000 (01:18 +0000)]
[OpenMP] Support for the num_threads-clause on 'target parallel' on the 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292999 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Support for the num_threads-clause on 'target parallel'.
Arpith Chacko Jacob [Wed, 25 Jan 2017 00:57:16 +0000 (00:57 +0000)]
[OpenMP] Support for the num_threads-clause on 'target parallel'.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292997 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPR31742: Don't emit a bogus "zero size array" extwarn when initializing a
Richard Smith [Tue, 24 Jan 2017 23:18:28 +0000 (23:18 +0000)]
PR31742: Don't emit a bogus "zero size array" extwarn when initializing a
runtime-sized array from an empty list in an array new.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292991 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoStrengthen test from r292632 to also check we get the mangling correct for this case.
Richard Smith [Tue, 24 Jan 2017 21:03:48 +0000 (21:03 +0000)]
Strengthen test from r292632 to also check we get the mangling correct for this case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292978 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIRGen: Factor out function CodeGenAction::loadModule. NFCI.
Peter Collingbourne [Tue, 24 Jan 2017 19:55:38 +0000 (19:55 +0000)]
IRGen: Factor out function CodeGenAction::loadModule. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292972 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIRGen: Factor out function clang::FindThinLTOModule. NFCI.
Peter Collingbourne [Tue, 24 Jan 2017 19:54:37 +0000 (19:54 +0000)]
IRGen: Factor out function clang::FindThinLTOModule. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292970 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[docs] Add TableGen-based generator for command line argument documentation,
Richard Smith [Tue, 24 Jan 2017 19:39:46 +0000 (19:39 +0000)]
[docs] Add TableGen-based generator for command line argument documentation,
and generate documentation for all (non-hidden) options supported by the
'clang' driver.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292968 91177308-0d34-0410-b5e6-96231b3b80d8