]> granicus.if.org Git - clang/log
clang
7 years agoRe-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module...
Peter Collingbourne [Thu, 4 May 2017 18:03:25 +0000 (18:03 +0000)]
Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."
with a fix for the clang backend.

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

7 years ago[Tooling] add a createReplacement overload for StringRef
Alexander Kornienko [Thu, 4 May 2017 15:34:06 +0000 (15:34 +0000)]
[Tooling] add a createReplacement overload for StringRef

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

7 years agoclang-format: [JS] exponentiation operator
Martin Probst [Thu, 4 May 2017 15:04:04 +0000 (15:04 +0000)]
clang-format: [JS] exponentiation operator

Summary: While its precedence should be higher than multiplicative, LLVM does not have a level for that, so for the time being just treat it as multiplicative.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoDiagnosticsEngine should clear DelayedDiagID before reporting the
Alex Lorenz [Thu, 4 May 2017 13:56:51 +0000 (13:56 +0000)]
DiagnosticsEngine should clear DelayedDiagID before reporting the
delayed diagnostic

This fix avoids an infinite recursion that was uncovered in one of our internal
tests by r301992. The testcase is the most reduced version of that
auto-generated test.

This is an improved version of the reverted commit r302037. The previous fix
actually managed to expose another subtle bug whereby `fatal_too_many_errors`
error was reported twice, with the second report setting the
`FatalErrorOccurred` flag. That prevented the notes that followed the diagnostic
the caused `fatal_too_many_errors` to be emitted. This commit ensures that notes
that follow `fatal_too_many_errors` but that belong to the diagnostic that
caused `fatal_too_many_errors` won't be emitted by setting the
`FatalErrorOccurred` when emitting `fatal_too_many_errors`.

rdar://31962618

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

7 years agoAdd support of the next Ubuntu (Ubuntu 17.10 - Artful Aardvark)
Sylvestre Ledru [Thu, 4 May 2017 12:46:38 +0000 (12:46 +0000)]
Add support of the next Ubuntu (Ubuntu 17.10 - Artful Aardvark)

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

7 years agoRevert "IR: Use pointers instead of GUIDs to represent edges in the module summary...
Eric Liu [Thu, 4 May 2017 12:05:40 +0000 (12:05 +0000)]
Revert "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."

This reverts commit r302108.

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

7 years ago[Index] The relation between the declarations in template
Alex Lorenz [Thu, 4 May 2017 10:42:06 +0000 (10:42 +0000)]
[Index] The relation between the declarations in template
specializations that 'override' declarations in the base template should use
the 'specializationOf' relation instead of 'specializationOf | overrideOf'.

The indexer relations are meant to be orthogonal, so 'specializationOf' is
better than the combined relation.

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

7 years ago[ARM] ACLE Chapter 9 intrinsics
Sam Parker [Thu, 4 May 2017 08:37:59 +0000 (08:37 +0000)]
[ARM] ACLE Chapter 9 intrinsics

Implemented the remaining integer data processing intrinsics from
the ARM ACLE v2.1 spec, such as parallel arithemtic and DSP style
multiplications.

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

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

7 years ago[OpenCL] Add intel_reqd_sub_group_size attribute support
Xiuli Pan [Thu, 4 May 2017 07:31:20 +0000 (07:31 +0000)]
[OpenCL] Add intel_reqd_sub_group_size attribute support

Summary:
Add intel_reqd_sub_group_size attribute support as intel extension  cl_intel_required_subgroup_size from
https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt

Reviewers: Anastasia, bader, hfinkel, pxli168

Reviewed By: Anastasia, bader, pxli168

Subscribers: cfe-commits, yaxunl

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

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

7 years agoIR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI.
Peter Collingbourne [Thu, 4 May 2017 03:36:16 +0000 (03:36 +0000)]
IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI.

When profiling a no-op incremental link of Chromium I found that the functions
computeImportForFunction and computeDeadSymbols were consuming roughly 10% of
the profile. The goal of this change is to improve the performance of those
functions by changing the map lookups that they were previously doing into
pointer dereferences.

This is achieved by changing the ValueInfo data structure to be a pointer to
an element of the global value map owned by ModuleSummaryIndex, and changing
reference lists in the GlobalValueSummary to hold ValueInfos instead of GUIDs.
This means that a ValueInfo will take a client directly to the summary list
for a given GUID.

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

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

7 years agoAdd #pragma clang module begin/end pragmas and generate them when preprocessing a...
Richard Smith [Thu, 4 May 2017 00:29:54 +0000 (00:29 +0000)]
Add #pragma clang module begin/end pragmas and generate them when preprocessing a module.

These pragmas are intended to simulate the effect of entering or leaving a file
with an associated module. This is not completely implemented yet: declarations
between the pragmas will not be attributed to the correct module, but macro
visibility is already functional.

Modules named by #pragma clang module begin must already be known to clang (in
some module map that's either loaded or on the search path).

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

7 years ago[Driver] Update AArch64 testcase to match llvm r302078.
Ahmed Bougacha [Wed, 3 May 2017 20:34:32 +0000 (20:34 +0000)]
[Driver] Update AArch64 testcase to match llvm r302078.

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

7 years agoTests: strengthen CHECK line to avoid picking up stray path.
Tim Northover [Wed, 3 May 2017 19:20:45 +0000 (19:20 +0000)]
Tests: strengthen CHECK line to avoid picking up stray path.

A bot had "-LTO" in its working directory, which matched the regex used in this
test. Since the arg is quoted, we can exploit that instead. Still broken if
there's a path with a quote in, but I think that's pretty niche.

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

7 years ago[IR] Abstract away ArgNo+1 attribute indexing as much as possible
Reid Kleckner [Wed, 3 May 2017 18:17:31 +0000 (18:17 +0000)]
[IR] Abstract away ArgNo+1 attribute indexing as much as possible

Summary:
Do three things to help with that:
- Add AttributeList::FirstArgIndex, which is an enumerator currently set
  to 1. It allows us to change the indexing scheme with fewer changes.
- Add addParamAttr/removeParamAttr. This just shortens addAttribute call
  sites that would otherwise need to spell out FirstArgIndex.
- Remove some attribute-specific getters and setters from Function that
  take attribute list indices.  Most of these were only used from
  BuildLibCalls, and doesNotAlias was only used to test or set if the
  return value is malloc-like.

I'm happy to split the patch, but I think they are probably easier to
review when taken together.

This patch should be NFC, but it sets the stage to change the indexing
scheme to this, which is more convenient when indexing into an array:
  0: func attrs
  1: retattrs
  2...: arg attrs

Reviewers: chandlerc, pete, javed.absar

Subscribers: david2050, llvm-commits

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

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

7 years agoRevert r302037
Alex Lorenz [Wed, 3 May 2017 16:22:16 +0000 (16:22 +0000)]
Revert r302037

The commit caused the following two buildbot failures:

    Clang :: Misc/error-limit-multiple-notes.cpp
    Clang :: Misc/error-limit.c

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

7 years agoDiagnosticsEngine should clear DelayedDiagID before reporting the
Alex Lorenz [Wed, 3 May 2017 15:41:16 +0000 (15:41 +0000)]
DiagnosticsEngine should clear DelayedDiagID before reporting the
delayed diagnostic

This avoids an infinite loop that was uncovered in one of our internal tests
by r301992. The testcase is the most reduced version of that auto-generated
test.

rdar://31962618

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

7 years ago[OpenMP] Extended parse for 'always' map modifier
Carlo Bertolli [Wed, 3 May 2017 15:28:48 +0000 (15:28 +0000)]
[OpenMP] Extended parse for 'always' map modifier

https://reviews.llvm.org/D32807

This patch allows the map modifier 'always' to be separated by the map type (to, from, tofrom) only by a whitespace, rather than strictly by a comma as in current trunk.

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

7 years agoReusing an existing attribute diagnostic
Oren Ben Simhon [Wed, 3 May 2017 14:05:00 +0000 (14:05 +0000)]
Reusing an existing attribute diagnostic

In a previous patch, a new generic error diagnostic for inconsistent attributes was added.
In this commit I reuse this diagnostic for ns_returns_retained attribute check.

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

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

7 years ago[analyzer] Fix memory error bug category capitalization.
Artem Dergachev [Wed, 3 May 2017 11:47:13 +0000 (11:47 +0000)]
[analyzer] Fix memory error bug category capitalization.

It was written as "Memory Error" in most places and as "Memory error" in a few
other places, however it is the latter that is more consistent with
other categories (such as "Logic error").

rdar://problem/31718115

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

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

7 years agoUndo turning ExtBehavior into a bitfield.
Daniel Jasper [Wed, 3 May 2017 11:27:34 +0000 (11:27 +0000)]
Undo turning ExtBehavior into a bitfield.

This produces warnings that I can't explain in a GCC build:

In file included from ../tools/clang/include/clang/Lex/LexDiagnostic.h:13:0,
                 from /usr/local/google/home/djasper/llvm/tools/clang/lib/Lex/PTHLexer.cpp:19:
../tools/clang/include/clang/Basic/Diagnostic.h:219:34: warning: ‘clang::DiagnosticsEngine::DiagState::ExtBehavior’ is too small to hold all values of ‘enum class clang::diag::Severity’ [enabled by default]
     diag::Severity ExtBehavior : 4;     // Map extensions to warnings or errors?
                                  ^

While I don't think this warning makes sense, I'd like to get this back to being
warning-free. This only seems to trigger for "enum class".

Reproducer:
https://godbolt.org/g/P2ekVd

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

7 years agoFix tests after speculatable intrinsics patch
Daniel Jasper [Wed, 3 May 2017 10:04:25 +0000 (10:04 +0000)]
Fix tests after speculatable intrinsics patch

These were relying on the attribute group numbering

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

7 years agoSilences gcc's -Wnarrowing.
Daniel Jasper [Wed, 3 May 2017 07:48:27 +0000 (07:48 +0000)]
Silences gcc's -Wnarrowing.

I think this is a false positive in GCC's warning, but nonetheless, we
should try to be warning-free. Smaller reproducer (reproduces with GCC
6.3):
https://godbolt.org/g/cJuO2z

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

7 years agoRevert rL301998: "Fix a bug that -isysroot is completely ignored on Unix"
Yuka Takahashi [Wed, 3 May 2017 06:02:45 +0000 (06:02 +0000)]
Revert rL301998: "Fix a bug that -isysroot is completely ignored on Unix"

This reverts commit because it broke
sanitizer-x86_64-linux-autoconf bot and
clang-ppc64be-linux-multistage  bot.

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

7 years agoFix a bug that -isysroot is completely ignored on Unix
Yuka Takahashi [Wed, 3 May 2017 04:58:39 +0000 (04:58 +0000)]
Fix a bug that -isysroot is completely ignored on Unix

-isysroot is the flag which set the system root directory.
This bug report https://bugs.llvm.org//show_bug.cgi?id=11503
shows that -isysroot is not handled at all on Unix, so fixed this bug.

After this diff, I could get this result https://pastebin.com/TeCmn9mj .

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

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

7 years agoFix tests after speculatable intrinsics patch
Matt Arsenault [Wed, 3 May 2017 03:04:40 +0000 (03:04 +0000)]
Fix tests after speculatable intrinsics patch

These were relying on the attribute group numbering

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

7 years ago[sanitizer-coverage] add a deprecation warning to the old sanitizer-coverage flag...
Kostya Serebryany [Wed, 3 May 2017 01:27:28 +0000 (01:27 +0000)]
[sanitizer-coverage] add a deprecation warning to the old sanitizer-coverage flag combinations

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

7 years ago[modules] Round-trip -Werror flag through explicit module build.
Richard Smith [Wed, 3 May 2017 00:28:49 +0000 (00:28 +0000)]
[modules] Round-trip -Werror flag through explicit module build.

The intent for an explicit module build is that the diagnostics produced within
the module are those that were configured when the module was built, not those
that are enabled within a user of the module. This includes diagnostics that
don't actually show up until the module is used (for instance, diagnostics
produced during template instantiation and weird cases like -Wpadded).

We serialized and restored the diagnostic state for individual warning groups,
but previously did not track the state for flags like -Werror and -Weverything,
which are implemented as separate bits rather than as part of the diagnostics
mapping information.

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

7 years ago[ODRHash] Add support for array and decayed types, and parameter names and types.
Richard Trieu [Tue, 2 May 2017 23:58:52 +0000 (23:58 +0000)]
[ODRHash] Add support for array and decayed types, and parameter names and types.

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

7 years ago[ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)
Vedant Kumar [Tue, 2 May 2017 23:46:56 +0000 (23:46 +0000)]
[ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)

Currently, ubsan emits overflow checks for arithmetic that is known to
be safe at compile-time, e.g:

  1 + 1 => CheckedAdd(1, 1)

This leads to breakage when using the __builtin_prefetch intrinsic. LLVM
expects the arguments to @llvm.prefetch to be constant integers, and
when ubsan inserts unnecessary checks on the operands to the intrinsic,
this contract is broken, leading to verifier failures (see PR32874).

Instead of special-casing __builtin_prefetch for ubsan, this patch fixes
the underlying problem, i.e that clang currently emits unnecessary
overflow checks.

Testing: I ran the check-clang and check-ubsan targets with a stage2,
ubsan-enabled build of clang. I added a regression test for PR32874, and
some extra checking to make sure we don't regress runtime checking for
unsafe arithmetic. The existing ubsan-promoted-arithmetic.cpp test also
provides coverage for this change.

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

7 years agoRe-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of Attribute...
Reid Kleckner [Tue, 2 May 2017 22:07:37 +0000 (22:07 +0000)]
Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"

This time, I fixed, built, and tested clang.

This reverts r301712.

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

7 years ago[NFC] Add original test that triggered crash post r301735
Faisal Vali [Tue, 2 May 2017 21:02:46 +0000 (21:02 +0000)]
[NFC] Add original test that triggered crash post r301735
- this is added just for completeness sake (though the general case should be represented by the test added in the revision to that patch:  https://reviews.llvm.org/rL301972 )

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

7 years agoFix PR32831 (Try Again): 'this' capture while instantiating generic lambda call opera...
Faisal Vali [Tue, 2 May 2017 20:56:34 +0000 (20:56 +0000)]
Fix PR32831 (Try Again): 'this' capture while instantiating generic lambda call operator specialization

When computing the appropriate cv-qualifiers for the 'this' capture, we have to examine each enclosing lambda - but when using the FunctionScopeInfo stack we have to ensure that the lambda below (outer) is the decl-context of the closure-class of the current lambda.

https://bugs.llvm.org/show_bug.cgi?id=32831

This patch was initially committed here: https://reviews.llvm.org/rL301735
Then reverted here: https://reviews.llvm.org/rL301916

The issue with the original patch was a failure to check that the closure type has been created within the LambdaScopeInfo before querying its DeclContext - instead of just assuming it has (silly!).  A reduced example such as this highlights the problem:
  struct X {
     int data;
     auto foo() { return [] { return [] -> decltype(data) { return 0; }; }; }
  };

When 'data' within decltype(data) tries to determine the type of 'this', none of the LambdaScopeInfo's have their closure types created at that point.

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

7 years ago[Sema] Update function doc; NFC
George Burgess IV [Tue, 2 May 2017 20:24:56 +0000 (20:24 +0000)]
[Sema] Update function doc; NFC

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

7 years agoSimplify some va_start checking logic
Reid Kleckner [Tue, 2 May 2017 20:10:03 +0000 (20:10 +0000)]
Simplify some va_start checking logic

Combine the logic doing the ms_abi/sysv_abi checks into one function so
that each check and its logical opposite are near each other. Now we
don't need two Sema entry points for MS va_start and regular va_start.

Refactor the code that checks if the va_start caller is a function,
block, or obj-c method. We do this in three places, and they are all
buggy for variadic lambdas (PR32737). After this change, I have one
place to apply the functional fix.

NFC

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

7 years agoRevert r301822 (and dependent r301825), which tried to improve the
Daniel Jasper [Tue, 2 May 2017 19:21:42 +0000 (19:21 +0000)]
Revert r301822 (and dependent r301825), which tried to improve the
handling of constexprs with unknown bounds.

This triggers a corner case of the language where it's not yet clear
whether this should be an error:

  struct A {
    static void *const a[];
    static void *const b[];
  };
  constexpr void *A::a[] = {&b[0]};
  constexpr void *A::b[] = {&a[0]};

When discovering the initializer for A::a, the bounds of A::b aren't known yet.
It is unclear whether warning about errors should be deferred until the end of
the translation unit, possibly resolving errors that can be resolved. In
practice, the compiler can know the bounds of all arrays in this example.

Credits for reproducers and explanation go to Richard Smith. Richard, please
add more info in case my explanation is wrong.

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

7 years agoRevert "[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin"
Vedant Kumar [Tue, 2 May 2017 18:51:41 +0000 (18:51 +0000)]
Revert "[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin"

This reverts commit r300295.

It's no longer true, print_stacktrace=1 is supported on Darwin/Windows
as of r301839.

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

7 years ago[CodeGen] remove/fix checks that will fail when r301923 is recommitted
Sanjay Patel [Tue, 2 May 2017 15:20:18 +0000 (15:20 +0000)]
[CodeGen] remove/fix checks that will fail when r301923 is recommitted

Don't test the optimizer as part of front-end verification.

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

7 years agoRevert r301735 (and subsequent r301786).
Daniel Jasper [Tue, 2 May 2017 12:38:27 +0000 (12:38 +0000)]
Revert r301735 (and subsequent r301786).

It leads to clang crashing, e.g. on this short code fragment (added to
test/SemaCXX/warn-thread-safety-parsing.cpp):

  class SomeClass {
  public:
    void foo() {
      auto l = [this] { auto l = [] EXCLUSIVE_LOCKS_REQUIRED(mu_) {}; };
    }
    Mutex mu_;
  };

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

7 years ago[analyzer] Detect bad free of function pointers
Daniel Marjamaki [Tue, 2 May 2017 11:46:12 +0000 (11:46 +0000)]
[analyzer] Detect bad free of function pointers

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

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

7 years agoRemove leftover test expectation from rL301902.
Emilio Cobos Alvarez [Tue, 2 May 2017 09:57:30 +0000 (09:57 +0000)]
Remove leftover test expectation from rL301902.

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

7 years ago[libclang] Revert rL301328 and add tests for the regressions introduced.
Emilio Cobos Alvarez [Tue, 2 May 2017 08:32:15 +0000 (08:32 +0000)]
[libclang] Revert rL301328 and add tests for the regressions introduced.

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

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

7 years agoclang/test/Modules/diag-flags.cpp: Appease targeting *-win32 with explicit triple...
NAKAMURA Takumi [Tue, 2 May 2017 05:12:55 +0000 (05:12 +0000)]
clang/test/Modules/diag-flags.cpp: Appease targeting *-win32 with explicit triple. Fixes r301846.

MicrosoftRecordLayoutBuilder doesn't have ability of -Wpadded.

FIXME: Would other diag be available here?

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

7 years agoRevert r301785 (and r301787) because they caused PR32864.
Nick Lewycky [Tue, 2 May 2017 01:06:16 +0000 (01:06 +0000)]
Revert r301785 (and r301787) because they caused PR32864.

The fix is that ExprEvaluatorBase::VisitInitListExpr should handle transparent exprs instead of exprs with one element. Fixing that uncovers one testcase failure because the AST for "constexpr _Complex float test2 = {1};" is wrong (the _Complex prvalue should not be const-qualified), and a number of test failures in test/OpenMP where the captured stmt contains an InitListExpr that is in syntactic form.

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

7 years ago[sanitizer-coverage] update the SanitizerCoverage docs to reflect the current state
Kostya Serebryany [Tue, 2 May 2017 00:32:57 +0000 (00:32 +0000)]
[sanitizer-coverage] update the SanitizerCoverage docs to reflect the current state

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

7 years agoNew file missed from r301846.
Richard Smith [Mon, 1 May 2017 22:11:08 +0000 (22:11 +0000)]
New file missed from r301846.

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

7 years agoFix initial diagnostic state setup for an explicit module with no diagnostic pragmas.
Richard Smith [Mon, 1 May 2017 22:10:47 +0000 (22:10 +0000)]
Fix initial diagnostic state setup for an explicit module with no diagnostic pragmas.

If a file has no diagnostic pragmas, we build its diagnostic state lazily, but
in this case we never set up the root state to be the diagnostic state in which
the module was originally built, so the diagnostic flags for files in the
module with no diagnostic pragmas were incorrectly based on the user of the
module rather than the diagnostic state when the module was built.

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

7 years agoPut back REQUIRES: system-darwin to fix asan bot.
Richard Smith [Mon, 1 May 2017 21:49:54 +0000 (21:49 +0000)]
Put back REQUIRES: system-darwin to fix asan bot.

These tests do not appear to be Darwin-specific, and this REQUIRES: appears to
be hiding a real bug; this change is just restoring the prior state to get the
buildbots happy again while we investigate. (The system-darwin requirement is
covered by PR32851.)

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

7 years agoObject: Remove ModuleSummaryIndexObjectFile class.
Peter Collingbourne [Mon, 1 May 2017 20:42:32 +0000 (20:42 +0000)]
Object: Remove ModuleSummaryIndexObjectFile class.

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

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

7 years agoSilence unused variable warning. NFC.
Benjamin Kramer [Mon, 1 May 2017 20:00:23 +0000 (20:00 +0000)]
Silence unused variable warning. NFC.

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

7 years ago[sanitizer-coverage] add a deprecation note to coverage_direct=1
Kostya Serebryany [Mon, 1 May 2017 19:52:01 +0000 (19:52 +0000)]
[sanitizer-coverage] add a deprecation note to coverage_direct=1

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

7 years agoImprove handling of arrays of unknown bound in constant expressions.
Richard Smith [Mon, 1 May 2017 18:49:04 +0000 (18:49 +0000)]
Improve handling of arrays of unknown bound in constant expressions.

Do not spuriously reject constexpr functions that access elements of an array
of unknown bound; this may later become valid once the bound is known. Permit
array-to-pointer decay on such arrays, but disallow pointer arithmetic (since
we do not know whether it will have defined behavior).

The standard is not clear on how this should work, but this seems to be a
decent answer.

Patch by Robert Haberlach!

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

7 years agoAdapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC
Sanjoy Das [Mon, 1 May 2017 17:08:00 +0000 (17:08 +0000)]
Adapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC

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

7 years agoRelax testcase to fix a PS4 buildbot failure.
Adrian Prantl [Mon, 1 May 2017 15:49:40 +0000 (15:49 +0000)]
Relax testcase to fix a PS4 buildbot failure.

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

7 years agoThe -coverage-file flag was removed in r280306, and this piece was missed; NFC.
Aaron Ballman [Mon, 1 May 2017 13:05:04 +0000 (13:05 +0000)]
The -coverage-file flag was removed in r280306, and this piece was missed; NFC.

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

7 years agoRemove unneeded struct; NFC
Sanjoy Das [Mon, 1 May 2017 06:12:13 +0000 (06:12 +0000)]
Remove unneeded struct; NFC

Summary:
Unless I'm missing something, the DeferredGlobal struct's GV field is
unused, removing which makes the struct itself trivial.

Reviewers: rafael, chandlerc

Subscribers: mcrosier, llvm-commits

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

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

7 years agoFix test that was incorrected merged between patches.
Nick Lewycky [Mon, 1 May 2017 02:20:06 +0000 (02:20 +0000)]
Fix test that was incorrected merged between patches.

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

7 years agoFix line endings (dos -> unix) and clang-format while I'm here
David Blaikie [Mon, 1 May 2017 02:11:39 +0000 (02:11 +0000)]
Fix line endings (dos -> unix) and clang-format while I'm here

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

7 years agoHandle expressions with non-literal types like ignored expressions if we are supposed...
Nick Lewycky [Mon, 1 May 2017 02:03:23 +0000 (02:03 +0000)]
Handle expressions with non-literal types like ignored expressions if we are supposed to continue evaluating them.

Also fix a crash casting a derived nullptr to a virtual base.

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

7 years agoutils: Silence -Wpedantic warning
Saleem Abdulrasool [Mon, 1 May 2017 00:26:59 +0000 (00:26 +0000)]
utils: Silence -Wpedantic warning

llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp:1673:67: warning: default argument specified for lambda parameter [-Wpedantic]
                    const Record *Constraint = nullptr) {
                                               ^~~~~~~

Found by gcc 5.4.0.

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

7 years ago[X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)
Simon Pilgrim [Sat, 29 Apr 2017 17:17:06 +0000 (17:17 +0000)]
[X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)

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

7 years agoRemove Sema::CheckForIntOverflow, and instead check all full-expressions.
Nick Lewycky [Sat, 29 Apr 2017 09:33:46 +0000 (09:33 +0000)]
Remove Sema::CheckForIntOverflow, and instead check all full-expressions.

CheckForIntOverflow used to implement a whitelist of top-level expressions to
send to the constant expression evaluator, which handled many more expressions
than the CheckForIntOverflow whitelist did.

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

7 years agoFix PR32831: 'this capture while instantiating generic lambda call operator specializ...
Faisal Vali [Sat, 29 Apr 2017 03:49:17 +0000 (03:49 +0000)]
Fix PR32831: 'this capture while instantiating generic lambda call operator specialization

When computing the appropriate cv-qualifiers for the 'this' capture, we have to examine each enclosing lambda - but when using the FunctionScopeInfo stack we have to ensure that the lambda below (outer) is the decl-context of the closure-class of the current lambda.

https://bugs.llvm.org/show_bug.cgi?id=32831

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

7 years agoRemove some apparently-unnecessary 'REQUIRES: system-darwin' from tests.
Richard Smith [Sat, 29 Apr 2017 01:38:29 +0000 (01:38 +0000)]
Remove some apparently-unnecessary 'REQUIRES: system-darwin' from tests.

Let's see if any buildbots actually have trouble with these. (They at least pass on Linux.)

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

7 years agoFix "REQUIRES: system-darwin" failing tests after r301725.
Richard Smith [Sat, 29 Apr 2017 01:29:44 +0000 (01:29 +0000)]
Fix "REQUIRES: system-darwin" failing tests after r301725.

Also remove the apparently-unneeded REQUIRES (the tests also pass on at least
Linux, and don't appear to have anything Darwin-specific in them).

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

7 years agoPR26771: don't forget the " 2" (returning from #included file) linemarker after inclu...
Richard Smith [Sat, 29 Apr 2017 00:54:03 +0000 (00:54 +0000)]
PR26771: don't forget the " 2" (returning from #included file) linemarker after including an empty file with -frewrite-includes.

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

7 years agoRemove unused, empty test directories.
Richard Smith [Sat, 29 Apr 2017 00:46:27 +0000 (00:46 +0000)]
Remove unused, empty test directories.

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

7 years agoAdd pragma to perform module import and use it in -E output.
Richard Smith [Sat, 29 Apr 2017 00:34:47 +0000 (00:34 +0000)]
Add pragma to perform module import and use it in -E output.

Many of our supported configurations support modules but do not have any
first-class syntax to perform a module import. This leaves us with a problem:
there is no way to represent the expansion of a #include that imports a module
in the -E output for such languages. (We don't want to just leave it as a
#include because that requires the consumer of the preprocessed source to have
the same file system layout and include paths as the creator.)

This patch adds a new pragma:

  #pragma clang module import MODULE.NAME.HERE

that imports a module, and changes -E and -frewrite-includes to use it when
rewriting a #include that maps to a module import. We don't make any attempt
to use a native language syntax import if one exists, to get more consistent
output. (If in the future, @import and #include have different semantics in
some way, the pragma will track the #include semantics.)

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

7 years agoObjCBoxedExpr can't be evaluated by the constant expression evaluator.
Nick Lewycky [Sat, 29 Apr 2017 00:07:27 +0000 (00:07 +0000)]
ObjCBoxedExpr can't be evaluated by the constant expression evaluator.

A boxed expression evaluates its subexpr and then calls an objc method to transform it into another value with pointer type. The objc method can never be constexpr and therefore this expression can never be evaluated. Fixes a miscompile boxing expressions with side-effects.

Also make ObjCBoxedExpr handling a normal part of the expression evaluator instead of being the only case besides full-expression where we check for integer overflow.

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

7 years agoAdapt to LLVM API change (DINamespace no longer takes line/file info).
Adrian Prantl [Fri, 28 Apr 2017 22:25:53 +0000 (22:25 +0000)]
Adapt to LLVM API change (DINamespace no longer takes line/file info).

rdar://problem/17484998
https://reviews.llvm.org/D32648

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

7 years ago[ODRHash] Add testcase with different paramter names. NFC
Richard Trieu [Fri, 28 Apr 2017 22:03:28 +0000 (22:03 +0000)]
[ODRHash] Add testcase with different paramter names.  NFC

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

7 years agoEnable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.
David Blaikie [Fri, 28 Apr 2017 20:50:25 +0000 (20:50 +0000)]
Enable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.

Since -gsplit-dwarf is specified on a backend compile (in ThinLTO
parlance) it isn't passed during the frontend compile (because no ELF
object/dwo file is produced then), yet the -fno-split-dwarf-inlining
value needs to be encoded in the LLVM DebugInfo metadata to have
effect...

So let it be specified & it'll be silently ignored if -gsplit-dwarf
isn't used in the end, otherwise it'll be used on a per-cu basis
depending on where it's specified in the frontend compile actions.

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

7 years ago[CodeGen][ObjC] Don't retain captured Objective-C pointers at block
Akira Hatanaka [Fri, 28 Apr 2017 18:50:57 +0000 (18:50 +0000)]
[CodeGen][ObjC] Don't retain captured Objective-C pointers at block
creation that are const-qualified.

When a block captures an ObjC object pointer, clang retains the pointer
to prevent prematurely destroying the object the pointer points to
before the block is called or copied.

When the captured object pointer is const-qualified, we can avoid
emitting the retain/release pair since the pointer variable cannot be
modified in the scope in which the block literal is introduced.

For example:

void test(const id x) {
    callee(^{ (void)x; });
}

This patch implements that optimization.

rdar://problem/28894510

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

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

7 years ago[DOXYGEN] Minor improvements in doxygen comments.
Ekaterina Romanova [Fri, 28 Apr 2017 16:45:39 +0000 (16:45 +0000)]
[DOXYGEN] Minor improvements in doxygen comments.

- I removed doxygen comments for the intrinsics that "alias" the other existing documented intrinsics and that only sligtly differ in spelling (single underscores vs. double underscores).
 #define _tzcnt_u16(a)     (__tzcnt_u16((a)))

It will be very hard to keep the documentation for these "aliases" in sync with the documentation for the intrinsics they alias to. Out of sync documentation will be more confusing than no documentation.

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

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

7 years ago[libclang] Expose some target information via the C API.
Emilio Cobos Alvarez [Fri, 28 Apr 2017 15:56:39 +0000 (15:56 +0000)]
[libclang] Expose some target information via the C API.

This allows users to query the target triple and target pointer width, which
would make me able to fix https://github.com/servo/rust-bindgen/issues/593 and
other related bugs in an elegant way (without having to manually parse the
target triple in the command line arguments).

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

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

7 years agoUse the -Wunknown-warning-option group for the "unknown warning group"
Alex Lorenz [Fri, 28 Apr 2017 14:45:25 +0000 (14:45 +0000)]
Use the -Wunknown-warning-option group for the "unknown warning group"
diagnostic in #pragma diagnostic

This matches the warning group that's specified for the unknown warning options
that are passed-in as command line arguments.

rdar://29526025

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

7 years ago[Sema] Avoid an invalid redefinition error that was presented for
Alex Lorenz [Fri, 28 Apr 2017 12:30:05 +0000 (12:30 +0000)]
[Sema] Avoid an invalid redefinition error that was presented for
of a function whose previous definition was typo-corrected

rdar://28550928

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

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

7 years ago[X86][SSE] Add _mm_set_pd1 (PR32827)
Simon Pilgrim [Fri, 28 Apr 2017 10:28:32 +0000 (10:28 +0000)]
[X86][SSE] Add _mm_set_pd1 (PR32827)

Matches _mm_set_ps1 implementation

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

7 years ago[index] Handle vector types in USR generator
Alex Lorenz [Fri, 28 Apr 2017 09:46:36 +0000 (09:46 +0000)]
[index] Handle vector types in USR generator

rdar://25339187

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

7 years agoclang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1).
NAKAMURA Takumi [Fri, 28 Apr 2017 05:02:52 +0000 (05:02 +0000)]
clang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1).

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

7 years agoclang/test/Index/index-module.m: Relax expressions to satisfy DOSish path separator...
NAKAMURA Takumi [Fri, 28 Apr 2017 04:17:31 +0000 (04:17 +0000)]
clang/test/Index/index-module.m: Relax expressions to satisfy DOSish path separator \\, since r301597.

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

7 years agoMove functionality for handling module maps as inputs from the -emit-module
Richard Smith [Fri, 28 Apr 2017 01:49:42 +0000 (01:49 +0000)]
Move functionality for handling module maps as inputs from the -emit-module
action to the general FrontendAction infrastructure.

This permits applying -E, -ast-dump, -fsyntax-only, and so on to a module map
compilation. (The -E form is not currently especially useful yet as there's no
good way to take the output and use it to actually build a module.)

In order to support this, -cc1 now accepts -x <lang>-module-map in all cases
where it accepts -x <lang> for a language we can parse (not ir/ast). And for
uniformity, we also accept -x <lang>-header for all such languages (we used
to reject for cuda and renderscript), and -x <lang>-cpp-output for all such
languages (we used to reject for c, cl, and renderscript).

(None of these new alternatives are accepted by the driver yet, so no
user-visible changes.)

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

7 years ago[ASTImporter] Move structural equivalence context to its own file. NFCI
Bruno Cardoso Lopes [Fri, 28 Apr 2017 00:31:30 +0000 (00:31 +0000)]
[ASTImporter] Move structural equivalence context to its own file. NFCI

Create a header and impl file for the structural equivalence context.
This is to allow other users outside clang importer. NFCI

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

rdar://problem/30167717

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

7 years ago[ARCMigrate] When applying changes from remap files, disable the 'adjustRemovals...
Argyrios Kyrtzidis [Fri, 28 Apr 2017 00:25:06 +0000 (00:25 +0000)]
[ARCMigrate] When applying changes from remap files, disable the 'adjustRemovals' functionality of EditedSource

'adjustRemovals' is used to avoid situation when removing a range inadvertently causes 2 separate identifiers to get joined into one.
But it is not useful when the edits are character precise, as is the case with the remap files.

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

7 years agoUse a consistent style. NFC
George Burgess IV [Thu, 27 Apr 2017 23:59:45 +0000 (23:59 +0000)]
Use a consistent style. NFC

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

7 years ago[Modules] Improve diagnostics for incomplete umbrella
Bruno Cardoso Lopes [Thu, 27 Apr 2017 22:29:14 +0000 (22:29 +0000)]
[Modules] Improve diagnostics for incomplete umbrella

One of the -Wincomplete-umbrella warnings diagnoses when a header is present in
the directory but it's not present in the umbrella header. Currently, this
warning only happens on top level modules; any submodule using an umbrella
header does not get this warning. Fix that by also considering the submodules.

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

rdar://problem/22623686

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

7 years ago[Modules] Refactor logic for incomplete umbrella warnings. NFC
Bruno Cardoso Lopes [Thu, 27 Apr 2017 22:29:10 +0000 (22:29 +0000)]
[Modules] Refactor logic for incomplete umbrella warnings. NFC

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

7 years agoHeaders: Make the type of SIZE_MAX the same as size_t
Duncan P. N. Exon Smith [Thu, 27 Apr 2017 21:49:45 +0000 (21:49 +0000)]
Headers: Make the type of SIZE_MAX the same as size_t

size_t is usually defined as unsigned long, but on 64-bit platforms,
stdint.h currently defines SIZE_MAX using "ull" (unsigned long long).
Although this is the same width, it doesn't necessarily have the same
alignment or calling convention.  It also triggers printf warnings when
using the format flag "%zu" to print SIZE_MAX.

This changes SIZE_MAX to reuse the compiler-provided __SIZE_MAX__, and
provides similar fixes for the other integers:

  - INTPTR_MIN
  - INTPTR_MAX
  - UINTPTR_MAX
  - PTRDIFF_MIN
  - PTRDIFF_MAX
  - INTMAX_MIN
  - INTMAX_MAX
  - UINTMAX_MAX
  - INTMAX_C()
  - UINTMAX_C()

... and fixes the typedefs for intptr_t and uintptr_t to use
__INTPTR_TYPE__ and __UINTPTR_TYPE__ instead of int32_t, effectively
reverting r89224, r89226, and r89237 (r89221 already having been
effectively reverted).

We can probably also kill __INTPTR_WIDTH__, __INTMAX_WIDTH__, and
__UINTMAX_WIDTH__ in a follow-up, but I was hesitant to delete all the
per-target CHECK lines in this commit since those might serve their own
purpose.

rdar://problem/11811377

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

7 years agoPreprocessor: Suppress -Wnonportable-include-path for header maps
Duncan P. N. Exon Smith [Thu, 27 Apr 2017 21:41:51 +0000 (21:41 +0000)]
Preprocessor: Suppress -Wnonportable-include-path for header maps

If a file search involves a header map, suppress
-Wnonportable-include-path.  It's firing lots of false positives for
framework authors internally, and it's not trivial to fix.

Consider a framework called "Foo" with a main (installed) framework header
"Foo/Foo.h".  It's atypical for "Foo.h" to actually live inside a
directory called "Foo" in the source repository.  Instead, the
build system generates a header map while building the framework.
If Foo.h lives at the top-level of the source repository (common), and
the git repo is called ssh://some.url/foo.git, then the header map will
have something like:

    Foo/Foo.h -> /Users/myname/code/foo/Foo.h

where "/Users/myname/code/foo" is the clone of ssh://some.url/foo.git.

After #import <Foo/Foo.h>, the current implementation of
-Wnonportable-include-path will falsely assume that Foo.h was found in a
nonportable way, because of the name of the git clone (.../foo/Foo.h).
However, that directory name was not involved in the header search at
all.

This commit adds an extra parameter to Preprocessor::LookupFile and
HeaderSearch::LookupFile to track if the search used a header map,
making it easy to suppress the warning.  Longer term, once we find a way
to avoid the false positive, we should turn the warning back on.

rdar://problem/28863903

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

7 years agolibclang: remove unused variable.
Tim Northover [Thu, 27 Apr 2017 20:22:40 +0000 (20:22 +0000)]
libclang: remove unused variable.

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

7 years agoAdded an Importer test for in-class member initializers.
Sean Callanan [Thu, 27 Apr 2017 18:10:29 +0000 (18:10 +0000)]
Added an Importer test for in-class member initializers.

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

7 years ago[Profile] Add off-by-default -Wprofile-instr-missing warning
Vedant Kumar [Thu, 27 Apr 2017 17:30:58 +0000 (17:30 +0000)]
[Profile] Add off-by-default -Wprofile-instr-missing warning

Clang warns that a profile is out-of-date if it can't find a profile
record for any function in a TU. This warning became noisy after llvm
started allowing dead-stripping of instrumented functions.

To fix this, this patch changes the existing profile out-of-date warning
(-Wprofile-instr-out-of-date) so that it only complains about mismatched
data. Further, it introduces a new, off-by-default warning about missing
function data (-Wprofile-instr-missing).

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

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

7 years ago[libclang] Enhance clang_Cursor_isDynamicCall and clang_Cursor_getReceiverType to...
Argyrios Kyrtzidis [Thu, 27 Apr 2017 17:23:04 +0000 (17:23 +0000)]
[libclang] Enhance clang_Cursor_isDynamicCall and clang_Cursor_getReceiverType to handle ObjC property references

Also enhance clang_Cursor_getReceiverType to handle C++ method calls.

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

7 years agoclang-cl: Alias /d1reportAllClassLayout to -fdump-record-layouts (PR32826)
Hans Wennborg [Thu, 27 Apr 2017 17:19:07 +0000 (17:19 +0000)]
clang-cl: Alias /d1reportAllClassLayout to -fdump-record-layouts (PR32826)

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

7 years agoFix -Wpedantic about extra semicolons in CGStmtOpenMP.cpp
Hans Wennborg [Thu, 27 Apr 2017 17:02:25 +0000 (17:02 +0000)]
Fix -Wpedantic about extra semicolons in CGStmtOpenMP.cpp

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

7 years agoRemove leaking UnknownPragmaHandlers right after we are done with them.
Vassil Vassilev [Thu, 27 Apr 2017 16:58:33 +0000 (16:58 +0000)]
Remove leaking UnknownPragmaHandlers right after we are done with them.

The UnknownPragmaHandlers added by DoPrintPreprocessedInput conflict with the
real PragmaHandlers from clang::Parser because they try to handle the same
#pragma directives. This makes it impossible to use a Preprocessor (that was
previously passed to DoPrintPreprocessedInput), as an Preprocessor for a
clang::Parser instance which is what we currently do in cling.

This patch removes the added UnknownPragmaHandler to avoid conflicts these
conflicts and leave the PragmaHandlers of the Preprocessors in a the same state
as before calling DoPrintPreprocessedInput.

Patch by Raphael Isemann (D32486)!

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

7 years ago[OPENMP] Add a check for iterator not reached the end of stack, NFC.
Alexey Bataev [Thu, 27 Apr 2017 15:10:33 +0000 (15:10 +0000)]
[OPENMP] Add a check for iterator not reached the end of stack, NFC.

Add an extra check for the iterator during checks of the data-sharing
attributes.

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

7 years ago[index] Mark the ObjC implicit accessor method definitions as 'dynamic' as well
Argyrios Kyrtzidis [Thu, 27 Apr 2017 15:05:18 +0000 (15:05 +0000)]
[index] Mark the ObjC implicit accessor method definitions as 'dynamic' as well

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

7 years ago[OPENMP] Improve performance of the hasDSA() function, NFC.
Alexey Bataev [Thu, 27 Apr 2017 14:46:26 +0000 (14:46 +0000)]
[OPENMP] Improve performance of the hasDSA() function, NFC.

Remove some unneccesary code from the function after the fix for ASAN
buildbots.

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

7 years ago[libclang] Pass in the -fallow-editor-placeholders option
Alex Lorenz [Thu, 27 Apr 2017 13:47:03 +0000 (13:47 +0000)]
[libclang] Pass in the -fallow-editor-placeholders option

This will suppress any live diagnostics caused by editor placeholders in Xcode.

rdar://31833579

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

7 years agoclang/test/Modules/malformed-overload.m: Make sure module cache is clean.
NAKAMURA Takumi [Thu, 27 Apr 2017 13:08:48 +0000 (13:08 +0000)]
clang/test/Modules/malformed-overload.m: Make sure module cache is clean.

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