]> granicus.if.org Git - clang/log
clang
7 years ago[clang-format] Fix lines=all case in clang-format.py
Krasimir Georgiev [Tue, 5 Sep 2017 13:58:53 +0000 (13:58 +0000)]
[clang-format] Fix lines=all case in clang-format.py

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

7 years agoadd the option IndentPPDirectives to the release notes. Landed in r312125
Sylvestre Ledru [Tue, 5 Sep 2017 13:56:40 +0000 (13:56 +0000)]
add the option IndentPPDirectives to the release notes. Landed in r312125

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

7 years ago[Bash-autocomplete] Fix crash when invoking --autocomplete without value.
Raphael Isemann [Tue, 5 Sep 2017 12:41:00 +0000 (12:41 +0000)]
[Bash-autocomplete] Fix crash when invoking --autocomplete without value.

Summary:
Currently clang segfaults when invoked with `clang --autocomplete=`.
This patch adds the necessary boundary checks and some tests for corner cases like this.

Reviewers: yamaguchi

Reviewed By: yamaguchi

Subscribers: cfe-commits

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

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

7 years agoRemoved dead code (PR34467). NFCI.
Simon Pilgrim [Tue, 5 Sep 2017 10:37:13 +0000 (10:37 +0000)]
Removed dead code (PR34467). NFCI.

The for loop already checks that Idx < NumOfArgs.

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

7 years ago[AMDGPU] Implement infrastructure to set options in AMDGPUToolChain
Andrey Kasaurov [Tue, 5 Sep 2017 10:24:38 +0000 (10:24 +0000)]
[AMDGPU] Implement infrastructure to set options in AMDGPUToolChain

In current OpenCL implementation some options are set in OpenCL RT/Driver, which causes discrepancy between online and offline paths.
Implement infrastructure to move options from OpenCL RT/Driver to AMDGPUToolChain using overloaded TranslateArgs() method.
Create map for default options values, as Options.td doesn't support default values (in contrast with OPTIONS.def).
Add two driver options: -On and -mNN (like -O3, -m64).
Some minor formatting changes to follow the clang-format style.

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

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

7 years ago[X86][AVX512] _mm512_stream_load_si512 should take a void const* argument (PR33977)
Simon Pilgrim [Tue, 5 Sep 2017 10:06:41 +0000 (10:06 +0000)]
[X86][AVX512] _mm512_stream_load_si512 should take a void const* argument (PR33977)

Based off the Intel Intrinsics guide, we should expect a void const* argument.

Prevents 'passing 'const void *' to parameter of type 'void *' discards qualifiers' warnings.

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

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

7 years agoEmit static constexpr member as available_externally definition
Mehdi Amini [Tue, 5 Sep 2017 03:58:35 +0000 (03:58 +0000)]
Emit static constexpr member as available_externally definition

By exposing the constant initializer, the optimizer can fold many
of these constructs.

This is a recommit of r311857 that was reverted in r311898 because
an assert was hit when building Chromium.
We have to take into account that the GlobalVariable may be first
created with a different type than the initializer. This can
happen for example when the variable is a struct with tail padding
while the initializer does not have padding. In such case, the
variable needs to be destroyed an replaced with a new one with the
type of the initializer.

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

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

7 years agoAlways allocate room for a ModuleDecl on the TranslationUnitDecl.
Richard Smith [Tue, 5 Sep 2017 00:50:19 +0000 (00:50 +0000)]
Always allocate room for a ModuleDecl on the TranslationUnitDecl.

Sometimes we create the ASTContext and thus the TranslationUnitDecl before we know the LangOptions. This should fix the asan buildbot failures after r312467.

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

7 years agoclang-format: Fix indentation of macros in include guards (after r312125).
Daniel Jasper [Mon, 4 Sep 2017 13:33:52 +0000 (13:33 +0000)]
clang-format: Fix indentation of macros in include guards (after r312125).

Before:
  #ifndef A_H
  #define A_H

  #define A() \
  int i;    \
  int j;

  #endif // A_H

After:
  #ifndef A_H
  #define A_H

  #define A() \
    int i;    \
    int j;

  #endif // A_H

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

7 years agoFix MSVC narrowing conversion warning.
Simon Pilgrim [Mon, 4 Sep 2017 10:54:39 +0000 (10:54 +0000)]
Fix MSVC narrowing conversion warning.

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

7 years ago[analyzer] Increase minimum complexity filter of the CloneChecker.
Raphael Isemann [Mon, 4 Sep 2017 05:56:36 +0000 (05:56 +0000)]
[analyzer] Increase minimum complexity filter of the CloneChecker.

Summary:
So far we used a value of 10 which was useful for testing but produces many false-positives in real programs. The usual suspicious clones we find seem to be at around a complexity value of 70 and for normal clone-reporting everything above 50 seems to be a valid normal clone for users, so let's just go with 50 for now and set this as the new default value.

This patch also explicitly sets the complexity value for the regression tests as they serve more of a regression testing/debugging purpose and shouldn't really be reported by default in real programs. I'll add more tests that reflect actual found bugs that then need to pass with the default setting in the future.

Reviewers: NoQ

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

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

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

7 years agoImplement Itanium name mangling support for C++ Modules TS.
Richard Smith [Mon, 4 Sep 2017 05:37:53 +0000 (05:37 +0000)]
Implement Itanium name mangling support for C++ Modules TS.

This follows the scheme agreed with Nathan Sidwell, which can be found here:

  https://gcc.gnu.org/wiki/cxx-modules?action=AttachFile

This will be proposed to the itanium-cxx-abi list once we have some experience
with how well it works; the ABI for this TS should be considered unstable until
it is part of the Itanium C++ ABI.

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

7 years ago[CodeGen] Treat all vector fields as mayalias
Hal Finkel [Sun, 3 Sep 2017 17:18:25 +0000 (17:18 +0000)]
[CodeGen] Treat all vector fields as mayalias

Because it is common to treat vector types as an array of their elements, or
even some other type that's not the element type, and thus index into them, we
can't use struct-path TBAA for these accesses. Even though we already treat all
vector types as equivalent to 'char', we were using field-offset information
for them with TBAA, and this renders undefined the intra-value indexing we
intend to allow. Note that, although 'char' is universally aliasing, with path
TBAA, we can still differentiate between access to s.a and s.b in
  struct { char a, b; } s;. We can't use this capability as-is for vector types.

Fixes PR33967.

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

7 years agoTest commit access in clang.
Jatin Bhateja [Sun, 3 Sep 2017 15:29:38 +0000 (15:29 +0000)]
Test commit access in clang.

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

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

7 years ago[OpenCL] Do not use vararg in emitted functions for enqueue_kernel
Yaxun Liu [Sun, 3 Sep 2017 13:52:24 +0000 (13:52 +0000)]
[OpenCL] Do not use vararg in emitted functions for enqueue_kernel

Not all targets support vararg (e.g. amdgpu). Instead of using vararg in the emitted functions for enqueue_kernel,
this patch creates a temporary array of size_t, stores the size arguments in the temporary array
and passes it to the emitted functions for enqueue_kernel.

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

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

7 years ago[analyzer] MinComplexityConstraint now early exits and only does one macro stack...
Raphael Isemann [Sun, 3 Sep 2017 13:45:33 +0000 (13:45 +0000)]
[analyzer] MinComplexityConstraint now early exits and only does one macro stack lookup

Summary:
This patch contains performance improvements for the `MinComplexityConstraint`. It reduces the constraint time when running on the SQLite codebase by around 43% (from 0.085s down to 0.049s).

The patch is essentially doing two things:

* It introduces a possibility for the complexity value to early exit when reaching the limit we were checking for. This means that once we noticed that the current clone is larger than the limit the user has set, we instantly exit and no longer traverse the tree or do further expensive lookups in the macro stack.

* It also removes half of the macro stack lookups we do so far. Previously we always checked the start and the end location of a Stmt for macros, which was only a middle way between checking all locations of the Stmt and just checking one location. In practice I rarely found cases where it really matters if we check start/end or just the start of a statement as code with lots of macros that somehow just produce half a statement are very rare.

Reviewers: NoQ

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

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

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

7 years agoclang-format: Fix formatting of for loops with multiple increments.
Daniel Jasper [Sun, 3 Sep 2017 08:56:24 +0000 (08:56 +0000)]
clang-format: Fix formatting of for loops with multiple increments.

This fixes llvm.org/PR34366.

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

7 years agoDriver; extract target specific option application (NFC)
Saleem Abdulrasool [Sun, 3 Sep 2017 04:47:00 +0000 (04:47 +0000)]
Driver; extract target specific option application (NFC)

Extract the target specific option application.  This is a huge switch
which was inlined into the `ConstructJob` option which adds a large
amount of code to the already large function.  Extract it to simply
reduce the line count.  NFC

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

7 years agoDriver: extract debugging related options (NFC)
Saleem Abdulrasool [Sun, 3 Sep 2017 04:46:59 +0000 (04:46 +0000)]
Driver: extract debugging related options (NFC)

Out-of-line the logic for selecting the debug information handling.
This is still split across the new function and partially inline in the
job construction.  This is needed since the split portion attempts to
record the "-cc1" arguments.  This needs to be the very last item to
ensure that all the flags are recorded.  NFC.

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

7 years agoDriver: move `-mfpmath` into FP Options (NFC)
Saleem Abdulrasool [Sun, 3 Sep 2017 04:46:57 +0000 (04:46 +0000)]
Driver: move `-mfpmath` into FP Options (NFC)

Move the `-mfpmath` handling with the rest of the floating point
optimization flags.

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

7 years agoDon't search libxml2 if using msan. LLVM already has similar check.
Vitaly Buka [Sat, 2 Sep 2017 03:53:42 +0000 (03:53 +0000)]
Don't search libxml2 if using msan. LLVM already has similar check.

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

7 years agoDriver: extract `-fbuiltin` option handling (NFC)
Saleem Abdulrasool [Fri, 1 Sep 2017 23:44:01 +0000 (23:44 +0000)]
Driver: extract `-fbuiltin` option handling (NFC)

Extract the handling of the `-fbuiltin` family of flags to the driver.
This centralises the handling of those options, keeping the long
standing `#if 0`'ed block of code.  This requires some additional code
archaeology to determine if we need to enable this functionality.

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

7 years agoDriver: extract floating point optimization handling (NFC)
Saleem Abdulrasool [Fri, 1 Sep 2017 22:04:24 +0000 (22:04 +0000)]
Driver: extract floating point optimization handling (NFC)

Extract the logic for the floating point handling into its own function.
None of this information is needed for calculating the remainder of the
arguments to the frontend.  NFC

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

7 years agoEnable check-ubsan-minimal in standalone compiler-rt build.
Evgeniy Stepanov [Fri, 1 Sep 2017 20:37:20 +0000 (20:37 +0000)]
Enable check-ubsan-minimal in standalone compiler-rt build.

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

7 years ago[CodeGen]Refactor CpuSupports/CPUIs Builtin Code Gen to better work with
Erich Keane [Fri, 1 Sep 2017 19:42:45 +0000 (19:42 +0000)]
[CodeGen]Refactor CpuSupports/CPUIs Builtin Code Gen to better work with
"target" implementation

A small set of refactors that'll make it easier for me to implement 'target'
support.

First, extract the CPUSupports functionality into its own function.
THis has the advantage of not wasting time in this builtin to deal with
arguments.
Second, pulls both CPUSupports and CPUIs implementation into a member-function,
so that it can be called from the resolver generation that I'm working on.
Third, creates an overload that takes simply the feature/cpu name (rather than
extracting it from a callexpr), since that info isn't available later.

Note that despite how the 'diff' looks, the EmitX86CPUSupports function simply
takes the implementation out of the 'switch'.

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

7 years agoDriver: extract diagnostics flag handling (NFC)
Saleem Abdulrasool [Fri, 1 Sep 2017 18:57:34 +0000 (18:57 +0000)]
Driver: extract diagnostics flag handling (NFC)

Extract a function to render the diagnostics options to the clang
frontend.  This continues the simplification of the clang cc1 command
line invocation generation.  NFC

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

7 years ago[libFuzzer] switch -fsanitize=fuzzer from trace-pc-guard to inline-8bit-counters
Kostya Serebryany [Fri, 1 Sep 2017 18:34:36 +0000 (18:34 +0000)]
[libFuzzer] switch -fsanitize=fuzzer from trace-pc-guard to inline-8bit-counters

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

7 years agoDriver: extract ObjC option rendering (NFC)
Saleem Abdulrasool [Fri, 1 Sep 2017 17:43:59 +0000 (17:43 +0000)]
Driver: extract ObjC option rendering (NFC)

Extract the ObjC option rendering for the frontend.  This localises the
option translation.  It augments the existing `AddRuntimeObjCOptions`
which handles the runtime/ABI versioning flags only.  This new function
handles the non-runtime selecting flags.  This logic was previously
inlined into the `ConstructJob` function.

Minor change to the flag ordering to group the blocks related flags
together.

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

7 years agostd::function -> llvm::function_ref. NFC.
Benjamin Kramer [Fri, 1 Sep 2017 16:51:51 +0000 (16:51 +0000)]
std::function -> llvm::function_ref. NFC.

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

7 years agoDriver: extract modules flag handling (NFC)
Saleem Abdulrasool [Fri, 1 Sep 2017 15:25:17 +0000 (15:25 +0000)]
Driver: extract modules flag handling (NFC)

Extract a function to render the options related to modules.  This
reduces the cyclomatic complexity of the `ConstructJob` function.  NFC.

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

7 years ago[refactor] Use a RefactoringResultConsumer instead of tagged refactoring
Alex Lorenz [Fri, 1 Sep 2017 09:16:02 +0000 (09:16 +0000)]
[refactor] Use a RefactoringResultConsumer instead of tagged refactoring
rule classes

This commit changes the way that the refactoring results are produced. Instead
of using different `RefactoringActionRule` subclasses for each result type,
Clang  now use a single `RefactoringResultConsumer`. This was suggested by
Manuel in https://reviews.llvm.org/D36075.

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

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

7 years agoReland r312224 - [ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on...
Martin Storsjo [Fri, 1 Sep 2017 06:41:55 +0000 (06:41 +0000)]
Reland r312224 - [ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW

This fixes cases where dynamic classes produced RTTI data with
external linkage, producing linker errors about duplicate symbols.

This touches code close to what was changed in SVN r244266, but
this change doesn't break the tests added in that revision.

The previous version had missed to update CodeGenCXX/virt-dtor-key.cpp,
which had a behaviour change only when running the testsuite on windows.

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

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

7 years ago[OPENMP] Fix the test, NFC.
Alexey Bataev [Thu, 31 Aug 2017 23:34:33 +0000 (23:34 +0000)]
[OPENMP] Fix the test, NFC.

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

7 years ago[OPENMP] Fix for PR34398: assert with random access iterator if the
Alexey Bataev [Thu, 31 Aug 2017 23:06:52 +0000 (23:06 +0000)]
[OPENMP] Fix for PR34398: assert with random access iterator if the
step>1.

If the loop is a loot with random access iterators and the iteration
construct is represented it += n, then the compiler crashed because of
reusing of the same MaterializedTemporaryExpr around N. Patch fixes it
by using the expression as written, without any special kind of
wrappings.

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

7 years agoRegister linkageSpecDecl matcher
Dave Lee [Thu, 31 Aug 2017 21:18:27 +0000 (21:18 +0000)]
Register linkageSpecDecl matcher

Summary:
This allows `linkageSpecDecl` to be used from `clang-query`.

See also D31869 which similary adds `isStaticStorageClass`.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits, klimek

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

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

7 years agoAdd documentation for force_align_arg_pointer function attribute
Erich Keane [Thu, 31 Aug 2017 21:08:24 +0000 (21:08 +0000)]
Add documentation for force_align_arg_pointer function attribute

Patch By: anatol.pomozov (anatol.pomozov@gmail.com)

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

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

7 years ago[clang-cl] Explicitly set object format to COFF in CL mode
Oleg Ranevskyy [Thu, 31 Aug 2017 20:31:30 +0000 (20:31 +0000)]
[clang-cl] Explicitly set object format to COFF in CL mode

Summary:
Currently object format is taken from the default target triple. For toolchains with a non-COFF default target this may result in an object format inappropriate for pc-windows and lead to compilation issues.

For example, the default triple `aarch64-linux-elf` may produce something like `aarch64-pc-windows-msvc19.0.24215-elf` in CL mode. Clang creates `MicrosoftARM64TargetInfo` for such triple with data layout `e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128`. On the other hand, the AArch64 backend in `computeDataLayout` detects a non-COFF target and selects `e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128` as data layout for little endian. Different layouts used by clang and the backend cause an error:
```
error: backend data layout 'e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128'
 does not match expected target description 'e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128'
```
This can be observed on the clang's Driver/cl-pch.c test with AArch64 as a default target.

This patch enforces COFF in CL mode.

Reviewers: hans

Reviewed By: hans

Subscribers: cfe-commits, aemerson, asl, kristof.beyls

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

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

7 years agoDisable clang-format's MemoizationTest as it becomes prohibitive with EXPENSIVE_CHECKS
David Blaikie [Thu, 31 Aug 2017 18:49:34 +0000 (18:49 +0000)]
Disable clang-format's MemoizationTest as it becomes prohibitive with EXPENSIVE_CHECKS

EXPENSIVE_CHECKS enables libstdc++'s library consistency checks, which
includes checking the container passed to std::priority_queue for its
well-formedness. This makes the clang-format memoization too expensive,
so disable it.

(it's a necessary feature of libstdc++'s consistency checks that it
ruins the required scalability of C++ standard library features - so
these workarounds are to be expected if a test ever tries to test
scalability in some way, like this test does)

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

7 years agoDriver: extract ARCMT flag construction (NFC)
Saleem Abdulrasool [Thu, 31 Aug 2017 15:35:01 +0000 (15:35 +0000)]
Driver: extract ARCMT flag construction (NFC)

Extract the ARC migration tool flag handling into its own function.
This simplifies the flow of the clang frontend command line construction
function.  NFC.

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

7 years agodocs: don't say that data flow tracing interface is unstable
Dmitry Vyukov [Thu, 31 Aug 2017 11:02:44 +0000 (11:02 +0000)]
docs: don't say that data flow tracing interface is unstable

We are starting to use data flow tracing in kernel.
The interface is not subject to change anymore.

Reviewed in https://reviews.llvm.org/D37303

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

7 years agoRevert r312224: "[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on...
Martin Storsjo [Thu, 31 Aug 2017 09:46:27 +0000 (09:46 +0000)]
Revert r312224: "[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW"

Breaks on buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/4548/steps/test-check-all/logs/stdio

The test in CodeGenCXX/virt-dtor-key.cpp tests using %itanium_abi_triple;
on non-windows platforms, this resolves to the current platform triple
(where there was no behaviour change), while on windows, it resolves to
a mingw triple (where the behaviour was intentionally changed).

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

7 years ago[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW
Martin Storsjo [Thu, 31 Aug 2017 08:29:59 +0000 (08:29 +0000)]
[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW

This fixes cases where dynamic classes produced RTTI data with
external linkage, producing linker errors about duplicate symbols.

This touches code close to what was changed in SVN r244266, but
this change doesn't break the tests added in that revision.

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

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

7 years ago[analyzer] Performance optimizations for the CloneChecker
Raphael Isemann [Thu, 31 Aug 2017 07:10:46 +0000 (07:10 +0000)]
[analyzer] Performance optimizations for the CloneChecker

Summary:
This patch  aims at optimizing the CloneChecker for larger programs. Before this
patch we took around 102 seconds to analyze sqlite3 with a complexity value of
50. After this patch we now take 2.1 seconds to analyze sqlite3.

The biggest performance optimization is that we now put the constraint for group
size before the constraint for the complexity. The group size constraint is much
faster in comparison to the complexity constraint as it only does a simple
integer comparison. The complexity constraint on the other hand actually
traverses each Stmt and even checks the macro stack, so it is obviously not able
to handle larger amounts of incoming clones. The new order filters out all the
single-clone groups that the type II constraint generates in a faster way before
passing the fewer remaining clones to the complexity constraint. This reduced
runtime by around 95%.

The other change is that we also delay the verification part of the type II
clones back in the chain of constraints. This required to split up the
constraint into two parts - a verification and a hash constraint (which is also
making it more similar to the original design of the clone detection algorithm).
The reasoning for this is the same as before: The verification constraint has to
traverse many statements and shouldn't be at the start of the constraint chain.
However, as the type II hashing has to be the first step in our algorithm, we
have no other choice but split this constrain into two different ones. Now our
group size and complexity constrains filter out a chunk of the clones before
they reach the slow verification step, which reduces the runtime by around 8%.

I also kept the full type II constraint around - that now just calls it's two
sub-constraints - in case someone doesn't care about the performance benefits
of doing this.

Reviewers: NoQ

Reviewed By: NoQ

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

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

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

7 years ago[modules] Add ability to specify module name to module file mapping (reapply)
Boris Kolpackov [Thu, 31 Aug 2017 06:26:43 +0000 (06:26 +0000)]
[modules] Add ability to specify module name to module file mapping (reapply)

Extend the -fmodule-file option to support the [<name>=]<file> value format.
If the name is omitted, then the old semantics is preserved (the module file
is loaded whether needed or not). If the name is specified, then the mapping
is treated as just another prebuilt module search mechanism, similar to
-fprebuilt-module-path, and the module file is only loaded if actually used
(e.g., via import). With one exception: this mapping also overrides module
file references embedded in other modules (which can be useful if module files
are moved/renamed as often happens during remote compilation).

This override semantics requires some extra work: we now store the module name
in addition to the file name in the serialized AST representation.

Reviewed By: rsmith

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

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

7 years agoRemove accidental newline.
Nico Weber [Thu, 31 Aug 2017 06:18:26 +0000 (06:18 +0000)]
Remove accidental newline.

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

7 years agoFix path regex in test to match on Windows
Boris Kolpackov [Thu, 31 Aug 2017 06:18:08 +0000 (06:18 +0000)]
Fix path regex in test to match on Windows

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

7 years agoSuppress -Wdelete-non-virtual-dtor warnings about classes defined in system headers.
Nico Weber [Thu, 31 Aug 2017 06:17:08 +0000 (06:17 +0000)]
Suppress -Wdelete-non-virtual-dtor warnings about classes defined in system headers.

r312167 made it so that we emit Wdelete-non-virtual-dtor from delete statements
that are in system headers (e.g. std::unique_ptr). That works great on Linux
and macOS, but on Windows there are non-final classes that are defined in
system headers that have virtual methods but non-virtual destructors and yet
get deleted through a base class pointer (e.g. ATL::CAccessToken::CRevert). So
paddle back a bit and don't emit the warning if it's about a class defined in a
system header.

https://reviews.llvm.org/D37324

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

7 years agoFix the test fix from r312181
Hans Wennborg [Wed, 30 Aug 2017 23:26:38 +0000 (23:26 +0000)]
Fix the test fix from r312181

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

7 years ago[cxx_status] Update to describe current status a bit better.
Richard Smith [Wed, 30 Aug 2017 23:10:31 +0000 (23:10 +0000)]
[cxx_status] Update to describe current status a bit better.

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

7 years ago[Sema] Make SpecialMemberDecl a PointerIntPair so we can stash it in a SmallPtrSet.
Benjamin Kramer [Wed, 30 Aug 2017 22:51:50 +0000 (22:51 +0000)]
[Sema] Make SpecialMemberDecl a PointerIntPair so we can stash it in a SmallPtrSet.

We have enough spare bits in the alignment of CXXRecordDecl. No
functionality change intended.

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

7 years ago[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Matt Morehouse [Wed, 30 Aug 2017 22:49:31 +0000 (22:49 +0000)]
[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer

Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.
- Only enable on Linux.

Reviewers: vitalybuka, kcc, george.karpenkov

Reviewed By: kcc

Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya

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

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

7 years agoFix tests for ARM targets
Douglas Yung [Wed, 30 Aug 2017 22:30:08 +0000 (22:30 +0000)]
Fix tests for ARM targets

Tests fail on ARM targets due to ABI name between define and void. Added reg ex to skip.

Patch by Glenn Howe (and expanded on by Douglas Yung)!

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

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

7 years agoTest-case golfing.
Adrian Prantl [Wed, 30 Aug 2017 21:31:16 +0000 (21:31 +0000)]
Test-case golfing.

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

7 years ago[CodeGen][x86_64] Enable 'force_align_arg_pointer' attribute at x86_64
Erich Keane [Wed, 30 Aug 2017 21:17:40 +0000 (21:17 +0000)]
[CodeGen][x86_64] Enable 'force_align_arg_pointer' attribute at x86_64

This attribute is useful in OS development when we jump from 32 to 64 bit
code and expect that 64bit function forces correct stack alignment.

Related discussion: http://lists.llvm.org/pipermail/cfe-dev/2017-June/054358.html

Patch By: anatol.pomozov (anatol.pomozov@gmail.com)

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

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

7 years agoLet -Wdelete-non-virtual-dtor fire in system headers too.
Nico Weber [Wed, 30 Aug 2017 20:25:22 +0000 (20:25 +0000)]
Let -Wdelete-non-virtual-dtor fire in system headers too.

Makes the warning useful again in a std::unique_ptr world, PR28460.

Also make the warning not fire in unevaluated contexts, since system libraries
(e.g. libc++) do do that. This would've been a good change before we started
emitting this warning in system headers too, but "normal" code seems to be less
template-heavy, so we didn't notice until now.

https://reviews.llvm.org/D37235

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

7 years agodocs: typo fix
Hans Wennborg [Wed, 30 Aug 2017 18:35:44 +0000 (18:35 +0000)]
docs: typo fix

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

7 years agoAdapt testcases to LLVM change r312144 in DIGlobalVariableExpression
Adrian Prantl [Wed, 30 Aug 2017 18:22:23 +0000 (18:22 +0000)]
Adapt testcases to LLVM change r312144 in DIGlobalVariableExpression

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

7 years ago[X86] Implement broadcastf32x2 and broadcasti32x2 intrinsics using __builtin_shufflev...
Craig Topper [Wed, 30 Aug 2017 16:15:12 +0000 (16:15 +0000)]
[X86] Implement broadcastf32x2 and broadcasti32x2 intrinsics using __builtin_shufflevector instead builtins

This patch implements the broadcastf32x2/broadcasti32x2 intrinsics using __builtin_shufflevector.

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

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

7 years agoAvoid 'size_t' typedef in the unittest ObjC code
Alex Lorenz [Wed, 30 Aug 2017 15:37:30 +0000 (15:37 +0000)]
Avoid 'size_t' typedef in the unittest ObjC code

This should fix
http://bb.pgr.jp/builders/test-clang-msc-x64-on-i686-linux-RA

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

7 years agoRecommit r312127: [refactor] AST selection tree should contain syntactic
Alex Lorenz [Wed, 30 Aug 2017 15:28:01 +0000 (15:28 +0000)]
Recommit r312127: [refactor] AST selection tree should contain syntactic
form of PseudoObjectExpr

The new commit adjusts unittest test code compilation options so that the
Objective-C code in the unittest can be parsed on non-macOS platforms.

Original message:

The AST selection finder now constructs a selection tree that contains only the
syntactic form of PseudoObjectExpr. This form of selection tree is more
meaningful when doing downstream analysis as we're interested in the syntactic
features of the AST and the correct lexical parent relation.

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

7 years agoRevert r312127 as the ObjC unittest code fails to compile on Linux
Alex Lorenz [Wed, 30 Aug 2017 15:11:45 +0000 (15:11 +0000)]
Revert r312127 as the ObjC unittest code fails to compile on Linux

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

7 years ago[refactor] AST selection tree should contain syntactic form
Alex Lorenz [Wed, 30 Aug 2017 15:00:27 +0000 (15:00 +0000)]
[refactor] AST selection tree should contain syntactic form
of PseudoObjectExpr

The AST selection finder now constructs a selection tree that contains only the
syntactic form of PseudoObjectExpr. This form of selection tree is more
meaningful when doing downstream analysis as we're interested in the syntactic
features of the AST and the correct lexical parent relation.

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

7 years agoclang-format: Add preprocessor directive indentation
Krasimir Georgiev [Wed, 30 Aug 2017 14:34:57 +0000 (14:34 +0000)]
clang-format: Add preprocessor directive indentation

Summary:
This is an implementation for [bug 17362](https://bugs.llvm.org/attachment.cgi?bugid=17362) which adds support for indenting preprocessor statements inside if/ifdef/endif. This takes previous work from fmauch (https://github.com/fmauch/clang/tree/preprocessor_indent) and makes it into a full feature.
The context of this patch is that I'm a VMware intern, and I implemented this because VMware needs the feature. As such, some decisions were made based on what VMware wants, and I would appreciate suggestions on expanding this if necessary to use-cases other people may want.

This adds a new enum config option, `IndentPPDirectives`. Values are:

* `PPDIS_None` (in config: `None`):
```
    #if FOO
    #if BAR
    #include <foo>
    #endif
    #endif
```
* `PPDIS_AfterHash` (in config: `AfterHash`):
```
    #if FOO
    #  if BAR
    #    include <foo>
    #  endif
    #endif
```
This is meant to work whether spaces or tabs are used for indentation. Preprocessor indentation is independent of indentation for non-preprocessor lines.

Preprocessor indentation also attempts to ignore include guards with the checks:
1. Include guards cover the entire file
2. Include guards don't have `#else`
3. Include guards begin with
```
#ifndef <var>
#define <var>
```

This patch allows `UnwrappedLineParser::PPBranchLevel` to be decremented to -1 (the initial value is -1) so the variable can be used for indent tracking.

Defects:
* This patch does not handle the case where there's code between the `#ifndef` and `#define` but all other conditions hold. This is because when the #define line is parsed, `UnwrappedLineParser::Lines` doesn't hold the previous code line yet, so we can't detect it. This is out of the scope of this patch.

* This patch does not handle cases where legitimate lines may be outside an include guard. Examples are `#pragma once` and `#pragma GCC diagnostic`, or anything else that does not change the meaning of the file if it's included multiple times.

* This does not detect when there is a single non-preprocessor line in front of an include-guard-like structure where other conditions hold because `ScopedLineState` hides the line.

* Preprocessor indentation throws off `TokenAnnotator::setCommentLineLevels` so the indentation of comments immediately before indented preprocessor lines is toggled on each run. Fixing this issue appears to be a major change and too much complexity for this patch.

Contributed by @euhlmann!

Reviewers: djasper, klimek, krasimir

Reviewed By: djasper, krasimir

Subscribers: krasimir, mzeren-vmw, cfe-commits

Tags: #clang

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

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

7 years agoDriver: out-of-line static analyzer flag handling (NFC)
Saleem Abdulrasool [Wed, 30 Aug 2017 14:18:08 +0000 (14:18 +0000)]
Driver: out-of-line static analyzer flag handling (NFC)

Extract the analyzer flag handling into its own function to reduce the
overall complexity of the construction of the clang compiler arguments.
NFC.

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

7 years ago[refactor] Examine the whole range for ObjC @implementation decls
Alex Lorenz [Wed, 30 Aug 2017 13:24:37 +0000 (13:24 +0000)]
[refactor] Examine the whole range for ObjC @implementation decls
when computing the AST selection

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

7 years agoRevert r312105 [modules] Add ability to specify module name to module file mapping
Victor Leschuk [Wed, 30 Aug 2017 11:31:56 +0000 (11:31 +0000)]
Revert r312105 [modules] Add ability to specify module name to module file mapping

Looks like it breaks win10 builder.

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

7 years agoAdd test case that was broken by r311970.
Martin Bohme [Wed, 30 Aug 2017 10:44:51 +0000 (10:44 +0000)]
Add test case that was broken by r311970.

See also discussion here:
https://reviews.llvm.org/rL301963

As far as I can tell, this discussion was never resolved.

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

7 years agoRevert "Improve constant expression evaluation of arrays of unknown bound."
Martin Bohme [Wed, 30 Aug 2017 10:44:46 +0000 (10:44 +0000)]
Revert "Improve constant expression evaluation of arrays of unknown bound."

This reverts commit r311970.

Breaks internal tests.

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

7 years ago[docs] Regenerate command line options reference
Boris Kolpackov [Wed, 30 Aug 2017 09:15:53 +0000 (09:15 +0000)]
[docs] Regenerate command line options reference

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

7 years ago[modules] Add ability to specify module name to module file mapping
Boris Kolpackov [Wed, 30 Aug 2017 08:45:59 +0000 (08:45 +0000)]
[modules] Add ability to specify module name to module file mapping

Extend the -fmodule-file option to support the [<name>=]<file> value format.
If the name is omitted, then the old semantics is preserved (the module file
is loaded whether needed or not). If the name is specified, then the mapping
is treated as just another prebuilt module search mechanism, similar to
-fprebuilt-module-path, and the module file is only loaded if actually used
(e.g., via import). With one exception: this mapping also overrides module
file references embedded in other modules (which can be useful if module files
are moved/renamed as often happens during remote compilation).

This override semantics requires some extra work: we now store the module name
in addition to the file name in the serialized AST representation.

Reviewed By: rsmith

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

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

7 years agoGive a better error if auto deduction fails due to inconsistent element types in...
Richard Smith [Wed, 30 Aug 2017 00:44:08 +0000 (00:44 +0000)]
Give a better error if auto deduction fails due to inconsistent element types in a braced initializer list.

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

7 years agoDriver: refactor SSP argument handling (NFC)
Saleem Abdulrasool [Tue, 29 Aug 2017 23:59:08 +0000 (23:59 +0000)]
Driver: refactor SSP argument handling (NFC)

Out-of-line the SSP argument handling for the sake of readability.  Pass
along some state information to avoid re-computing the command line
flags.

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

7 years agoDriver: refactor OpenCL argument forwarding
Saleem Abdulrasool [Tue, 29 Aug 2017 23:59:07 +0000 (23:59 +0000)]
Driver: refactor OpenCL argument forwarding

Extract the argument forwarding for OpenCL arguments.  Make this more
data driven as we are just repeating the argument name and spelling.
This costs a slight bit more memory due to the string duplication, but
makes it easier to follow.  It should be possible to forward the
internal string representation from the TableGen data to avoid this.
But, this makes the code simpler to follow for now.

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

7 years agoDriver: reuse existing `D` variable (NFC)
Saleem Abdulrasool [Tue, 29 Aug 2017 23:59:06 +0000 (23:59 +0000)]
Driver: reuse existing `D` variable (NFC)

Change the rest of the function to use the `D` variable for the driver
instance.  NFC.

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

7 years agoDriver: hoist a local variable (NFC)
Saleem Abdulrasool [Tue, 29 Aug 2017 23:59:05 +0000 (23:59 +0000)]
Driver: hoist a local variable (NFC)

Hoist the `getToolChain().getTriple()` to a variable rather than
re-fetching it every time.  NFC.

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

7 years agoPR10147: When substituting a template template argument, substitute in the most
Richard Smith [Tue, 29 Aug 2017 22:14:43 +0000 (22:14 +0000)]
PR10147: When substituting a template template argument, substitute in the most
recent (non-friend) declaration to pick up the right set of default template
arguments.

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

7 years agoRestore clang_rt library name on i686-android.
Evgeniy Stepanov [Tue, 29 Aug 2017 22:12:31 +0000 (22:12 +0000)]
Restore clang_rt library name on i686-android.

Summary:
Recent changes canonicalized clang_rt library names to refer to
"i386" on all x86 targets. Android historically uses i686.

This change adds a special case to keep i686 in all clang_rt
libraries when targeting Android.

Reviewers: hans, mgorny, beanz

Subscribers: srhines, cfe-commits, llvm-commits

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

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

7 years agoRevert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"
Matt Morehouse [Tue, 29 Aug 2017 21:56:56 +0000 (21:56 +0000)]
Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"

This reverts r312026 due to bot breakage.

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

7 years agoRe-enable stack depth instrumentation on Windows.
Matt Morehouse [Tue, 29 Aug 2017 21:15:33 +0000 (21:15 +0000)]
Re-enable stack depth instrumentation on Windows.

Specified tls_model attribute properly. Should compile on Windows
now.

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

7 years agoDisable stack depth tracking on Windows.
Matt Morehouse [Tue, 29 Aug 2017 20:44:41 +0000 (20:44 +0000)]
Disable stack depth tracking on Windows.

Windows doesn't support the tls_model attribute.

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

7 years agoMinimal runtime for UBSan.
Evgeniy Stepanov [Tue, 29 Aug 2017 20:03:51 +0000 (20:03 +0000)]
Minimal runtime for UBSan.

Summary:
An implementation of ubsan runtime library suitable for use in production.

Minimal attack surface.
* No stack traces.
* Definitely no C++ demangling.
* No UBSAN_OPTIONS=log_file=/path (very suid-unfriendly). And no UBSAN_OPTIONS in general.
* as simple as possible

Minimal CPU and RAM overhead.
* Source locations unnecessary in the presence of (split) debug info.
* Values and types (as in A+B overflows T) can be reconstructed from register/stack dumps, once you know what type of error you are looking at.
* above two items save 3% binary size.

When UBSan is used with -ftrap-function=abort, sometimes it is hard to reason about failures. This library replaces abort with a slightly more informative message without much extra overhead. Since ubsan interface in not stable, this code must reside in compiler-rt.

Reviewers: pcc, kcc

Subscribers: srhines, mgorny, aprantl, krytarowski, llvm-commits

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

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

7 years ago[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Matt Morehouse [Tue, 29 Aug 2017 19:48:12 +0000 (19:48 +0000)]
[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer

Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.
- Disable stack depth tracking on Mac.

Reviewers: vitalybuka, kcc, george.karpenkov

Reviewed By: kcc

Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya

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

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

7 years ago[OPENMP] Capture global variables in all target executable regions.
Alexey Bataev [Tue, 29 Aug 2017 19:30:57 +0000 (19:30 +0000)]
[OPENMP] Capture global variables in all target executable regions.

Capturing of the global variables occurs only in target regions. Patch
fixes it and allows capturing of globals in all target executable
directives.

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

7 years ago[Bash-autocomplete] Refactor autocomplete code into own function
Yuka Takahashi [Tue, 29 Aug 2017 17:46:46 +0000 (17:46 +0000)]
[Bash-autocomplete] Refactor autocomplete code into own function

Summary:
We wrote many codes in HandleImediateArgs, so I've refactored it into
handleAutocompletions.

Reviewers: v.g.vassilev, teemperor

Subscribers: cfe-commits

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

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

7 years ago[ms] Fix vbtable index for covariant overrides of vbase methods
Reid Kleckner [Tue, 29 Aug 2017 17:40:04 +0000 (17:40 +0000)]
[ms] Fix vbtable index for covariant overrides of vbase methods

Overriding a method from a virtual base with a covariant return type
consumes a slot from the vftable in the virtual base. This can make it
impossible to implement certain diamond inheritance hierarchies, but we
have to follow along for compatibility in the simple cases.

This patch only affects our vtable dumper and member pointer function
mangling, since all other callers of getMethodVFTableLocation seem to
recompute VBTableIndex instead of using the one in the method location.

Patch by David Majnemer

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

7 years ago[modules-ts] Omit submodule semantics for TS modules
Boris Kolpackov [Tue, 29 Aug 2017 15:30:18 +0000 (15:30 +0000)]
[modules-ts] Omit submodule semantics for TS modules

If a TS module name has more than one component (e.g., foo.bar) then we
erroneously activated the submodule semantics when encountering a module
declaration in the module implementation unit (e.g., 'module foo.bar;').

Reviewed By: rsmith

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

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

7 years ago[clang-format] Refactor likely xml a bit, NFC
Krasimir Georgiev [Tue, 29 Aug 2017 13:57:31 +0000 (13:57 +0000)]
[clang-format] Refactor likely xml a bit, NFC

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

7 years ago[clang-format] Do not format likely xml
Krasimir Georgiev [Tue, 29 Aug 2017 13:51:38 +0000 (13:51 +0000)]
[clang-format] Do not format likely xml

Summary:
This patch detects the leading '<' in likely xml files and stops formatting in
that case. A recent use of a Qt xml file with a .ts extension triggered this:
http://doc.qt.io/qt-4.8/linguist-ts-file-format.html

Reviewers: djasper

Reviewed By: djasper

Subscribers: sammccall, cfe-commits, klimek

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

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

7 years ago[clang-format] Fixed typedef enum brace wrapping
Krasimir Georgiev [Tue, 29 Aug 2017 13:32:30 +0000 (13:32 +0000)]
[clang-format] Fixed typedef enum brace wrapping

Summary:
Bug: https://bugs.llvm.org/show_bug.cgi?id=34016 - **Typedef enum part**

**Problem:**

Clang format does not allow the flag **BraceWrapping.AfterEnum** control the case when our **enum** is preceded by **typedef** keyword (what is common in C language).

**Patch description:**

Added case to the **"AfterEnum"** flag when our enum does not start a line - is preceded by **typedef** keyword.

**After fix:**

**CONFIG:**
```
BreakBeforeBraces: Custom
BraceWrapping: {
AfterClass: true, AfterControlStatement: true, AfterEnum: true, AfterFunction: true, AfterNamespace: false, AfterStruct: true, AfterUnion: true, BeforeCatch: true, BeforeElse: true
}
```

**BEFORE:**
```
typedef enum
{
    a,
    b,
    c
} SomeEnum;
```

**AFTER:**

```
typedef enum
{
    a,
    b,
    c
} SomeEnum;
```

Contributed by @PriMee!

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[modules] Add test for using declaration in classes.
Raphael Isemann [Tue, 29 Aug 2017 09:27:41 +0000 (09:27 +0000)]
[modules] Add test for using declaration in classes.

Summary:
This adds a test that checks if the using declaration in classes still works as intended with modules.

The motivation for this is that we tried to add a shortcut to `removeDecl` that would skip the removal of declarations from the lookup table if they are hidden. This optimization passed the clang test suite but actually broke the using declaration in combination with -fmodules-local-submodule-visibility. In this mode we hide all decls from other modules such as by chance the parent method, in which case don't remove the parent method from the lookup table and get ambiguous lookup errors. After this patch we now correctly see if this behavior is broken by a patch like this in the test suite.

Reviewers: v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

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

7 years ago[libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*
Erik Verbruggen [Tue, 29 Aug 2017 09:08:02 +0000 (09:08 +0000)]
[libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*

Looks like this one was forgotten for clang_parseTranslationUnit*, as
LIBCLANG_NOTHREADS is checked for/in:

clang_saveTranslationUnit()
clang_reparseTranslationUnit()
clang_codeCompleteAt()
clang_indexTranslationUnit()
clang_indexSourceFile()

Patch by Nikolai Kosjar!

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

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

7 years agoclang-format: [JS] simplify template string wrapping.
Martin Probst [Tue, 29 Aug 2017 08:30:07 +0000 (08:30 +0000)]
clang-format: [JS] simplify template string wrapping.

Summary:
Previously, clang-format would try to wrap template string substitutions
by indenting relative to the openening `${`. This helped with
indenting structured strings, such as strings containing HTML, as the
substitutions would be aligned according to the structure of the string.

However it turns out that the overwhelming majority of template string +
substitution usages are for substitutions into non-structured strings,
e.g. URLs or just plain messages. For these situations, clang-format
would often produce very ugly indents, in particular for strings
containing no line breaks:

    return `<a href='http://google3/${file}?l=${row}'>${file}</a>(${
                                                                    row
                                                                  },${
                                                                      col
                                                                    }): `;

This change makes clang-format indent template string substitutions as
if they were string concatenation operations. It wraps +4 on overlong
lines and keeps all operands on the same line:

    return `<a href='http://google3/${file}?l=${row}'>${file}</a>(${
        row},${col}): `;

While this breaks some lexical continuity between the `${` and `row}`
here, the overall effects are still a huge improvement, and users can
still manually break the string using `+` if desired.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoUse class to pass information about executable name
Serge Pavlov [Tue, 29 Aug 2017 05:22:26 +0000 (05:22 +0000)]
Use class to pass information about executable name

Information about clang executable name components, such as target and
driver mode, was passes in std::pair. With this change it is passed in
a special structure. It improves readability and makes access to this
information more convenient.

NFC.

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

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

7 years agorevert r311839 (ongoing cwg discussion)
Faisal Vali [Tue, 29 Aug 2017 03:04:13 +0000 (03:04 +0000)]
revert r311839 (ongoing cwg discussion)

apologies.

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

7 years ago[Bash-autocompletion] Add support for -std=
Yuka Takahashi [Tue, 29 Aug 2017 02:01:56 +0000 (02:01 +0000)]
[Bash-autocompletion] Add support for -std=

Summary:
Add support for autocompleting values of -std= by including
LangStandards.def. This patch relies on D36782, and is using two-stage
code generation.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits

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

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

7 years agoImprove constant expression evaluation of arrays of unknown bound.
Richard Smith [Tue, 29 Aug 2017 01:52:13 +0000 (01:52 +0000)]
Improve constant expression evaluation of arrays of unknown bound.

The standard is not clear on how these are supposed to be handled, so we
conservatively treat as non-constant any cases whose value is unknown or whose
evaluation might result in undefined behavior.

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

7 years agoRevert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"
Yuka Takahashi [Tue, 29 Aug 2017 00:09:31 +0000 (00:09 +0000)]
Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"

This reverts commit 7c46b80c022e18d43c1fdafb117b0c409c5a6d1e.

r311552 broke lld buildbot because I've changed OptionInfos type from
ArrayRef to vector. However the bug is fixed, so I'll commit this again.

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

7 years ago[analyzer] Adjust ptr arithmetic test
Alexander Shaposhnikov [Mon, 28 Aug 2017 22:58:54 +0000 (22:58 +0000)]
[analyzer] Adjust ptr arithmetic test

Replace "long" with __UINTPTR_TYPE__
to make the test added in rL311935 Windows-friendly.
Caught by the buildbot llvm-clang-x86_64-expensive-checks-win.

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

7 years agoRemove trailing space.
Rui Ueyama [Mon, 28 Aug 2017 21:38:14 +0000 (21:38 +0000)]
Remove trailing space.

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

7 years ago[analyzer] Fix crash in modeling arithmetic
Alexander Shaposhnikov [Mon, 28 Aug 2017 21:15:21 +0000 (21:15 +0000)]
[analyzer] Fix crash in modeling arithmetic

This diff fixes modeling of arithmetic
expressions where pointers are treated as integers
(i.e. via C-style / reinterpret casts).
For now we return UnknownVal unless the operation is a comparison.

Test plan: make check-all

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

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