Commit Graph

69587 Commits

Author SHA1 Message Date
Devin Coughlin 35b59fcaf2 [analyzer] Add missing documentation for static analyzer checkers
Some checks did not have documentation in the www/analyzer/ folder and also
some alpha checks became non-alpha.

Patch by Dominik Szabó!

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

llvm-svn: 308242
2017-07-18 00:34:57 +00:00
Mandeep Singh Grang daa40b98ef [COFF, ARM64] Set the data type widths and the data layout string
Summary: COFF ARM64 is LLP64 platform. So int is 4 bytes, long is 4 bytes and long long is 8 bytes.

Reviewers: compnerd, ruiu, rnk, efriedma

Reviewed By: compnerd, efriedma

Subscribers: efriedma, javed.absar, cfe-commits, aemerson, llvm-commits, kristof.beyls

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

llvm-svn: 308222
2017-07-17 21:10:45 +00:00
Martin Storsjo 022e782e75 [AArch64] Add support for __builtin_ms_va_list on aarch64
Move builtins from the x86 specific scope into the global
scope. Their use is still limited to x86_64 and aarch64 though.

This allows wine on aarch64 to properly handle variadic functions.

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

llvm-svn: 308218
2017-07-17 20:49:45 +00:00
Martin Storsjo d1daa95e11 Update use of llvm::CallingConv:X86_64_Win64 after LLVM commit r308208
llvm-svn: 308209
2017-07-17 20:05:56 +00:00
Brian Gesiak 7873d822f7 [Basic] Detect Git submodule version in CMake
Summary:
When searching for Git version control information, libBasic's CMake
checks for the path '.git/logs/HEAD'. However, when LLVM is included as
a Git submodule, this path does not exist. Instead, it contains a '.git'
file with the following:

```
gitdir: ../../.git/modules/external/llvm
```

Where '../..' is the relative path to the root repository that contains
the LLVM Git submodule.

Because of this discrepancy, `clang --version` does not output source
control information if built from a Git submodule.

To fix, check whether '.git' is a directory or a file. If it's a
directory, simply use the '.git/logs/HEAD' path. If it's a file, read it
and check for the tell-tale sign of a Git submodule: the text "gitdir:".
If it exists, follow that path and use the 'logs/HEAD' at that location
instead. This allows not only the correct revision information to be
retrieved, but also uses a file that will change with each source
control revision.

Test Plan:
1. Before applying this change, build Clang as a Git submodule in a repository
   that places it in external/clang, and confirm no revision information
   is output when `clang --version` is invoked (just "clang 5.0.0" is
   output, no Git hashes).
2. Apply these changes and build Clang as a Git repository nested under
   llvm/tools/clang, and confirm that `clang --version` displays correct
   version information.
3. Apply these changes and build Clang as a Git submodule using the
   structure described in (1), and confirm version control information
   is output as in (2).

Reviewers: jordan_rose, beanz, probinson

Reviewed By: jordan_rose

Subscribers: chapuni, mgorny, cfe-commits

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

llvm-svn: 308205
2017-07-17 19:22:57 +00:00
Ulrich Weigand 6af2559562 [SystemZ] Add support for IBM z14 processor (3/3)
This patch updates the vecintrin.h header file to provide the new
set of high-level vector built-in functions.  This matches the
updated definition implemented by other compilers for the platform,
indicated by the pre-defined macro __VEC__ == 10302.

Note that some of the new functions (notably those involving the
vector float data type) are only available with -march=z14
(indicated by __ARCH__ == 12).

llvm-svn: 308199
2017-07-17 17:47:35 +00:00
Ulrich Weigand 76976a7920 [SystemZ] Add support for IBM z14 processor (2/3)
This patch extends the -fzvector language feature to enable the new
"vector float" data type when compiling at -march=z14.  This matches
the updated extension definition implemented by other compilers for
the platform, which is indicated to applications by pre-defining
__VEC__ to 10302 (instead of 10301).

llvm-svn: 308198
2017-07-17 17:46:47 +00:00
Ulrich Weigand cac24ab04c [SystemZ] Add support for IBM z14 processor (1/3)
This patch series adds support for the IBM z14 processor.  This part includes:
- Basic support for the new processor and its features.
- Support for low-level builtins mapped to new LLVM intrinsics.

Support for the -fzvector extension to vector float and the new
high-level vector intrinsics is provided by separate patches.

llvm-svn: 308197
2017-07-17 17:45:57 +00:00
Mandeep Singh Grang a16b27cfda [clang] Remove redundant check-prefix=CHECK from tests. NFC.
Reviewers: t.p.northover, mstorsjo, rsmith, mcrosier

Reviewed By: mstorsjo, mcrosier

Subscribers: mcrosier, javed.absar, cfe-commits

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

llvm-svn: 308192
2017-07-17 17:31:44 +00:00
Faisal Vali ac506d7494 [NFC] Refactor the Preprocessor function that handles Macro definitions and rename Arguments to Parameters in Macro Definitions.
- Extracted the reading of the tokens out into a separate function.
  - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation).

This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible.

I will also directly update some extra clang tooling that is broken by the change from Argument to Parameter.

Hopefully the bots will stay appeased.

Thanks!

llvm-svn: 308190
2017-07-17 17:18:43 +00:00
Manuel Klimek 06b575ca81 Fix dereference of pointers in throw statements.
Before:
  throw * x;

After:
  throw *x;

Patch by Erik Uhlmann.

llvm-svn: 308185
2017-07-17 15:27:53 +00:00
Alexey Bataev ec8c9f8eb9 [OPENMP] Fix reduction combiner test
llvm-svn: 308183
2017-07-17 14:53:02 +00:00
Alexey Bataev 55c2a961e0 [OPENMP] Further fixes of the reduction codegen tests
llvm-svn: 308182
2017-07-17 14:47:59 +00:00
Alexey Bataev 7766e51a61 [OPENMP] Further test fixes.
llvm-svn: 308178
2017-07-17 14:22:34 +00:00
Alexey Bataev a2a814f925 [OPENMP] Rework tests to pacify buildbots.
llvm-svn: 308176
2017-07-17 14:06:41 +00:00
Alexey Bataev be5a8b42cd [OPENMP] Codegen for reduction clauses in 'taskloop' directives.
Adds codegen for taskloop-based directives.

llvm-svn: 308174
2017-07-17 13:30:36 +00:00
Faisal Vali 0e54e5679e Revert changes from my previous refactoring - will need to fix dependencies in clang's extra tooling (such as clang-tidy etc.).
Sorry about that.

llvm-svn: 308158
2017-07-17 02:03:21 +00:00
Faisal Vali 11746b05e5 [NFC] Refactor the Preprocessor function that handles Macro definitions and rename Arguments to Parameters in Macro Definitions.
- Extracted the reading of the tokens out into a separate function.
  - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation).

This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible.


Thanks!

llvm-svn: 308157
2017-07-17 01:27:53 +00:00
Brad Smith 9466a84a4e Enable TLS support on OpenBSD.
llvm-svn: 308156
2017-07-17 01:06:46 +00:00
Brad Smith 733fe193d3 Enable TLS support on OpenBSD, but default to the emulatated TLS model.
llvm-svn: 308155
2017-07-17 00:49:31 +00:00
Yuka Takahashi 64918d0b25 [Bash-autocompletion] Add support for -W<warning> and -Wno<warning>
Summary:
`-W[tab]` will autocomplete warnings defined in this link:
https://clang.llvm.org/docs/DiagnosticsReference.html#wweak-vtables

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

llvm-svn: 308139
2017-07-16 15:07:20 +00:00
Faisal Vali 5f475b989c [c++2a] Add option -std=c++2a to enable support for potential/transitional C++2a features
- as usual C++2a implies all the C++'s that came before it.

Thank you Aaron for the feedback here: https://reviews.llvm.org/D35454 

llvm-svn: 308118
2017-07-16 00:23:04 +00:00
Richard Smith 21a1019387 [cxx_status] Fix typos.
llvm-svn: 308101
2017-07-15 15:51:59 +00:00
Richard Smith da62f427a4 [cxx_status] Add approved Toronto WG21 motions.
llvm-svn: 308099
2017-07-15 15:42:36 +00:00
John McCall 12251887bd Use ARC parsing rules for ns_returns_retained in MRC so that code can
be shared without warnings.  Build AttributedTypes to leave breadcrumbs
for tools like the static analyzer.  Warn about attempting to use the
attribute with incompatible return types.

llvm-svn: 308092
2017-07-15 11:06:46 +00:00
Yuka Takahashi 8561c2e22c [Bash-autocompletion] Fixed a bug on bash
Summary: Maybe I mismerged when merging previous commits by hand.

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

llvm-svn: 308091
2017-07-15 09:09:51 +00:00
NAKAMURA Takumi 478b7051f9 clang/test/FixIt/format.m: Tweak for i686, where ssize_t is int. (r308067)
llvm-svn: 308084
2017-07-15 06:14:47 +00:00
Richard Trieu 1c71d5143a [ODRHash] Revert r307743 which reverted r307720
Reapply r307720 to allow processing of constructors and destructors.  Reuse
the diagnostics for CXXMethodDecl for them.

llvm-svn: 308077
2017-07-15 02:55:13 +00:00
Alexander Shaposhnikov da4c312634 [clang] Fix format test
This diff makes the test FixIt/format.m more robust.
The issue was caught by the build bot clang-cmake-thumbv7-a15.

Test plan: make check-all

llvm-svn: 308073
2017-07-15 01:06:59 +00:00
Matthias Braun 0bc7d63322 Try to fix modules build
Module builds somehow report an ambiguity between clang::Diagnostic and
clang::Tooling::Diagnostic. It seems as if one of the additional headers
brought in by the module brings the clang namespace to the toplevel. I
could not find out the reason for that, so for now I go with the simple
fix to bring the build back to green.

rdar://33321397

llvm-svn: 308071
2017-07-15 00:29:25 +00:00
Alexander Shaposhnikov 441c1d92df [clang] Fix handling of "%zd" format specifier
This diff addresses FIXME in lib/Analysis/PrintfFormatString.cpp
and makes PrintfSpecifier::getArgType return the correct type. 
In particular, this change enables Clang to emit a warning on 
incorrect using of "%zd"/"%zn" format specifiers.

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

Test plan: make check-all

llvm-svn: 308067
2017-07-14 22:57:00 +00:00
Nico Weber 564004ae78 Fix flag names in @available docs.
llvm-svn: 308048
2017-07-14 18:52:30 +00:00
Nico Weber a8c097918b Fix link in docs.
llvm-svn: 308046
2017-07-14 18:45:36 +00:00
Kostya Serebryany 8328133dd2 do more processing in clang-fuzzer (use EmitAssemblyAction)
Summary: use EmitAssemblyAction in clang-fuzzer

Reviewers: klimek, rsmith

Reviewed By: klimek

Subscribers: cfe-commits, mgorny

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

llvm-svn: 308045
2017-07-14 18:42:07 +00:00
Nico Weber 11cafc82b7 Add documentation for @available
https://reviews.llvm.org/D35379

llvm-svn: 308044
2017-07-14 18:40:52 +00:00
Sterling Augustine 78f46124fb Prevent ClangTools from generating dependency files.
D34304 created a way for ToolInvocations to conditionally generate
dependency files, and updated call sites to preserve the old behavior
of not generating them by default. CompilerInvocations...

Summary:
...are yet another
call-path that needs updating to preserve the old behavior.

Reviewers: klimek, echristo

Reviewed By: echristo

Subscribers: echristo, cfe-commits

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

llvm-svn: 308043
2017-07-14 18:33:30 +00:00
Jakub Kuderski 581677fd5b [Dominators] Update Clang's DominatorTree to use the new template argument
Summary: This patch makes the Clang's DominatorTree use the new IsPostDom template argument for DominatorTreeBase.

Reviewers: dberlin, sanjoy, davide, grosser

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 308041
2017-07-14 18:26:21 +00:00
Aaron Ballman 4a6d7d45cc Unconditionally use .init_array instead of .ctors on Solaris.
Patch by Fedor Sergeev

llvm-svn: 308038
2017-07-14 17:49:52 +00:00
Alexander Shaposhnikov 1e898d911c [clang] Add getSignedSizeType method
C11 standard refers to the signed counterpart of the type size_t in
the paragraph 7.21.6.1 where it defines d, i, o, u, x, or x conversion specifiers
(in printf format string).
In Clang there is a FIXME (in lib/Analysis/PrintfFormatString.cpp) for this case
(which is not handled correctly at the moment).
This diff adds getSignedSizeType method to TargetInfo and exposes it 
in ASTContext similarly to how it is done for getSizeType.
lib/Analysis/PrintfFormatString.cpp will be changed in a separate commit.

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

Test plan: make check-all

llvm-svn: 308037
2017-07-14 17:30:14 +00:00
Krzysztof Parzyszek 92b5c3f579 [Hexagon] Add intrinsics for data cache operations
This is the clang part, adding support for
  void __builtin_HEXAGON_Y2_dccleana(void*);
  void __builtin_HEXAGON_Y2_dccleaninva(void*);
  void __builtin_HEXAGON_Y2_dcinva(void*);
  void __builtin_HEXAGON_Y2_dczeroa(void*);
  void __builtin_HEXAGON_Y4_l2fetch(void*, unsigned);
  void __builtin_HEXAGON_Y5_l2fetch(void*, unsigned long long);
Requires r308032.

llvm-svn: 308035
2017-07-14 16:01:24 +00:00
Ilya Biryukov 00f5f29535 [index] Added a method indexTopLevelDecls to run indexing on a list of Decls.
Summary:
We need it in clangd for refactoring that replaces ASTUnit
with manual AST management.

Reviewers: akyrtzi, benlangmuir, arphaman, klimek

Reviewed By: arphaman

Subscribers: cfe-commits

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

llvm-svn: 308016
2017-07-14 10:47:45 +00:00
Alexander Kornienko 2745e17970 [Clang-Tidy] Preserve Message, FileOffset, FilePath in Clang-Tidy YAML output
Summary:
To get properly integration Clang-Tidy with CLion IDE, next things were implemented:
1) Preserve `Message`, `FileOffset`, `FilePath` in the clang-tidy output.
2) Export all diagnostics, not just the ones with fixes
3) Test-cases

Reviewers: klimek, ilya-biryukov, alexfh

Reviewed By: alexfh

Subscribers: alexfh, JDevlieghere, mgorny, xazax.hun, cfe-commits, klimek

Tags: #clang-tools-extra

Patch by Vladimir Plyashkun!

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

llvm-svn: 308014
2017-07-14 10:37:44 +00:00
Erik Verbruggen 49db030626 [analyzer] Add annotation for functions taking user-facing strings
There was already a returns_localized_nsstring annotation to indicate
that the return value could be passed to UIKit methods that would
display them. However, those UIKit methods were hard-coded, and it was
not possible to indicate that other classes/methods in a code-base would
do the same.

The takes_localized_nsstring annotation can be put on function
parameters and selector parameters to indicate that those will also show
the string to the user.

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

llvm-svn: 308012
2017-07-14 10:24:36 +00:00
Olivier Goffart 90f981bc5b Keep the IdentifierInfo in the Token for alternative operator keyword
The goal of this commit is to fix clang-format so it does not merge tokens when
using the alternative spelling keywords. (eg: "not foo" should not become "notfoo")

The problem is that Preprocessor::HandleIdentifier used to drop the identifier info
from the token for these keyword. This means the first condition of
TokenAnnotator::spaceRequiredBefore is not met. We could add explicit check for
the spelling in that condition, but I think it is better to keep the IdentifierInfo
and handle the operator keyword explicitly when needed. That actually leads to simpler
code, and probably slightly more efficient as well.

Another side effect of this change is that __identifier(and) will now work as
one would expect, removing a FIXME from the MicrosoftExtensions.cpp test

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

llvm-svn: 308008
2017-07-14 09:23:40 +00:00
Craig Topper 3544b3e501 [X86] Add 'movbe' to btver2 CPU.
This probably doesn't change anything because the frotend doesn't do anything with this feature and the backend will infer from the cpu string. So this is just for consistency with other cpus that support movbe.

llvm-svn: 308002
2017-07-14 06:36:17 +00:00
George Burgess IV 163a8337ad Add release notes for the overloadable attribute
llvm-svn: 307995
2017-07-14 03:23:57 +00:00
Eric Christopher 04a26127c5 Use EXPECT_TRUE rather than EXPECT_EQ(true, ...) to clean up the code and silence a null conversion warning.
llvm-svn: 307989
2017-07-14 02:03:03 +00:00
Eric Christopher 7aba9784c3 Change dyn_casts with unused variables to isa statements to avoid unused variables.
llvm-svn: 307988
2017-07-14 01:42:57 +00:00
Richard Trieu 9747a7c562 [ODRHash] Avoid taking the types of FunctionDecl's
FunctionDecl already hashes most of the information in the function's type.
Add hashing of the return type, and skip hashing the function's type to avoid
redundancy and extra work when computing the hash.

llvm-svn: 307986
2017-07-14 01:36:41 +00:00
Akira Hatanaka 136ec4987e [Driver] Respect -target when determining target platform on Apple
platforms.

Set the target OS based on -target if it is present on the command
line and -arch is not.

With this commit, "-target x86_64-apple-ios8.0" does the same thing as
"-arch x86_64 -mios-version-min=8.0".

rdar://problem/21012522

llvm-svn: 307982
2017-07-14 00:21:32 +00:00
Paul Robinson d23f2a8ad5 [PS4] Disable LTO unit features under ThinLTO, like for Darwin.
llvm-svn: 307964
2017-07-13 21:25:47 +00:00
Lang Hames 971add5f07 Use getNameAsString instead of getName to get method names when dumping
overrides:  getName can fail if the decl's name isn't a simple identifier.

This is a more general replacement for the fix in r305860.

llvm-svn: 307959
2017-07-13 21:08:29 +00:00
Vedant Kumar 175b6d1f28 [ubsan] Teach the pointer overflow check that "p - <unsigned> <= p" (PR33430)
The pointer overflow check gives false negatives when dealing with
expressions in which an unsigned value is subtracted from a pointer.
This is summarized in PR33430 [1]: ubsan permits the result of the
subtraction to be greater than "p", but it should not.

To fix the issue, we should track whether or not the pointer expression
is a subtraction. If it is, and the indices are unsigned, we know to
expect "p - <unsigned> <= p".

I've tested this by running check-{llvm,clang} with a stage2
ubsan-enabled build. I've also added some tests to compiler-rt, which
are in D34122.

[1] https://bugs.llvm.org/show_bug.cgi?id=33430

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

llvm-svn: 307955
2017-07-13 20:55:26 +00:00
Martin Storsjo 502de22fda [AArch64] Produce the right kind of va_arg for windows
On windows on arm64, the va_list is a plain pointer.

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

llvm-svn: 307933
2017-07-13 17:59:14 +00:00
Simon Pilgrim 6c0eeffe71 Fix spelling mistakes in comments. NFCI.
llvm-svn: 307932
2017-07-13 17:34:44 +00:00
Simon Pilgrim f87eb880dd Fix -Wdocumentation warning. NFCI
llvm-svn: 307931
2017-07-13 17:29:48 +00:00
Alex Lorenz e1088dc42b Extend -Wdeprecated-implementations to warn about unavailable methods
rdar://22867595

llvm-svn: 307924
2017-07-13 16:37:11 +00:00
Alex Lorenz f81d97e763 NFC, Cleanup the code for -Wdeprecated-implementations
and void capitalization of the warning message

rdar://22867595

llvm-svn: 307923
2017-07-13 16:35:59 +00:00
Amara Emerson ebe02904d4 [AArch64] Add support for handling the +sve target feature.
This also adds the appropriate predefine for SVE if enabled.

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

llvm-svn: 307919
2017-07-13 15:36:01 +00:00
Alexey Bataev c9dcaaae69 [OPENMP] Fix reduction tests, NFC.
llvm-svn: 307916
2017-07-13 15:15:25 +00:00
Alexey Bataev faede1d0d8 [OPENMP] Fix reduction tests, NFC.
llvm-svn: 307915
2017-07-13 15:09:05 +00:00
Alexey Bataev 280f308b71 [OPENMP] Further reduction test fix, NFC.
llvm-svn: 307914
2017-07-13 15:02:27 +00:00
Alexey Bataev 80621121e2 [OPENMP] Fix reduction tests, NFC.
llvm-svn: 307912
2017-07-13 14:54:42 +00:00
Alexey Bataev 3ef6fd5637 [OPENMP] Fix reduction tests, NFC.
llvm-svn: 307911
2017-07-13 14:29:19 +00:00
Alexey Bataev 5c40bec5eb [OPENMP] Generalization of codegen for reduction clauses.
Reworked codegen for reduction clauses for future support of reductions
in task-based directives.

llvm-svn: 307910
2017-07-13 13:36:14 +00:00
Alex Lorenz 75ac75d01e Remove another 'using namespace llvm' from the
RecursiveSymbolVisitor.h header

This should fix the modules build
(http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/).

llvm-svn: 307908
2017-07-13 12:49:22 +00:00
Alex Lorenz 10db8ce290 Remove 'using namespace llvm' from the USRFinder.h header
This should fix the modules build
(http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/).

llvm-svn: 307905
2017-07-13 11:27:12 +00:00
Alex Lorenz 50b2dd336e [ObjC] Pick a 'readwrite' property when synthesizing ambiguous
property and check for incompatible attributes

This commit changes the way ambiguous property synthesis (i.e. when synthesizing
a property that's declared in multiple protocols) is performed. Previously,
Clang synthesized the first property that was found. This lead to problems when
the property was synthesized in a class that conformed to two protocols that
declared that property and a second protocols had a 'readwrite' declaration -
the setter was not synthesized so the class didn't really conform to the second
protocol and user's code would crash at runtime when they would try to set the
property.

This commit ensures that a first readwrite property is selected. This is a
semantic change that changes users code in this manner:

```
@protocol P @property(readonly) int p; @end
@protocol P2 @property(readwrite) id p; @end
@interface I <P2> @end
@implementation I
@syntesize p; // Users previously got a warning here, and Clang synthesized
              // readonly 'int p' here. Now Clang synthesizes readwrite 'id' p..
@end
```

To ensure that this change is safe, the warning about incompatible types is
promoted to an error when this kind of readonly/readwrite ambiguity is detected
in the @implementation. This will ensure that previous code that had this subtle
bug and ignored the warning now will fail to compile with an error, and users
should not get suprises at runtime once they resolve the error.

The commit also extends the ambiguity checker, and now it can detect conflicts
among the different property attributes. An error diagnostic is used for
conflicting attributes, to ensure that the user won't get "suprises" at runtime.

ProtocolPropertyMap is removed in favour of a a set + vector because the map's
order of iteration is non-deterministic, so it couldn't be used to select the
readwrite property.

rdar://31579994

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

llvm-svn: 307903
2017-07-13 11:06:22 +00:00
Alex Lorenz 9b9188d861 [index] Objective-C method declarations and message sends with
an empty first selector piece should store the location of the first ':'

rdar://33188656

llvm-svn: 307901
2017-07-13 10:50:21 +00:00
Alex Lorenz 98394f8393 [refactor][rename] Use a single base class for class that finds
a declaration at location and for class that searches for all occurrences of
a specific declaration

This commit uses a single RecursiveSymbolVisitor class for both
USRLocFindingASTVisitor and NamedDeclOccurrenceFindingVisitor to avoid duplicate
traversal code. It also traverses nested name specifier locs in the new class
and remove the separate matching step.

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

llvm-svn: 307898
2017-07-13 10:36:33 +00:00
Hiroshi Inoue a5141c8d17 fix typos in comments; NFC
llvm-svn: 307886
2017-07-13 06:51:20 +00:00
Akira Hatanaka 2246167362 [Sema] Mark a virtual CXXMethodDecl as used if a call to it can be
devirtualized.

The code to detect devirtualized calls is already in IRGen, so move the
code to lib/AST and make it a shared utility between Sema and IRGen.

This commit fixes a linkage error I was seeing when compiling the
following code:

$ cat test1.cpp
struct Base {
  virtual void operator()() {}
};

template<class T>
struct Derived final : Base {
  void operator()() override {}
};

Derived<int> *d;

int main() {
  if (d)
    (*d)();
  return 0;
}

rdar://problem/33195657

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

llvm-svn: 307883
2017-07-13 06:08:27 +00:00
Petr Hosek cc24851da6 Reland "[Driver] Update Fuchsia driver path handling"
Several improvements to the Fuchsia driver:

* Search for C++ library headers and libraries in directories that
are part of the toolchain distribution rather than sysroot.

* Use LLVM support utlities to construct paths to make sure the driver
is also usable on Windows for cross-compiling.

* Change the driver to inherit directly from ToolChain rather than
Generic_GCC since we don't need any of the GCC related multilib logic.

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

llvm-svn: 307856
2017-07-12 22:14:41 +00:00
Ben Langmuir da467ed444 [index] Don't add relation to a NamedDecl with no name
Unless it's one of the special cases (tag, category) that we can handle.
This syncs up the check between handling a decl and handling a relation.

This would cause invalid nameless decls to end up in relations despite
having no name or USR.

rdar://problem/32474406

llvm-svn: 307855
2017-07-12 22:05:30 +00:00
Dominic Chen c0402c6916 Revert "[analyzer] Support generating and reasoning over more symbolic constraint types"
Assertion `Loc::isLocType(SSE->getLHS()->getType())' failed in Analysis/PR3991.m

This reverts commit e469ff2759275e67f9072b3d67fac90f647c0fe6.

llvm-svn: 307853
2017-07-12 21:43:42 +00:00
Simon Dardis ba8eb9c50c [mips][mt][7/7] Add driver option for the MIPS MT ASE.
Reviewers: atanasyan, slthakur

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

llvm-svn: 307847
2017-07-12 21:13:05 +00:00
Petr Hosek ec770aa228 Revert "[Driver] Update Fuchsia driver path handling"
The tests are failing on Windows.

This reverts commit 429fe8229496f639df6b0b4734beedb1d4317aa5.

llvm-svn: 307845
2017-07-12 21:03:54 +00:00
Ekaterina Romanova 03ecd774ba [DOXYGEN] Corrected typos and incorrect parameters description.
Corrected several typos and incorrect parameters description that Sony
's techinical writer found during review.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

llvm-svn: 307838
2017-07-12 20:18:55 +00:00
Dominic Chen 35610d21b2 [analyzer] Support generating and reasoning over more symbolic constraint types
Summary: Generate more IntSymExpr constraints, perform SVal simplification for IntSymExpr and SymbolCast constraints, and create fully symbolic SymExprs

Reviewers: zaks.anna, dcoughlin, NoQ, xazax.hun

Subscribers: mgorny, cfe-commits

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

llvm-svn: 307833
2017-07-12 19:37:57 +00:00
Petr Hosek 8847dcbd6b [Driver] Update Fuchsia driver path handling
Several improvements to the Fuchsia driver:

* Search for C++ library headers and libraries in directories that
are part of the toolchain distribution rather than sysroot.

* Use LLVM support utlities to construct paths to make sure the driver
is also usable on Windows for cross-compiling.

* Change the driver to inherit directly from ToolChain rather than
Generic_GCC since we don't need any of the GCC related multilib logic.

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

llvm-svn: 307830
2017-07-12 19:15:51 +00:00
Alexey Bataev 3344603f7b [OPENMP] Emit implicit taskgroup block around taskloop directives.
If taskloop directive has no associated nogroup clause, it must emitted
inside implicit taskgroup block. Runtime supports it, but we need to
generate implicit taskgroup block explicitly to support future
reductions codegen.

llvm-svn: 307822
2017-07-12 18:09:32 +00:00
Alex Lorenz ada11923fa [diagtool] Add a 'find-diagnostic-id' subcommand that converts a name of
the diagnostic to its enum value

This will be used by a script that invokes clang in a debugger and forces it
to stop when it reports a particular diagnostic.

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

llvm-svn: 307813
2017-07-12 16:41:49 +00:00
Chih-Hung Hsieh 322e8c2bc1 [clang] buildFixItInsertionLine should use Hints of the same FID and LineNo
Fix bug https://bugs.llvm.org/show_bug.cgi?id=33734

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

llvm-svn: 307809
2017-07-12 16:25:40 +00:00
Krasimir Georgiev e092634f31 [clang-format] Keep level of comment before an empty line
Summary:
This patch fixes bug https://bugs.llvm.org/show_bug.cgi?id=3313: a comment line
was aligned with the next #ifdef even in the presence of an empty line between
them.

Reviewers: djasper, klimek

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 307795
2017-07-12 15:21:43 +00:00
Alex Lorenz ff7f42e61a [libclang] Support for querying whether an enum is scoped
This commit allows checking whether an enum declaration is scoped
through libclang and clang.cindex (Python).

Patch by Johann Klähn!

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

llvm-svn: 307771
2017-07-12 11:35:11 +00:00
Alex Lorenz 4fabc97c43 Revert r307769 (Forgot to mention the name of the contributor).
llvm-svn: 307770
2017-07-12 11:34:14 +00:00
Alex Lorenz 571b8cfac9 [libclang] Support for querying whether an enum is scoped
This commit allows checking whether an enum declaration is scoped
through libclang and clang.cindex (Python).

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

llvm-svn: 307769
2017-07-12 11:31:37 +00:00
John McCall 0a2cde365a Expose some type-conversion functions as part of the IRGen ABI.
Patch by Benoit Vey!

llvm-svn: 307760
2017-07-12 07:44:17 +00:00
Matthias Gehre 351c218d15 CFG: Add CFGElement for automatic variables that leave the scope
Summary:
This mimics the implementation for the implicit destructors. The
generation of this scope leaving elements is hidden behind
a flag to the CFGBuilder, thus it should not affect existing code.

Currently, I'm missing a test (it's implicitly tested by the clang-tidy
lifetime checker that I'm proposing).
I though about a test using debug.DumpCFG, but then I would
have to add an option to StaticAnalyzer/Core/AnalyzerOptions
to enable the scope leaving CFGElement,
which would only be useful to that particular test.

Any other ideas how I could make a test for this feature?

Reviewers: krememek, jordan_rose

Subscribers: cfe-commits

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

llvm-svn: 307759
2017-07-12 07:04:19 +00:00
Richard Trieu 68fbf8563f [ODRHash] Revert r307720 to fix buildbot.
llvm-svn: 307743
2017-07-12 00:38:27 +00:00
Konstantin Zhuravlyov b0beb30fea Enhance synchscope representation (clang)
Relevant changes required for r307722.

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

llvm-svn: 307723
2017-07-11 22:23:37 +00:00
Richard Trieu 1d06f44f0f [ODRHash] Support more method types.
Hash CXXConstructorDecl and CXXDestructorDecl.  Extend the diagnostics from
CXXMethodDecl to include constructors and destructors.

llvm-svn: 307720
2017-07-11 22:10:49 +00:00
Alexey Bataev d0c03ca5cc [OPENMP] Skip BuildMemberExpr() in BuildFieldReferenceExpr(), NFC, by Kai Noda
In the OpenMP mode, we don't need to call BuildMemberExpr() only to discard its
return value. BuildDeclRefExpr() is called instead.

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

llvm-svn: 307697
2017-07-11 19:43:28 +00:00
Alexey Bataev bcd0ae0617 [OPENMP] Add restriction for reduction clause in taskloop directives.
Added checks for the reduction clauses in the taskloop directives:
1. Only addressable items must be used in reduction clauses.
2. Reduction clauses cannot be used with nogroup clauses.

llvm-svn: 307693
2017-07-11 19:16:44 +00:00
Reid Kleckner ec97f3cb76 Add missing dllimport member pointer template argument test from r307446
llvm-svn: 307670
2017-07-11 16:18:05 +00:00
Joerg Sonnenberger e385cfc24d NetBSD uses soft-float by default, unless the environment is EABIHF or
GNUEABIHF.

llvm-svn: 307665
2017-07-11 15:50:48 +00:00
Joerg Sonnenberger 6683764b7b Run the preprocessor test as frontend test for NetBSD, since CC1 mode
doesn't get flags like the default target CPU. Update for test to
reflect the difference.

llvm-svn: 307664
2017-07-11 15:49:45 +00:00
Clement Courbet 43bdba4086 [ASTMatchers][NFC] integerLiteral(): Mention negative integers in
documentation.

Trying to match integerLiteral(-1) will silently fail, because an numeric
literal is always positive.
- Update the documentation to explain how to match negative numeric
  literals.
- Add a unit test.

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

llvm-svn: 307663
2017-07-11 15:45:22 +00:00
Alex Lorenz 4b9f80cc03 [ObjC] Check that a subscript methods is declared for a qualified id type
Objective-C subscript expressions report errors when a subscript method is not
declared in the base class. However, prior to this commit, qualified id types
were not checked. This commit ensures that an appropriate error is reported
when a subscript method is not declared in any of the protocols that are
included in the qualified id type.

rdar://33213924

llvm-svn: 307642
2017-07-11 10:18:35 +00:00
Alex Lorenz 9c171406c6 RecursiveASTVisitor should visit the nested name qualifiers in
a template specialisation

rdar://33123354

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

llvm-svn: 307638
2017-07-11 09:39:23 +00:00
Simon Atanasyan 3606ebf6d6 [mips] Create the correct profiling symbol on Linux MIPS
llvm-svn: 307627
2017-07-11 06:19:01 +00:00
Alexander Shaposhnikov 59d10a4cbc [analyzer] Start fixing modeling of bool based types
This is a follow up for one of 
the previous diffs https://reviews.llvm.org/D32328.
getTypeSize and with getIntWidth are not equivalent for bool 
(see https://clang.llvm.org/doxygen/ASTContext_8cpp_source.html#l08444),
this causes a number of issues
(for instance, if APint X representing a bool is created 
with the wrong bit width then X is not comparable against Min/Max
(because of the different bit width), that results in crashes 
(triggered asserts) inside assume* methods), 
for examples see the newly added test cases.

Test plan: make check-all

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

llvm-svn: 307604
2017-07-11 00:30:14 +00:00
Sean Callanan 3136a4d5d6 [clang-import-test] Test that enumerators and their values are found.
llvm-svn: 307603
2017-07-11 00:29:37 +00:00
Sean Callanan 6d5650252f [clang-import-test] Committed missed update to clang-import-test.cpp
I didn't commit clang-import-test.cpp in r307600, but it had some
changes that were part of https://reviews.llvm.org/D35220

Corrected that now.

llvm-svn: 307602
2017-07-11 00:27:57 +00:00
Sean Callanan 17c8c20d7e clang-import-test had some dead code. I did the following to eliminate it:
- eliminated error handling for the indirect CompilerInstance, which should 
  never generate an error as it is created;
- added a new test for direct importation; and
- removed an unused implementation of the CompleteType() API.

This brings clang-import-test.cpp and ExternalASTMerge.cpp back to 100% 
coverage on all metrics measured by DLLVM_BUILD_INSTRUMENTED_COVERAGE.

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

llvm-svn: 307600
2017-07-10 23:47:00 +00:00
Eric Christopher 50daf5fbbb IsSpecialLong was only ever set in release mode as all of the uses are in asserts. Wrap in ifndef NDEBUG.
llvm-svn: 307594
2017-07-10 21:28:54 +00:00
Dehao Chen 5f83d0e96b Use DenseMap instead std::map for GVSummaryMapTy
Summary: Frontend change for https://reviews.llvm.org/D35148

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, cfe-commits

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

llvm-svn: 307584
2017-07-10 20:31:37 +00:00
Eric Liu 159094a2db Avoid white spaces in file names. NFC
Summary: White spaces in file names are causing Phabricator/SVN to crash.

Reviewers: bkramer

Subscribers: bogner, cfe-commits

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

llvm-svn: 307551
2017-07-10 16:05:48 +00:00
Zvi Rackover 064f00061b X86 Intrinsics: _bit_scan_forward should not be under #ifdef __RDRND__
Summary:
The _bit_scan_forward and _bit_scan_reverse intrinsics were accidentally
masked under the preprocessor checks that prune intrinsics definitions for the
benefit of faster compile-time on Windows. This patch moves the
definitons out of that region.

Fixes pr33722

Reviewers: craig.topper, aaboud, thakis

Reviewed By: craig.topper

Subscribers: cfe-commits

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

llvm-svn: 307524
2017-07-10 07:13:56 +00:00
Eric Fiselier 625cc0ecaf Remove incorrect FIXME comment; the FIXME was addressed before the changes were committed
llvm-svn: 307515
2017-07-10 02:59:26 +00:00
Eric Fiselier bf166cea71 Remove non-ascii characters introduced in r307513
llvm-svn: 307514
2017-07-10 02:52:34 +00:00
Eric Fiselier 166c6e6f05 [coroutines] Include the implicit object parameter type when looking up coroutine_traits for member functions.
This patch was originally from Toby Allsopp, but I hijacked it and
fixed it up with his permission.

llvm-svn: 307513
2017-07-10 01:27:22 +00:00
Raphael Isemann 4eac9f0545 [analyzer] Faster hashing of subsequences in CompoundStmts.
Summary: This patches improves the hashing subsequences in CompoundStmts by incrementally hashing all subsequences with the same starting position. This results in a reduction of the time for this constraint while running over SQLite from 1.10 seconds to 0.55 seconds (-50%).

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: cfe-commits, xazax.hun, v.g.vassilev

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

llvm-svn: 307509
2017-07-09 21:14:36 +00:00
Craig Topper b2f8b311d1 [X86] Add more feature flag bit defines to cpuid.h for gcc compatibility.
llvm-svn: 307507
2017-07-09 17:43:11 +00:00
Craig Topper f6e8408a11 [X86] Add __get_cpuid_count to cpuid.h. Update __get_cpuid to check the maximum level support before accessing the leaf. Rename level to leaf everywhere.
This matches gcc behavior.

llvm-svn: 307506
2017-07-09 17:43:10 +00:00
Raphael Isemann 983f7915ac [analyzer] Make StmtDataCollector part of the CloneDetection API
Summary: We probably want to use this useful templates in other pieces of code (e.g. the one from D34329), so we should make this public.

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: cfe-commits, xazax.hun, v.g.vassilev, johannes

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

llvm-svn: 307501
2017-07-09 15:56:39 +00:00
Yaxun Liu 7bce64242f Fix build failure with gcc about mixing enum and non-enum
llvm-svn: 307483
2017-07-08 19:13:41 +00:00
Yuka Takahashi 33cf63b7f2 [Bash-autocompletion] Auto complete cc1 options if -cc1 is specified
Summary:
We don't want to autocomplete flags whose Flags class has `NoDriverOption` when argv[1] is not `-cc1`.

Another idea for this implementation is to make --autocomplete a cc1
option and handle it in clang Frontend, by porting --autocomplete
handler from Driver to Frontend, so that we can handle Driver options
and CC1 options in unified manner.

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

llvm-svn: 307479
2017-07-08 17:48:59 +00:00
Yuka Takahashi 15309d1ce1 [Bash-autocompletion] Fix a bug that -foo=bar doesn't handled properly
Summary: Fixed a bug that -foo=bar wasn't handled properly on old version of bash.

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

llvm-svn: 307478
2017-07-08 17:34:02 +00:00
Benjamin Kramer 6fbfdec556 [CodeGen] Fold variable into assert.
Avoids warnings in Release builds.

llvm-svn: 307472
2017-07-08 14:14:57 +00:00
Yaxun Liu cbf647cc3a CodeGen: Fix address space of global variable
Certain targets (e.g. amdgcn) require global variable to stay in global or constant address
space. In C or C++ global variables are emitted in the default (generic) address space.
This patch introduces virtual functions TargetCodeGenInfo::getGlobalVarAddressSpace
and TargetInfo::getConstantAddressSpace to handle this in a general approach.

It only affects IR generated for amdgcn target.

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

llvm-svn: 307470
2017-07-08 13:24:52 +00:00
Gabor Horvath 70c671a3bf [analyzer] Fix a path in the developer manual
Patch by: Reka Nikolett Kovacs

llvm-svn: 307468
2017-07-08 08:23:52 +00:00
Richard Trieu ac6a1b6417 [ODRHash] Support FriendDecl
llvm-svn: 307458
2017-07-08 02:04:42 +00:00
Craig Topper e1ba5a3132 [X86] Move AVX512VPOPCNTDQ in __builtin_cpu_support's enum to match trunk gcc.
There are two other features before it that we don't currently support in the the frontend or backend so I left placeholders to keep the encoding correct.

I think the compiler-rt implementation of this feature is even further out of date.

llvm-svn: 307456
2017-07-08 00:47:44 +00:00
Richard Smith af10ea2055 Fix warnings introduced by r307434.
llvm-svn: 307455
2017-07-08 00:37:59 +00:00
Dehao Chen f856dbdb02 Revert r307445 as it breaks on certain platforms.
llvm-svn: 307449
2017-07-07 22:40:37 +00:00
Reid Kleckner cd016d8dc6 [MS] Don't statically initialize dllimport member function pointers
Summary:
r306137 made dllimport pointers to member functions non-constant. This
is correct because a load must be executed to resolve any dllimported
data. However, r306137 did not account for the use of dllimport member
function pointers used as template arguments.

This change re-lands r306137 with a template instantiation fix.

This fixes PR33570.

Reviewers: rnk, majnemer

Subscribers: cfe-commits

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

llvm-svn: 307446
2017-07-07 22:04:29 +00:00
Dehao Chen a3f8c80a35 Add sample PGO integration test to cover profile annotation and inlining.
Summary: The patch makes the integration test cover major sample PGO components.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: sanjoy, cfe-commits

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

llvm-svn: 307445
2017-07-07 22:01:47 +00:00
Lang Hames 86ac9182e0 Add testcase for r305850.
Accidentally left this out of the original commit.

llvm-svn: 307444
2017-07-07 21:51:11 +00:00
Dehao Chen 4a7e66a846 Enable the new PM + SamlePGO + ThinLTO testing.
Summary: This patch should be enabled after https://reviews.llvm.org/D34895

Reviewers: chandlerc, tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: sanjoy, mehdi_amini, inglorion, eraman, cfe-commits

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

llvm-svn: 307438
2017-07-07 20:53:17 +00:00
Richard Smith 1283e9868d [modules ts] Basic for module linkage.
In addition to the formal linkage rules, the Modules TS includes cases where
internal-linkage symbols within a module interface unit can be referenced from
outside the module via exported inline functions / templates. We give such
declarations "module-internal linkage", which is formally internal linkage, but
results in an externally-visible symbol.

llvm-svn: 307434
2017-07-07 20:04:28 +00:00
Craig Topper 61395176f9 [X86] Replace 'fallthrough' comments with LLVM_FALLTHROUGH.
llvm-svn: 307420
2017-07-07 18:41:09 +00:00
Martin Probst a81dd0b6eb clang-format: [JS] do not wrap after "readonly".
Summary:
Breaks after "readonly" trigger automatic semicolon insertion in field
declarations.

Reviewers: krasimir, djasper

Subscribers: klimek

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

llvm-svn: 307394
2017-07-07 13:17:10 +00:00
Alex Lorenz b249c9bcf5 Recommit [driver][macOS] Pick the system version for the
deployment target if the SDK is newer than the system

This commit reverts the revert commit r305891. Now the change from r305678
should be correct because `llvm::sys::getProcessTriple` now returns the correct
macOS version of the system after the LLVM change r307372.

Original commit message:

This commit improves the driver by making sure that it picks the system version
for the deployment target when the version of the macOS SDK is newer than the
system version.

rdar://29449467

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

llvm-svn: 307388
2017-07-07 10:41:19 +00:00
Simon Atanasyan df406d18aa [driver][mips] Pass long-calls feature flag to the MIPS backend
Check the `-mlong-calls` command line option and pass the `long-calls`
feature flag to the backend. Handling of this feature flag in the backend
needs to be implemented by a separate commit.

llvm-svn: 307386
2017-07-07 10:35:33 +00:00
Alex Lorenz 5ff6b8655a [Frontend] Verify that the bitstream is not empty before reading
the serialised diagnostics

Clang should avoid calling report_fatal_error when the file with the serialised
diagnostics is empty. This commit changes Clang's serialised diagnostic reader,
now it reports an appropriate error instead of crashing.

rdar://31939877

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

llvm-svn: 307384
2017-07-07 10:25:12 +00:00
Olivier Goffart 67049f034d Fix crash parsing invalid code
The code in the test caused a crash with this backtrace:

 RecordLayoutBuilder.cpp:2934: const clang::ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const clang::RecordDecl *) const: Assertion `!D->isInvalidDecl() && "Cannot get layout of invalid decl!"' failed.
 [...]
 #7 0x00007f63963d845a __assert_fail_base (/usr/lib/libc.so.6+0x2c45a)
 #8 0x00007f63963d84d2 (/usr/lib/libc.so.6+0x2c4d2)
 #9 0x00007f63937a0631 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2935:3
 #10 0x00007f63937a1ad5 getFieldOffset(clang::ASTContext const&, clang::FieldDecl const*) /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:3057:37
 #11 0x00007f6391869f14 clang::Sema::RefersToMemberWithReducedAlignment(clang::Expr*, llvm::function_ref<void (clang::Expr*, clang::RecordDecl*, clang::FieldDecl*, clang::CharUnits)>) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12139:23
 #12 0x00007f639186a2f8 clang::Sema::CheckAddressOfPackedMember(clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12190:1
 #13 0x00007f6391a7a81c clang::Sema::CheckAddressOfOperand(clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11111:10
 #14 0x00007f6391a7f5d2 clang::Sema::CreateBuiltinUnaryOp(clang::SourceLocation, clang::UnaryOperatorKind, clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11932:18

Fixing by bailing out for invalid classes.

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

llvm-svn: 307371
2017-07-07 09:38:59 +00:00
Alex Lorenz cdd596fcde [ObjC] Avoid the -Wunguarded-availability warnings for protocol
requirements in protocol/class/category declarations

The unguarded availability warnings in the protocol requirements of a protocol
/class/category declaration can be avoided. This matches the behaviour of
Swift's diagnostics. The warnings for deprecated/unavailable protocols are
preserved.

rdar://33156429

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

llvm-svn: 307368
2017-07-07 09:15:29 +00:00
Evgeniy Stepanov 760a261e1e Update Cross-DSO CFI documentation.
Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 307341
2017-07-07 00:48:12 +00:00
Sterling Augustine 6b030ab461 This call-site should have been updated as part of D34304.
Summary: Use an argument adjuster to preserve behavior inadvertantly changed by D34304.

Reviewers: klimek

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

llvm-svn: 307329
2017-07-06 22:47:19 +00:00
David L. Jones d4053fb2ec Change remaining references to lit.util.capture to use subprocess.check_output.
Summary:
The capture() function was removed in r306625. This should fix PGO breakages
reported by Michael Zolotukhin.

Reviewers: mzolotukhin

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 307320
2017-07-06 21:46:47 +00:00
Richard Smith 1f2bd35b24 Reject attempts to build a module without -fmodules, rather than silently doing weird things.
llvm-svn: 307316
2017-07-06 21:05:56 +00:00
Sterling Augustine 1cda1d76b1 Allow CompilerInvocations to generate .d files.
Summary:
Most clang tools should ignore the -M
family of options because one wouldn't want them
to generate a new dependency (.d) file. However,
some tools may want this dependency file. This
patch creates a mechanism for them to do this.

This implementation just plumbs a boolean down
several layers of calls. Each of the modified calls
has several call sites, and so a single member
variable or new API entry point won't work.

An alternative would be to write a function to filter
the -M family of arguments out of CC1Args, and have
each caller call that function by hand before calling
newInvocation, Invocation::run, or buildAstFromCodeWithArgs.
This is a more complicated and error-prone solution.
Why burden all the callers to remember to use
this function?

But I could rewrite this patch to use that method if
that is deemed more appropriate.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 307315
2017-07-06 21:02:52 +00:00
Mandeep Singh Grang a2baff0851 [Objective-C] Fix non-determinism in clang
Summary: Iteration of the unordered Ivars causes objc-modern-metadata-visibility.mm (uncovered by reverse iterating SmallPtrSet).

Reviewers: dblaikie, davide, rsmith

Reviewed By: dblaikie

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 307296
2017-07-06 18:49:57 +00:00
Sjoerd Meijer 98ee78578b This reverts r305820 (ARMv.2-A FP16 vector intrinsics) because it shows
problems in testing, see comments in D34161 for some more details.
A fix is in progres in D35011, but a revert seems better now as the fix will
probably take some more time to land.

llvm-svn: 307277
2017-07-06 16:37:31 +00:00
Gheorghe-Teodor Bercea f0f29608d0 [OpenMP] Extend CLANG target options with device offloading kind.
Summary: Pass the type of the device offloading when building the tool chain for a particular target architecture. This is required when supporting multiple tool chains that target a single device type. In our particular use case, the OpenMP and CUDA tool chains will use the same ```addClangTargetOptions ``` method. This enables the reuse of common options and ensures control over options only supported by a particular tool chain.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, jlebar, hfinkel, tstellar, Hahnfeld

Reviewed By: hfinkel

Subscribers: jgravelle-google, aheejin, rengolin, jfb, dschuff, sbc100, cfe-commits

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

llvm-svn: 307272
2017-07-06 16:22:21 +00:00
Gheorghe-Teodor Bercea 6a5df72a82 [OpenMP] Customize CUDA-based tool chain selection
Summary: This patch provides a generic way of selecting CUDA based tool chains as host-device pairs.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: rengolin, cfe-commits

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

llvm-svn: 307271
2017-07-06 16:08:15 +00:00
Krasimir Georgiev 8fc2967a6a [clang-format] Add TextProto language name, NFC
llvm-svn: 307264
2017-07-06 14:39:39 +00:00
Krasimir Georgiev 47f21ef2af [clang-format] Add space between a message field key and the opening bracket in proto messages
Summary:
This patch updates the formatting of message fields of type `a{...}` to `a {...}`
for proto messages.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 307261
2017-07-06 13:58:29 +00:00
Egor Churaev ccc5e04461 [OpenCL] Test on image access modifiers and image type can only be a type of a function argument.
Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits, bader

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

llvm-svn: 307238
2017-07-06 07:06:11 +00:00