Commit Graph

69587 Commits

Author SHA1 Message Date
Matan Haroush b4b8d10355 This patch enables the usage of constant Enum identifiers within Microsoft style inline assembly statements.
Differential Revision:
https://reviews.llvm.org/D33277
https://reviews.llvm.org/D33278

llvm-svn: 308965
2017-07-25 10:43:43 +00:00
Manuel Klimek 1b29b4f953 Fix incorrect use of current directory to find moved paths in ASTReader.
CurrentDir was set as the path of the current module, but that can change as
part of a chain of loaded modules.

When we try to locate a file mentioned in a module that does not exist, we use
a heuristic to look at the relative path between the original location of the
module and the file we look for, and use that relatively to the CurrentDir.

This only works if CurrentDir is the same as the (current) path of the module
file the file was mentioned in; if it is not, we look at the path relatively to
the wrong directory, and can end up reading random unrelated files that happen
to have the same name.

This patch fixes this by using the BaseDirectory of the module file the file
we look for was mentioned in instead of the CurrentDir heuristic.

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

llvm-svn: 308962
2017-07-25 10:22:06 +00:00
Artem Dergachev e235bd1d03 [analyzer] Treat throws as sinks for suppress-on-sink purposes.
Because since r308957 the suppress-on-sink feature contains its own
mini-analysis, it also needs to become aware that C++ unhandled exceptions
cause sinks. Unfortunately, for now we treat all exceptions as unhandled in
the analyzer, so suppress-on-sink needs to do the same.

rdar://problem/28157554

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

llvm-svn: 308961
2017-07-25 09:44:02 +00:00
Artem Dergachev 4e99426629 [analyzer] Further improve suppress-on-sink behavior in incomplete analyses.
If a certain memory leak (or other similar bug) found by the analyzer is known
to be happening only before abnormal termination of the program ("sink", eg.
assertion failure in the code under analysis, or another bug that introduces
undefined behavior), such leak warning is discarded. However, if the analysis
has never reaches completion (due to complexity of the code), it may be
failing to notice the sink.

This commit further extends the partial solution introduced in r290341 to cover
cases when a complicated control flow occurs before encountering a no-return
statement (which anyway inevitably leads to such statement(s)) by traversing
the respective section of the CFG in a depth-first manner. A complete solution
still seems elusive.

rdar://problem/28157554

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

llvm-svn: 308957
2017-07-25 09:25:10 +00:00
Faisal Vali 6bf6791538 [NFC] Use RAII to un-poison and then re-poison __VA_ARGS__
- This will also be used for the forthcoming __VA_OPT__ feature approved for C++2a.
  - recommended by rsmith during his review of the __VA_OPT__ patch (https://reviews.llvm.org/D35782)

llvm-svn: 308948
2017-07-25 03:15:36 +00:00
Adrian Prantl a43acdc4d4 Debug Info: Avoid completing class types when a definition is in a module.
This patch adds an early exit to CGDebugInfo::completeClassData() when
compiling with -gmodules and the to-be-completed type is available in
a clang module.

rdar://problem/23599990

llvm-svn: 308938
2017-07-24 23:48:51 +00:00
Reid Kleckner c990b5d916 Revert "[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides"
This reverts r308867 and r308866.

It broke the sanitizer-windows buildbot on C++ code similar to the
following:

  namespace cl { }
  void f() {
    __asm {
      mov al, cl
    }
  }

t.cpp(4,13):  error: unexpected namespace name 'cl': expected expression
    mov al, cl
            ^

In this case, MSVC parses 'cl' as a register, not a namespace.

llvm-svn: 308926
2017-07-24 20:48:15 +00:00
Krasimir Georgiev f77ada0fa2 [clang-format] Reorder assignments, NFC
llvm-svn: 308918
2017-07-24 19:52:49 +00:00
Shoaib Meenai cef66e5281 [CodeGen] Propagate dllexport to thunks
Under Windows Itanium, we need to export virtual and non-virtual thunks
if the functions being thunked are exported. These thunks would
previously inherit their dllexport attribute from the declaration, but
r298330 changed declarations to not have dllexport attributes. We
therefore need to add the dllexport attribute to the definition
ourselves now. This is consistent with MinGW GCC's behavior.

This redoes r306770 but limits the logic to Itanium. MicrosoftCXXABI's
setThunkLinkage ensures that thunks aren't exported under that ABI, so
I'm handling this in ItaniumCXXABI's setThunkLinkage for symmetry.

We need to export these thunks because they can be referenced outside
the library they're defined in. For example, if a child class without a
key function inherits from a parent class with a key function, the
parent's thunks will only be defined in the library with the key
function, but the construction vtable for the parent in the child might
be emitted outside the library (since the child doesn't have a key
function), and it needs to reference the parent's thunks.

We don't need to mark these thunks as imported since any references to
them will occur in data, so the compiler can't generate the IAT load
sequence anyway. Instead, we rely on the linker generating import thunks
for the thunks.

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

llvm-svn: 308899
2017-07-24 17:16:27 +00:00
Tim Northover ad4c5db1ef AArch64 & ARM: move TargetInfo functions from .h to .cpp file. NFC.
Most of them are virtual anyway, and the few remaining ones can move to the
.cpp for consistency.

llvm-svn: 308898
2017-07-24 17:06:23 +00:00
Nico Weber f56f446f50 Work around an MSVC2017 update 3 codegen bug.
C2017 update 3 produces a clang that crashes when compiling clang. Disabling
optimizations for StmtProfiler::VisitCXXOperatorCallExpr() makes the crash go
away.

Patch from Bruce Dawson <brucedawson@chromium.org>!
https://reviews.llvm.org/D35757

llvm-svn: 308897
2017-07-24 16:54:11 +00:00
Alexey Bataev f189cb79d4 [OPENMP] Fix the restrictions for in_reduction clause.
This patch allows to use in_reduction clause even if the innermost
directive is not taskgroup.

llvm-svn: 308883
2017-07-24 14:52:13 +00:00
Krasimir Georgiev 3e05105486 [clang-format] Fix comment levels between '} else {' and PPDirective.
Summary:
This fixes a regression exposed by r307795 and rL308725 in which the level of a
comment line between '} else {' and a preprocessor directive is incorrectly set
as the level of the '} else {' line. For example, this :
```
int f(int i) {
  if (i) {
    ++i;
  } else {
    // comment
#ifdef A
    --i;
#endif
  }
}
```
was formatted as:
```
int f(int i) {
  if (i) {
    ++i;
  } else {
  // comment
#ifdef A
    --i;
#endif
  }
}
```

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 308882
2017-07-24 14:51:59 +00:00
Simon Dardis 7d31878674 [mips] Add support for -m(no-)extern-data.
Add support for -m(no-)extern-data when using -mgpopt in the driver. It is
enabled by default in the backend.

Reviewers: atanasyan, slthakur

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

llvm-svn: 308879
2017-07-24 14:02:09 +00:00
Coby Tayree 1f5df89a8c [X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides
On MS-style, the following snippet:

int eax;
__asm mov eax, ebx

should yield loading of ebx, into the location pointed by the variable eax

This patch sees to it.

Currently, a reg-to-reg move would have been invoked.

llvm: D34739

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

llvm-svn: 308867
2017-07-24 07:06:37 +00:00
Petr Hosek 67fe74b122 [Driver] Fuchsia defaults to -fno-math-errno
Patch by Roland McGrath

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

llvm-svn: 308855
2017-07-23 22:30:13 +00:00
Nico Weber e0c3f90687 Remove Driver::UseStdLib.
All but one place are checking options::OPT_nostdlib instead of looking at
this field, so convert that one other place to doing that as well.

No behavior change.

llvm-svn: 308848
2017-07-23 16:31:47 +00:00
NAKAMURA Takumi 7ae667d71e [Modules] Rework r274270. Let Clang targets depend on intrinsics_gen.
This gets rid of almost LLVM targets unconditionally depending on intrinsic_gen.

Clang's modules still have weird dependencies and hard to remove intrinsics_gen in better way.
Then, it'd be better to give whole clang targets depend on intrinsic_gen.

llvm-svn: 308844
2017-07-23 05:09:44 +00:00
NAKAMURA Takumi 6876680773 clang/module.modulemap: Split out Clang_ToolingCore from Clang_Tooling.
It cuts clangFormat's dependencies out of;

  Clang_Analysis
  Clang_C
  Clang_Diagnostics
  Clang_Driver
  Clang_Frontend
  Clang_Sema
  Clang_Serialization
  Clang_StaticAnalyzer_Core
  Clang_Tooling -> Clang_ToolingCore

Now, the module Clang_Format depends on;

  Clang_AST
  Clang_Basic
  Clang_ToolingCore

llvm-svn: 308832
2017-07-23 01:40:36 +00:00
Yuka Takahashi b40f4db4af [Bash-autocompletion] Fixed typo and add '-' after -Wno
Summary: -Wno-<warning> was autocompleted as -Wno<warning>, so fixed this typo.

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

llvm-svn: 308824
2017-07-22 12:35:15 +00:00
Faisal Vali 5156fcc983 [NFC, documentation] Prefer the term expansion instead of macro instantiation
... in the few remaining places where this was not corrected.


  

llvm-svn: 308823
2017-07-22 12:04:37 +00:00
Ben Langmuir 1f3881575a [index] Set SymbolSubKind::Accessor[GS]etter on class methods
We have the same relation between class properties and getter/setters
that we have for instance properties, so set the same symbol sub-kind.

rdar://problem/32376404

llvm-svn: 308800
2017-07-21 23:04:27 +00:00
Erich Keane 2b9657b570 Remove Bitrig: Clang Changes
Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned.

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

llvm-svn: 308797
2017-07-21 22:46:31 +00:00
Erich Keane ebba592682 Break up Targets.cpp into a header/impl pair per target type[NFCI]
Targets.cpp is getting unwieldy, and even minor changes cause the entire thing 
to cause recompilation for everyone. This patch bites the bullet and breaks 
it up into a number of files.

I tended to keep function definitions in the class declaration unless it 
caused additional includes to be necessary. In those cases, I pulled it 
over into the .cpp file. Content is copy/paste for the most part, 
besides includes/format/etc.


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

llvm-svn: 308791
2017-07-21 22:37:03 +00:00
Richard Trieu 09f14114c9 Inline variable into assert to fix unused warning.
llvm-svn: 308783
2017-07-21 21:29:35 +00:00
Krzysztof Parzyszek c0d12bcd68 [Hexagon] Attempt to fix selfhost bots
The codegen testcase was checking for specific value names. Make it
ignore the names instead as they are irrelevant. 

llvm-svn: 308782
2017-07-21 21:23:05 +00:00
Richard Trieu e9ad48fd56 Fix tblgen error
Add Heading string to attribute documentation.

llvm-svn: 308777
2017-07-21 20:32:22 +00:00
Alexey Bataev f87fa889fe [OPENMP] Fix build problem, NFC.
llvm-svn: 308773
2017-07-21 19:26:22 +00:00
Alexey Bataev 030f8b4c99 [OPENMP] Add ast-print tests for in_reduction clause, NFC.
llvm-svn: 308771
2017-07-21 18:55:46 +00:00
Erich Keane de1b2a9375 Complex Long Double classification In RegCall calling convention
This change is part of the RegCall calling convention support for LLVM. 
Existing RegCall implementation was extended to include correct handling of 
Complex Long Double type. Complex long double types should be returned/passed 
in memory and not register stack. This patch implements this behavior.

Patch by: eandrews

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

llvm-svn: 308769
2017-07-21 18:50:36 +00:00
Alexey Bataev fa312f33f8 [OPENMP] Initial support for 'in_reduction' clause.
Parsing/sema analysis for 'in_reduction' clause for task-based
directives.

llvm-svn: 308768
2017-07-21 18:48:21 +00:00
Krzysztof Parzyszek 33e67ad098 [Hexagon] Add inline-asm constraint 'a' for modifier register class
For example
  asm ("memw(%0++%1) = %2" : : "r"(addr),"a"(mod),"r"(val) : "memory")

llvm-svn: 308763
2017-07-21 18:07:15 +00:00
Alexey Bataev effbdf1604 [OPENMP] Simplify analysis of data-sharing attributes.
llvm-svn: 308759
2017-07-21 17:24:30 +00:00
Andrey Kasaurov 099f633da4 Test commit
llvm-svn: 308744
2017-07-21 15:24:37 +00:00
Nikolay Haustov 208a597ee7 Test commit
llvm-svn: 308741
2017-07-21 13:58:11 +00:00
Alex Lorenz 04184a6d75 [clang-diff] Get rid of unused variable warnings in ASTDiff.cpp
llvm-svn: 308737
2017-07-21 13:18:51 +00:00
Alex Lorenz 61ea7b9096 Clang's tests should depend on clang-diff
llvm-svn: 308735
2017-07-21 13:12:01 +00:00
Alex Lorenz 4c0a86608f Fix another compiler error from r308731
std::pair in emplace back couldn't be constructed because SNodeId has an
explicit constructor. Not sure how this even compiled on my machine before.

llvm-svn: 308734
2017-07-21 13:04:57 +00:00
Alex Lorenz 158063e4de Fix tuple construction compiler error from r308731
llvm-svn: 308733
2017-07-21 12:57:40 +00:00
Alex Lorenz a75b2cac71 [clang-diff] Add initial implementation
This is the first commit for the "Clang-based C/C++ diff tool" GSoC project.

ASTDiff is a new library that computes a structural AST diff between two ASTs
using the gumtree algorithm. Clang-diff is a new Clang tool that will show
the structural code changes between different ASTs.

Patch by Johannes Altmanninger!

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

llvm-svn: 308731
2017-07-21 12:49:28 +00:00
Krasimir Georgiev 06451fa1a2 [clang-format] Fix comment levels between '}' and PPDirective
Summary:
This fixes a regression exposed by r307795 in which the level of a comment line
between '}' and a preprocessor directive is incorrectly set as the level of the
line before the '}'. In effect, this:
```
int f(int i) {
  int j = i;
  return i + j;
}
// comment

#ifdef A
#endif
```
was formatted as:
```
int f(int i) {
  int j = i;
  return i + j;
}
  // comment

#ifdef A
#endif
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 308725
2017-07-21 10:26:13 +00:00
Ilya Biryukov b6d1ec8073 Fixed failing assert in code completion.
Summary:
The code was accessing uninstantiated default argument.
This resulted in failing assertion at ParmVarDecl::getDefaultArg().

Reviewers: erikjv, klimek, bkramer, krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

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

llvm-svn: 308722
2017-07-21 09:24:00 +00:00
Simon Atanasyan d5c937b3a3 [mips] Add `short_call` to the set of `long_call/far/near` attributes
MIPS gcc supports `long_call/far/near` attributes only, but other
targets have the `short_call` attribut, so let's support it for MIPS
for consistency.

llvm-svn: 308719
2017-07-21 08:10:57 +00:00
Richard Trieu 4538a5abb0 Fix tblgen error.
tblgen couldn't determing a unique name between "long_call" and "far", so it
errored out when generating documentation.  Copy the documentation, and give
an explicit header for "long_call".

llvm-svn: 308714
2017-07-21 04:56:48 +00:00
Petr Hosek eb4127ffb5 [Driver] Consider -fno-sanitize=... state when filtering out -fsanitize-coverage=...
The driver ignores -fsanitize-coverage=... flags when also given
-fsanitize=... flags for sanitizer flavors that don't support the
coverage runtime. This logic failed to account for subsequent
-fno-sanitize=... flags that disable the sanitizer flavors that
conflict with -fsanitize-coverage=... flags.

Patch by Roland McGrath

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

llvm-svn: 308707
2017-07-21 01:17:49 +00:00
Petr Hosek 0f874d4ba5 [CMake] Use ABI version 2 for C++ library in Fuchsia
Fuchsia has always been using ABI version 2 but I forgot this option
when setting up the cache file for runtimes build.

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

llvm-svn: 308705
2017-07-21 00:59:38 +00:00
Krasimir Georgiev 22d7e6b08d [clang-format] Put '/**' and '*/' on own lines in multiline jsdocs
Reviewers: mprobst

Reviewed By: mprobst

Subscribers: cfe-commits, klimek

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

llvm-svn: 308684
2017-07-20 22:29:39 +00:00
Simon Dardis 9f1d5d8cd5 [mips] Add support for -m(no-)local-sdata
Teach the driver to support -mlocal-sdata. The backend already matches GCC's
default behaviour.

Reviewers: atanasyan, slthakur

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

llvm-svn: 308683
2017-07-20 22:23:21 +00:00
Artem Belevich d7a73824e4 [NVPTX] Add lowering of i128 params.
The patch adds support of i128 params lowering. The changes are quite trivial to
support i128 as a "special case" of integer type. With this patch, we lower i128
params the same way as aggregates of size 16 bytes: .param .b8 _ [16].

Currently, NVPTX can't deal with the 128 bit integers:
* in some cases because of failed assertions like
  ValVTs.size() == OutVals.size() && "Bad return value decomposition"
* in other cases emitting PTX with .i128 or .u128 types (which are not valid [1])
  [1] http://docs.nvidia.com/cuda/parallel-thread-execution/index.html#fundamental-types

Differential Revision: https://reviews.llvm.org/D34555
Patch by: Denys Zariaiev (denys.zariaiev@gmail.com)

llvm-svn: 308675
2017-07-20 21:16:03 +00:00
Simon Atanasyan 1a116db120 [CodeGen][mips] Support `long_call/far/near` attributes
This patch adds support for the `long_call`, `far`, and `near` attributes
for MIPS targets. The `long_call` and `far` attributes are synonyms. All
these attributes override `-mlong-calls` / `-mno-long-calls` command
line options for particular function.

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

llvm-svn: 308667
2017-07-20 20:34:18 +00:00