]> granicus.if.org Git - clang/log
clang
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

7 years agoFix test/Driver/embed-bitcode.c on non-Darwin host by setting the target explicitly
Mehdi Amini [Tue, 24 Jan 2017 18:49:49 +0000 (18:49 +0000)]
Fix test/Driver/embed-bitcode.c on non-Darwin host by setting the target explicitly

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

7 years agoForward -bitcode_process_mode to ld64 in marker-only mode
Mehdi Amini [Tue, 24 Jan 2017 18:15:21 +0000 (18:15 +0000)]
Forward -bitcode_process_mode to ld64 in marker-only mode

Reviewers: steven_wu

Subscribers: cfe-commits

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

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

7 years agoSplit isUsingLTO() outside of embedBitcodeInObject() and embedBitcodeMarkerOnly().
Mehdi Amini [Tue, 24 Jan 2017 18:12:25 +0000 (18:12 +0000)]
Split isUsingLTO() outside of embedBitcodeInObject() and embedBitcodeMarkerOnly().

Summary: These accessors maps directly to the command line option.

Reviewers: steven_wu

Subscribers: cfe-commits

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

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

7 years ago[CodeCompletion] Ensure that ObjC root class completes instance
Alex Lorenz [Tue, 24 Jan 2017 14:15:08 +0000 (14:15 +0000)]
[CodeCompletion] Ensure that ObjC root class completes instance
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

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

7 years ago[Sema] Fix assumption about typo corrections containing no decl.
Benjamin Kramer [Tue, 24 Jan 2017 12:49:59 +0000 (12:49 +0000)]
[Sema] Fix assumption about typo corrections containing no decl.

This can happen when the typo correction is coming from an external sema
source. Test case will follow in clang-tools-extra.

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

7 years agoReplace use of chdir with llvm::sys::fs::set_current_path
Pavel Labath [Tue, 24 Jan 2017 11:14:29 +0000 (11:14 +0000)]
Replace use of chdir with llvm::sys::fs::set_current_path

NFCI

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

7 years agoRevert "[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`."
Greg Parker [Tue, 24 Jan 2017 08:57:17 +0000 (08:57 +0000)]
Revert "[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`."

The underlying `lit` change needs to be better-coordinated with libc++.

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

7 years ago[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`.
Greg Parker [Tue, 24 Jan 2017 08:47:25 +0000 (08:47 +0000)]
[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`.

Requires the new `lit` boolean expressions in LLVM r292896.

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

7 years agoRevert "[analyzer] Fix memory space of static locals seen from nested blocks."
Devin Coughlin [Tue, 24 Jan 2017 02:10:59 +0000 (02:10 +0000)]
Revert "[analyzer] Fix memory space of static locals seen from nested blocks."

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.

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

7 years agoSwitch TableGen to emit calls to ASTRecordReader for AttrPCHRead.
David L. Jones [Tue, 24 Jan 2017 01:04:30 +0000 (01:04 +0000)]
Switch TableGen to emit calls to ASTRecordReader for AttrPCHRead.

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

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

7 years ago[sanitizer-coverage] emit __sanitizer_cov_trace_pc_guard w/o a preceding 'if' by...
Kostya Serebryany [Tue, 24 Jan 2017 00:57:31 +0000 (00:57 +0000)]
[sanitizer-coverage] emit __sanitizer_cov_trace_pc_guard w/o a preceding 'if' by default. Update the docs, also add deprecation notes around other parts of sanitizer coverage

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

7 years agoRe-commit "Don't inline dllimport functions referencing non-imported methods"
Hans Wennborg [Mon, 23 Jan 2017 23:57:50 +0000 (23:57 +0000)]
Re-commit "Don't inline dllimport functions referencing non-imported methods"

This re-commits r292522 with the addition that it also handles calls
through pointer to member functions without crashing.

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

7 years agoAdd LF_ prefix to LibFunc enums in TargetLibraryInfo.
David L. Jones [Mon, 23 Jan 2017 23:16:58 +0000 (23:16 +0000)]
Add LF_ prefix to LibFunc enums in TargetLibraryInfo.

Summary:
The LibFunc::Func enum holds enumerators named for libc functions.
Unfortunately, there are real situations, including libc implementations, where
function names are actually macros (musl uses "#define fopen64 fopen", for
example; any other transitively visible macro would have similar effects).

Strictly speaking, a conforming C++ Standard Library should provide any such
macros as functions instead (via <cstdio>). However, there are some "library"
functions which are not part of the standard, and thus not subject to this
rule (fopen64, for example). So, in order to be both portable and consistent,
the enum should not use the bare function names.

The old enum naming used a namespace LibFunc and an enum Func, with bare
enumerators. This patch changes LibFunc to be an enum with enumerators prefixed
with "LF_". (Unfortunately, a scoped enum is not sufficient to override macros.)

These changes are for clang. See https://reviews.llvm.org/D28476 for LLVM.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoPR31692: Don't mark a declaration as invalid if we haven't necessarily emitted a...
Richard Smith [Mon, 23 Jan 2017 23:14:23 +0000 (23:14 +0000)]
PR31692: Don't mark a declaration as invalid if we haven't necessarily emitted a (user-visible) error.

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

7 years ago[APFloat] Switch from (PPCDoubleDoubleImpl, IEEEdouble) layout to (IEEEdouble, IEEEdo...
Tim Shen [Mon, 23 Jan 2017 22:39:35 +0000 (22:39 +0000)]
[APFloat] Switch from (PPCDoubleDoubleImpl, IEEEdouble) layout to (IEEEdouble, IEEEdouble)

Summary:
This patch changes the layout of DoubleAPFloat, and adjust all
operations to do either:
1) (IEEEdouble, IEEEdouble) -> (uint64_t, uint64_t) -> PPCDoubleDoubleImpl,
   then run the old algorithm.
2) Do the right thing directly.

1) includes multiply, divide, remainder, mod, fusedMultiplyAdd, roundToIntegral,
   convertFromString, next, convertToInteger, convertFromAPInt,
   convertFromSignExtendedInteger, convertFromZeroExtendedInteger,
   convertToHexString, toString, getExactInverse.
2) includes makeZero, makeLargest, makeSmallest, makeSmallestNormalized,
   compare, bitwiseIsEqual, bitcastToAPInt, isDenormal, isSmallest,
   isLargest, isInteger, ilogb, scalbn, frexp, hash_value, Profile.

I could split this into two patches, e.g. use
1) for all operatoins first, then incrementally change some of them to
2). I didn't do that, because 1) involves code that converts data between
PPCDoubleDoubleImpl and (IEEEdouble, IEEEdouble) back and forth, and may
pessimize the compiler. Instead, I find easy functions and use
approach 2) for them directly.

Next step is to implement move multiply and divide from 1) to 2). I don't
have plans for other functions in 1).

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

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

7 years agoAMDGPU: Update for changed subtarget feature name
Matt Arsenault [Mon, 23 Jan 2017 22:31:14 +0000 (22:31 +0000)]
AMDGPU: Update for changed subtarget feature name

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

7 years agoGuard __gnuc_va_list typedef.
Paul Robinson [Mon, 23 Jan 2017 19:09:21 +0000 (19:09 +0000)]
Guard __gnuc_va_list typedef.

Differential Revision: http://reviews.llvm.org/D28620

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

7 years agoFix documentation typo from r292558.
Richard Smith [Mon, 23 Jan 2017 18:17:46 +0000 (18:17 +0000)]
Fix documentation typo from r292558.

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

7 years ago[Sema] UsingShadowDecl shouldn't be hidden by the UsingDecl that owns it
Alex Lorenz [Mon, 23 Jan 2017 17:23:23 +0000 (17:23 +0000)]
[Sema] UsingShadowDecl shouldn't be hidden by the UsingDecl that owns it

rdar://23454249

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

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

7 years ago[OpenCL] Improved enqueue_kernel diagnostic message
Anastasia Stulova [Mon, 23 Jan 2017 17:12:36 +0000 (17:12 +0000)]
[OpenCL] Improved enqueue_kernel diagnostic message

- Removed duplicated word typo.
- Made coherent across multiple similar diagnostics.

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

7 years agoRevert "DebugInfo: Omit class definitions even in the presence of available_externall...
David Blaikie [Mon, 23 Jan 2017 16:57:14 +0000 (16:57 +0000)]
Revert "DebugInfo: Omit class definitions even in the presence of available_externally vtables"

Patch crashing on a bootstrapping sanitizer bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/679

Reverting while I investigate.

This reverts commit r292768.

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

7 years ago[analyzer] Fix memory space of static locals seen from nested blocks.
Artem Dergachev [Mon, 23 Jan 2017 16:57:11 +0000 (16:57 +0000)]
[analyzer] Fix memory space of static locals seen from nested blocks.

When a block within a function accesses a function's static local variable,
this local is captured by reference rather than copied to the heap.

Therefore this variable's memory space is known: StaticGlobalSpaceRegion.
Used to be UnknownSpaceRegion, same as for stack locals.

Fixes a false positive in MacOSXAPIChecker.

rdar://problem/30105546
Differential revision: https://reviews.llvm.org/D28946

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

7 years ago[clang-format] Fix LanguageKind comments.
Krasimir Georgiev [Mon, 23 Jan 2017 16:21:06 +0000 (16:21 +0000)]
[clang-format] Fix LanguageKind comments.

Summary: With the introduction of LK_ObjC, the comment line for LK_Cpp became obsolete.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[OpenMP] DSAChecker bug fix for combined directives.
Arpith Chacko Jacob [Mon, 23 Jan 2017 15:38:49 +0000 (15:38 +0000)]
[OpenMP] DSAChecker bug fix for combined directives.

The DSAChecker code in SemaOpenMP looks at the captured statement
associated with an OpenMP directive.  A combined directive such as
'target parallel' has nested capture statements, which have to be
fully traversed before executing the DSAChecker.  This is a patch
to perform the traversal for such combined directives.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29026

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

7 years agoRevert "IRGen: Start using the WriteThinLTOBitcode pass."
Martin Bohme [Mon, 23 Jan 2017 14:33:42 +0000 (14:33 +0000)]
Revert "IRGen: Start using the WriteThinLTOBitcode pass."

Summary:
This reverts commit r292662.

This change broke internal builds. Will provide a reproducer internally.

Subscribers: pcc, mehdi_amini, cfe-commits, mgorny

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

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

7 years agoclang-format: remove tests that assume no config file will be found as this is not...
Antonio Maiorano [Mon, 23 Jan 2017 13:20:23 +0000 (13:20 +0000)]
clang-format: remove tests that assume no config file will be found as this is not always the case

These tests fail for developers who place their build directories under the
llvm root directory because llvm's own .clang-format file will be found.
Anyway these cases are covered by FormatStyle.GetStyleOfFile tests
(FormatTest.cpp).

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

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

7 years agoASTImporter: fix tests on Windows with removing slashed parts of paths
Aleksei Sidorin [Mon, 23 Jan 2017 10:39:45 +0000 (10:39 +0000)]
ASTImporter: fix tests on Windows with removing slashed parts of paths

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

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

7 years agoASTImporter: quick test fix
Aleksei Sidorin [Mon, 23 Jan 2017 10:16:30 +0000 (10:16 +0000)]
ASTImporter: quick test fix

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

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