]> granicus.if.org Git - clang/log
clang
7 years agoRemove a useless subsitution in doxygen2rst which was incorrectly replacing * by \*
Sylvestre Ledru [Thu, 9 Mar 2017 06:41:08 +0000 (06:41 +0000)]
Remove a useless subsitution in doxygen2rst which was incorrectly replacing * by \*

Summary: For example, "int\* a;" is displayed instead of "int* a;"

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

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

7 years ago[coroutines] Fix assertion in DependentCoawaitExpr when the argument is non-dependent.
Eric Fiselier [Thu, 9 Mar 2017 05:01:31 +0000 (05:01 +0000)]
[coroutines] Fix assertion in DependentCoawaitExpr when the argument is non-dependent.

Summary:
A `co_await arg` expression has a dependent type whenever the promise type is still dependent, even if the argument to co_await is not. This is because we cannot attempt the `await_transform(<arg>)` until after we know the promise type.

This patch fixes an assertion in the constructor of `DependentCoawaitExpr` that asserted that `arg` must also be dependent.

Reviewers: rsmith, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: mehdi_amini, cfe-commits

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

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

7 years ago[coroutines] Build and pass coroutine_handle to await_suspend
Gor Nishanov [Thu, 9 Mar 2017 03:09:43 +0000 (03:09 +0000)]
[coroutines] Build and pass coroutine_handle to await_suspend

Summary:
This patch adds passing a coroutine_handle object to await_suspend calls.
It builds the coroutine_handle using coroutine_handle<PromiseType>::from_address(__builtin_coro_frame()).

(a revision of https://reviews.llvm.org/D26316 that for some reason refuses to apply via arc patch)

Reviewers: GorNishanov

Subscribers: mehdi_amini, cfe-commits, EricWF

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

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

7 years agoAdd a cmake cache file for a stage-2 build with ThinLTO
Mehdi Amini [Thu, 9 Mar 2017 01:18:31 +0000 (01:18 +0000)]
Add a cmake cache file for a stage-2 build with ThinLTO

This is intended to be targetted by a Green Dragon stage-2 bot
I'm bringing up currently. WIP.

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

7 years agoFix handling of -fmodule-map-file=X where X has no directory component.
Richard Smith [Thu, 9 Mar 2017 00:58:22 +0000 (00:58 +0000)]
Fix handling of -fmodule-map-file=X where X has no directory component.

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

7 years agoRevert "[ubsan] Detect UB loads from bitfields"
Vedant Kumar [Thu, 9 Mar 2017 00:18:53 +0000 (00:18 +0000)]
Revert "[ubsan] Detect UB loads from bitfields"

This reverts commit r297298. It breaks the self-host on this bot:

  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/962/steps/build%20clang%2Fubsan/logs/stdio

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

7 years agoDriver/ToolChains: Remove extra semicolons. NFC
Konstantin Zhuravlyov [Thu, 9 Mar 2017 00:14:57 +0000 (00:14 +0000)]
Driver/ToolChains: Remove extra semicolons. NFC

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

7 years ago[analyzer] Extend taint propagation and checking to support LazyCompoundVal
Anna Zaks [Thu, 9 Mar 2017 00:01:16 +0000 (00:01 +0000)]
[analyzer] Extend taint propagation and checking to support LazyCompoundVal

A patch by Vlad Tsyrklevich!

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

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

7 years ago[analyzer] Improve usability of ExprInspectionChecker
Anna Zaks [Thu, 9 Mar 2017 00:01:10 +0000 (00:01 +0000)]
[analyzer] Improve usability of ExprInspectionChecker

Some of the magic functions take arguments of arbitrary type. However,
for semantic correctness, the compiler still requires a declaration
of these functions with the correct type. Since C does not have
argument-type-overloaded function, this made those functions hard to
use in C code. Improve this situation by allowing arbitrary suffixes
in the affected magic functions' names, thus allowing the user to
create different declarations for different types.

A patch by Keno Fischer!

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

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

7 years ago[analyzer] Add bug visitor for taint checker.
Anna Zaks [Thu, 9 Mar 2017 00:01:07 +0000 (00:01 +0000)]
[analyzer] Add bug visitor for taint checker.

Add a bug visitor to the taint checker to make it easy to distinguish where
the tainted value originated. This is especially useful when the original
taint source is obscured by complex data flow.

A patch by Vlad Tsyrklevich!

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

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

7 years ago[analyzer] Teach the MallocChecker about about Glib API
Anna Zaks [Thu, 9 Mar 2017 00:01:01 +0000 (00:01 +0000)]
[analyzer] Teach the MallocChecker about about Glib API

A patch by Leslie Zhai!

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

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

7 years agoDefensively ensure that GetExternalDeclStmt protects itself from nested deserialization
David Blaikie [Wed, 8 Mar 2017 23:57:08 +0000 (23:57 +0000)]
Defensively ensure that GetExternalDeclStmt protects itself from nested deserialization

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

7 years ago[DebugInfo] Add address space when creating DIDerivedTypes
Konstantin Zhuravlyov [Wed, 8 Mar 2017 23:56:48 +0000 (23:56 +0000)]
[DebugInfo] Add address space when creating DIDerivedTypes

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

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

7 years agoTake into account C++17's noexcept function types during merging -- it should
Richard Smith [Wed, 8 Mar 2017 23:00:26 +0000 (23:00 +0000)]
Take into account C++17's noexcept function types during merging -- it should
be possible to merge a declaration with an unresolved function type against one
with a resolved function type.

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

7 years agoDriver/ToolChains: Mips -> MipsLinux
Konstantin Zhuravlyov [Wed, 8 Mar 2017 22:36:04 +0000 (22:36 +0000)]
Driver/ToolChains: Mips -> MipsLinux
  - Mips is architecture, not a toolchain
  - Might help eliminate the confusion in the future by not having header files with the same name

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

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

7 years ago[scan-build-py] move argument parsing into separate module
Laszlo Nagy [Wed, 8 Mar 2017 21:22:32 +0000 (21:22 +0000)]
[scan-build-py] move argument parsing into separate module

Forgot to add the new module.

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

7 years ago[scan-build-py] move argument parsing into separate module
Laszlo Nagy [Wed, 8 Mar 2017 21:18:51 +0000 (21:18 +0000)]
[scan-build-py] move argument parsing into separate module

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

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

7 years ago[ubsan] Detect UB loads from bitfields
Vedant Kumar [Wed, 8 Mar 2017 17:38:57 +0000 (17:38 +0000)]
[ubsan] Detect UB loads from bitfields

It's possible to load out-of-range values from bitfields backed by a
boolean or an enum. Check for UB loads from bitfields.

This is the motivating example:

  struct S {
    BOOL b : 1; // Signed ObjC BOOL.
  };

  S s;
  s.b = 1; // This is actually stored as -1.
  if (s.b == 1) // Evaluates to false, -1 != 1.
    ...

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

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

7 years agoAdd missing implementation for AtomicChange::replace(...)
Eric Liu [Wed, 8 Mar 2017 15:53:10 +0000 (15:53 +0000)]
Add missing implementation for AtomicChange::replace(...)

Summary: Just realized the implementation is missing...

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

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

7 years ago[analyzer] Clarify 'uninitialized function argument' messages
Daniel Marjamaki [Wed, 8 Mar 2017 15:22:24 +0000 (15:22 +0000)]
[analyzer] Clarify 'uninitialized function argument' messages

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

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

7 years agoHonor __unaligned in codegen for declarations and expressions
Roger Ferrer Ibanez [Wed, 8 Mar 2017 14:00:44 +0000 (14:00 +0000)]
Honor __unaligned in codegen for declarations and expressions

This patch honors the unaligned type qualifier (currently available through he
keyword __unaligned and -fms-extensions) in CodeGen. In the current form the
patch affects declarations and expressions. It does not affect fields of
classes.

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

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

7 years agoAdd more examples to clang-format configuration
Sylvestre Ledru [Wed, 8 Mar 2017 13:24:46 +0000 (13:24 +0000)]
Add more examples to clang-format configuration

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[clang-format] Look at NoLineBreak and NoLineBreakInOperand before breakProtrudingToken
Krasimir Georgiev [Wed, 8 Mar 2017 12:54:50 +0000 (12:54 +0000)]
[clang-format] Look at NoLineBreak and NoLineBreakInOperand before breakProtrudingToken

Summary:
This patch makes ContinuationIndenter call breakProtrudingToken only if
NoLineBreak and NoLineBreakInOperand is false.

Previously, clang-format required two runs to converge on the following example with 24 columns:
Note that the second operand shouldn't be splitted according to NoLineBreakInOperand, but the
token breaker doesn't take that into account:
```
func(a, "long long long long", c);
```
After first run:
```
func(a, "long long "
        "long long",
         c);
```
After second run, where NoLineBreakInOperand is taken into account:
```
func(a,
     "long long "
     "long long",
     c);
```

With the patch, clang-format now obtains in one run:
```
func(a,
     "long long long"
     "long",
     c);
```
which is a better token split overall.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[XRay] Use AddCXXStdlibLibArgs. NFCI.
Jonas Hahnfeld [Wed, 8 Mar 2017 12:06:44 +0000 (12:06 +0000)]
[XRay] Use AddCXXStdlibLibArgs. NFCI.

This function already does the very same thing.

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

7 years agoclang-format: Get slightly better at understanding */&.
Daniel Jasper [Wed, 8 Mar 2017 09:49:12 +0000 (09:49 +0000)]
clang-format: Get slightly better at understanding */&.

Before:
  void f() { MACRO(A * const a); }

After:
  void f() { MACRO(A *const a); }

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

7 years ago[scan-build-py] fix some line separator issues
Laszlo Nagy [Wed, 8 Mar 2017 09:27:53 +0000 (09:27 +0000)]
[scan-build-py] fix some line separator issues

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

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

7 years ago[clang-format] Fixed a typo in Format.cpp and a clang-tidy nit about std::function...
Krasimir Georgiev [Wed, 8 Mar 2017 09:13:25 +0000 (09:13 +0000)]
[clang-format] Fixed a typo in Format.cpp and a clang-tidy nit about std::function copying; NFC

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

7 years ago[test] Unbreak OpenMP/linking.c with arch-specific libdir
Jonas Hahnfeld [Wed, 8 Mar 2017 09:07:33 +0000 (09:07 +0000)]
[test] Unbreak OpenMP/linking.c with arch-specific libdir

After rL296927, -rpath gets added after linking the OpenMP runtime.
That's why -lgcc does not immediately follow -lomp or -lgomp.

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

7 years ago[clang-format] Fix parameter name comment; NFC
Krasimir Georgiev [Wed, 8 Mar 2017 09:02:39 +0000 (09:02 +0000)]
[clang-format] Fix parameter name comment; NFC

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

7 years ago[clang-format] Reformat BreakableToken.h; NFC
Krasimir Georgiev [Wed, 8 Mar 2017 08:58:44 +0000 (08:58 +0000)]
[clang-format] Reformat BreakableToken.h; NFC

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

7 years ago[clang-format] Enable comment reflowing in multiline comments containing pragmas
Krasimir Georgiev [Wed, 8 Mar 2017 08:55:12 +0000 (08:55 +0000)]
[clang-format] Enable comment reflowing in multiline comments containing pragmas

Summary:
This patch enables comment reflowing of lines not matching the comment pragma regex
in multiline comments containing comment pragma lines. Previously, these comments
were dumped without being reindented to the result.

Reviewers: djasper, mprobst

Reviewed By: mprobst

Subscribers: klimek, mprobst, cfe-commits

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

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

7 years ago[Driver] Consolidate tools and toolchains by target platform. (NFC)
David L. Jones [Wed, 8 Mar 2017 01:02:16 +0000 (01:02 +0000)]
[Driver] Consolidate tools and toolchains by target platform. (NFC)

Summary:
(This is a move-only refactoring patch. There are no functionality changes.)

This patch splits apart the Clang driver's tool and toolchain implementation
files. Each target platform toolchain is moved to its own file, along with the
closest-related tools. Each target platform toolchain has separate headers and
implementation files, so the hierarchy of classes is unchanged.

There are some remaining shared free functions, mostly from Tools.cpp. Several
of these move to their own architecture-specific files, similar to r296056. Some
of them are only used by a single target platform; since the tools and
toolchains are now together, some helpers now live in a platform-specific file.
The balance are helpers related to manipulating argument lists, so they are now
in a new file pair, CommonArgs.h and .cpp.

I've tried to cluster the code logically, which is fairly straightforward for
most of the target platforms and shared architectures. I think I've made
reasonable choices for these, as well as the various shared helpers; but of
course, I'm happy to hear feedback in the review.

There are some particular things I don't like about this patch, but haven't been
able to find a better overall solution. The first is the proliferation of files:
there are several files that are tiny because the toolchain is not very
different from its base (usually the Gnu tools/toolchain). I think this is
mostly a reflection of the true complexity, though, so it may not be "fixable"
in any reasonable sense. The second thing I don't like are the includes like
"../Something.h". I've avoided this largely by clustering into the current file
structure. However, a few of these includes remain, and in those cases it
doesn't make sense to me to sink an existing file any deeper.

Reviewers: rsmith, mehdi_amini, compnerd, rnk, javed.absar

Subscribers: emaste, jfb, danalbert, srhines, dschuff, jyknight, nemanjai, nhaehnle, mgorny, cfe-commits

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

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

7 years ago[ODRHash] Hash typedefs and usings statements in classes.
Richard Trieu [Wed, 8 Mar 2017 00:13:19 +0000 (00:13 +0000)]
[ODRHash] Hash typedefs and usings statements in classes.

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

7 years ago[AArch64] Vulcan is now ThunderXT99
Joel Jones [Tue, 7 Mar 2017 21:24:53 +0000 (21:24 +0000)]
[AArch64] Vulcan is now ThunderXT99

Broadcom Vulcan is now Cavium ThunderX2T99.

LLVM Bugzilla: http://bugs.llvm.org/show_bug.cgi?id=32113
Corresponding LLVM change: https://reviews.llvm.org/rL297190

Changes to clang to support the change.

Patch by Joel Jones

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

7 years ago[coroutines] update coro_end builtin to match llvm
Gor Nishanov [Tue, 7 Mar 2017 21:01:08 +0000 (21:01 +0000)]
[coroutines] update coro_end builtin to match llvm

Summary: llvm.coro.end intrinsic now returns bool. Updating clang to match it.

Reviewers: GorNishanov, rsmith

Reviewed By: rsmith

Subscribers: mehdi_amini, cfe-commits, EricWF

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

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

7 years agoUse filename in linemarker when compiling preprocessed source (Revised)
Taewook Oh [Tue, 7 Mar 2017 20:20:23 +0000 (20:20 +0000)]
Use filename in linemarker when compiling preprocessed source (Revised)

Summary:
This is a revised version of D28796. Included test is changed to
resolve the target compatibility issue reported (rL293032).

Reviewers: inglorion, dblaikie, echristo, aprantl, probinson

Reviewed By: inglorion

Subscribers: mehdi_amini, cfe-commits

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

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

7 years agofix test to not check optimized IR; NFCI
Sanjay Patel [Tue, 7 Mar 2017 19:24:54 +0000 (19:24 +0000)]
fix test to not check optimized IR; NFCI

This test broke with an LLVM instcombine patch (r297166).
I changed the RUN line to only run -mem2reg (to save time checking this large chunk of tests)
and updated the checks using the script attached to D17999:
https://reviews.llvm.org/D17999

The goal is to make this test immune to optimizer changes. If there's something in these
tests that was checking for an IR optimization, that should be tested in LLVM, not Clang.

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

7 years ago[analyzer] Fix crashes in CastToStruct checker for undefined structs
Daniel Marjamaki [Tue, 7 Mar 2017 19:20:48 +0000 (19:20 +0000)]
[analyzer] Fix crashes in CastToStruct checker for undefined structs

This crash was reported in https://bugs.llvm.org//show_bug.cgi?id=31173

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

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

7 years agoRevert "Document that code inlined into a nodebug function also won't get any"
Adrian Prantl [Tue, 7 Mar 2017 17:28:56 +0000 (17:28 +0000)]
Revert "Document that code inlined into a nodebug function also won't get any"

This reverts commit r296776.
This statement is no longer true.

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

7 years ago[analyzer] Improve valist checks and move it out from alpha state.
Gabor Horvath [Tue, 7 Mar 2017 16:04:23 +0000 (16:04 +0000)]
[analyzer] Improve valist checks and move it out from alpha state.

This patch makes the valist check more robust to the different AST variants on
different platforms and also fixes a FIXME.

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

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

7 years ago[clang-format] Followup of D30646 - unbreak the build
Andi-Bogdan Postelnicu [Tue, 7 Mar 2017 15:20:31 +0000 (15:20 +0000)]
[clang-format] Followup of D30646 - unbreak the build

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

7 years ago[clang-format] Fixed indent issue when adding a comment at the end of a return type...
Andi-Bogdan Postelnicu [Tue, 7 Mar 2017 14:48:02 +0000 (14:48 +0000)]
[clang-format] Fixed indent issue when adding a comment at the end of a return type in named function declaration.

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

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

7 years ago[clang-format] Support namespaces ending in semicolon
Krasimir Georgiev [Tue, 7 Mar 2017 14:07:43 +0000 (14:07 +0000)]
[clang-format] Support namespaces ending in semicolon

Summary:
This patch adds support for namespaces ending in semicolon to the namespace comment fixer.
source:
```
namespace A {
  int i;
  int j;
};
```
clang-format before:
```
namespace A {
  int i;
  int j;
} // namespace A;
```
clang-format after:
```
namespace A {
  int i;
  int j;
}; // namespace A
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[index] Mark categories of test classes with the 'UnitTest' symbol property as well.
Argyrios Kyrtzidis [Tue, 7 Mar 2017 09:38:08 +0000 (09:38 +0000)]
[index] Mark categories of test classes with the 'UnitTest' symbol property as well.

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

7 years ago[AST/ObjC] Make ObjCCategoryImplDecl consistent with ObjCCategoryDecl and use the...
Argyrios Kyrtzidis [Tue, 7 Mar 2017 09:26:07 +0000 (09:26 +0000)]
[AST/ObjC] Make ObjCCategoryImplDecl consistent with ObjCCategoryDecl and use the category name as its DeclName

This also addresses the badness in ObjCCategoryImplDecl's API, which was hiding NamedDecl's APIs with different meaning.

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

7 years ago[analyzer] Fix crash when building CFG with variable of incomplete type
Martin Bohme [Tue, 7 Mar 2017 08:42:37 +0000 (08:42 +0000)]
[analyzer] Fix crash when building CFG with variable of incomplete type

Summary:
I've included a unit test with a function template containing a variable
of incomplete type. Clang compiles this without errors (the standard
does not require a diagnostic in this case). Without the fix, this case
triggers the crash.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

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

7 years agoDefine LLVM_ENABLE_WARNINGS when building standalone clang to ensure warnings get...
Eric Fiselier [Tue, 7 Mar 2017 00:15:18 +0000 (00:15 +0000)]
Define LLVM_ENABLE_WARNINGS when building standalone clang to ensure warnings get enabled

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

7 years agoFix unused variable in SemaCoroutine.cpp
Eric Fiselier [Tue, 7 Mar 2017 00:01:13 +0000 (00:01 +0000)]
Fix unused variable in SemaCoroutine.cpp

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

7 years agoFix some widespread warnings in headers from the new coroutine code
Reid Kleckner [Mon, 6 Mar 2017 23:52:53 +0000 (23:52 +0000)]
Fix some widespread warnings in headers from the new coroutine code

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

7 years agoRelax stmtexpr.cpp checks for PPC64
Reid Kleckner [Mon, 6 Mar 2017 23:49:18 +0000 (23:49 +0000)]
Relax stmtexpr.cpp checks for PPC64

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

7 years agoSet the Int64Type / IntMaxType types correctly for OpenBSD/mips64
Brad Smith [Mon, 6 Mar 2017 23:48:31 +0000 (23:48 +0000)]
Set the Int64Type / IntMaxType types correctly for OpenBSD/mips64

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

7 years ago[coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.
Eric Fiselier [Mon, 6 Mar 2017 23:38:15 +0000 (23:38 +0000)]
[coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

Summary:
The changes contained in this patch are:

1. Defines a new AST node `CoawaitDependentExpr` for representing co_await expressions while the promise type is still dependent.
2. Correctly detect and transform the 'co_await' operand to  `p.await_transform(<expr>)`  when possible.
3. Change the initial/final suspend points to build during the initial parse, so they have the correct operator co_await lookup results.
4.  Fix transformation of the CoroutineBodyStmt so that it doesn't re-build the final/initial suspends.

@rsmith: This change is a little big, but it's not trivial for me to split it up. Please let me know if you would prefer this submitted as multiple patches.

Reviewers: rsmith, GorNishanov

Reviewed By: rsmith

Subscribers: ABataev, rsmith, mehdi_amini, cfe-commits

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

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

7 years ago[coroutines] Improve diagnostics when building implicit constructs.
Eric Fiselier [Mon, 6 Mar 2017 22:52:28 +0000 (22:52 +0000)]
[coroutines] Improve diagnostics when building implicit constructs.

Previously when a coroutine was building the implicit setup/destroy
constructs it would emit diagostics about failures on the first co_await/co_return/co_yield
it encountered. This was confusing because that construct may not itself be ill-formed.

This patch moves the diagnostics to the function start instead.

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

7 years agoDon't assume cleanup emission preserves dominance in expr evaluation
Reid Kleckner [Mon, 6 Mar 2017 22:18:34 +0000 (22:18 +0000)]
Don't assume cleanup emission preserves dominance in expr evaluation

Summary:
Because of the existence branches out of GNU statement expressions, it
is possible that emitting cleanups for a full expression may cause the
new insertion point to not be dominated by the result of the inner
expression. Consider this example:

  struct Foo { Foo(); ~Foo(); int x; };
  int g(Foo, int);
  int f(bool cond) {
    int n = g(Foo(), ({ if (cond) return 0; 42; }));
    return n;
  }

Before this change, result of the call to 'g' did not dominate its use
in the store to 'n'. The early return exit from the statement expression
branches to a shared cleanup block, which ends in a switch between the
fallthrough destination (the assignment to 'n') or the function exit
block.

This change solves the problem by spilling and reloading expression
evaluation results when any of the active cleanups have branches.

I audited the other call sites of enterFullExpression, and they don't
appear to keep and Values live across the site of the cleanup, except in
ARC code. I wasn't able to create a test case for ARC that exhibits this
problem, though.

Reviewers: rjmccall, rsmith

Subscribers: cfe-commits

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

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

7 years ago[coroutines] Add co_return statement emission
Gor Nishanov [Mon, 6 Mar 2017 21:12:54 +0000 (21:12 +0000)]
[coroutines] Add co_return statement emission

Summary:
Added co_return statement emission.

Tweaked coro-alloc.cpp test to use co_return to trigger coroutine processing instead of co_await, since this change starts emitting the body of the coroutine and await expression handling has not been upstreamed yet.

Reviewers: rsmith, majnemer, EricWF, aaron.ballman

Reviewed By: rsmith

Subscribers: majnemer, llvm-commits, mehdi_amini

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

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

7 years ago[MS] Add support for __ud2 and __int2c MSVC intrinsics
Reid Kleckner [Mon, 6 Mar 2017 19:43:16 +0000 (19:43 +0000)]
[MS] Add support for __ud2 and __int2c MSVC intrinsics

This was requested in PR31958 and elsewhere.

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

7 years agoFurther fixes and improvements to the ConstantInitBuilder API.
John McCall [Mon, 6 Mar 2017 19:04:16 +0000 (19:04 +0000)]
Further fixes and improvements to the ConstantInitBuilder API.

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

7 years ago[modules] Add missing test from r297030.
Vassil Vassilev [Mon, 6 Mar 2017 17:47:57 +0000 (17:47 +0000)]
[modules] Add missing test from r297030.

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

7 years ago[clang-format] Add tests for ambiguous namespaces to the comment fixer
Krasimir Georgiev [Mon, 6 Mar 2017 17:29:25 +0000 (17:29 +0000)]
[clang-format] Add tests for ambiguous namespaces to the comment fixer

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

7 years ago[modules] Make GNUMode a normal language option to fix module compilation.
Vassil Vassilev [Mon, 6 Mar 2017 16:54:40 +0000 (16:54 +0000)]
[modules] Make GNUMode a normal language option to fix module compilation.

GNUMode shouldn't be a benign language option because it influences the
resulting AST when checking for the existence of GNUMode-specific macro
"linux" (e.g. by having code inside #ifdef linux). This patch marks it as a
normal language option so it gets correctly passed to the compiler invocation
for the used modules.

The added test case illustrated this because it compiles without modules, but
fails when using modules.

Patch by Raphael Isemann (D30496)!

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

7 years ago[clang-format] Make NamespaceEndCommentFixer add at most one comment
Krasimir Georgiev [Mon, 6 Mar 2017 16:44:45 +0000 (16:44 +0000)]
[clang-format] Make NamespaceEndCommentFixer add at most one comment

Summary:
Until now, NamespaceEndCommentFixer was adding missing comments for every run,
which results in multiple end comments for:
```
namespace {
  int i;
  int j;
}
#if A
  int a = 1;
#else
  int a = 2;
#endif
```
result before:

```
namespace {
  int i;
  int j;
}// namespace // namespace
#if A
  int a = 1;
#else
  int a = 2;
#endif
```
result after:
```
namespace {
  int i;
  int j;
}// namespace
#if A
  int a = 1;
#else
  int a = 2;
#endif
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[Docs] Add missing quotes to the language literal in the
Alex Lorenz [Mon, 6 Mar 2017 16:37:06 +0000 (16:37 +0000)]
[Docs] Add missing quotes to the language literal in the
external_source_symbol attribute docs

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

7 years agoAdd examples to clang-format configuration
Sylvestre Ledru [Mon, 6 Mar 2017 16:35:28 +0000 (16:35 +0000)]
Add examples to clang-format configuration

Reviewers: klimek, djasper

Reviewed By: djasper

Subscribers: krasimir, kimgr, cfe-commits

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

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

7 years ago[CodeGen][Blocks] Refactor capture handling in code that generates
Alex Lorenz [Mon, 6 Mar 2017 16:23:04 +0000 (16:23 +0000)]
[CodeGen][Blocks] Refactor capture handling in code that generates
block copy/destroy routines

This is a preparation commit for work on merging unique block copy/destroy
helper functions.

rdar://22950898

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

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

7 years ago[Sema][ObjC] Warn about 'performSelector' calls with selectors
Alex Lorenz [Mon, 6 Mar 2017 15:58:34 +0000 (15:58 +0000)]
[Sema][ObjC] Warn about 'performSelector' calls with selectors
that return record or vector types

The performSelector family of methods from Foundation use objc_msgSend to
dispatch the selector invocations to objects. However, method calls to methods
that return record types might have to use the objc_msgSend_stret as the return
value won't find into the register. This is also supported by this sentence from
performSelector documentation: "The method should not have a significant return
value and should take a single argument of type id, or no arguments". This
commit adds a new warning that warns when a selector which corresponds to a
method that returns a record type is passed into performSelector.

rdar://12056271

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

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

7 years agoDo not include GCC "resource" directory into the set of built-in include paths on...
Anton Korobeynikov [Mon, 6 Mar 2017 09:32:56 +0000 (09:32 +0000)]
Do not include GCC "resource" directory into the set of built-in include paths on MingW.

Patch by Mateusz MikuĊ‚a.

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

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

7 years ago[XRay] [clang] Allow logging the first argument of a function call.
Dean Michael Berris [Mon, 6 Mar 2017 07:08:21 +0000 (07:08 +0000)]
[XRay] [clang] Allow logging the first argument of a function call.

Summary:
Functions with the "xray_log_args" attribute will tell LLVM to emit a special
XRay sled for compiler-rt to copy any call arguments to your logging handler.

Reviewers: dberris

Reviewed By: dberris

Subscribers: cfe-commits

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

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

7 years ago[ubsan] Extend the nonnull arg check to ObjC
Vedant Kumar [Mon, 6 Mar 2017 05:28:22 +0000 (05:28 +0000)]
[ubsan] Extend the nonnull arg check to ObjC

UBSan's nonnull argument check applies when a parameter has the
"nonnull" attribute. The check currently works for FunctionDecls, but
not for ObjCMethodDecls. This patch extends the check to work for ObjC.

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

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

7 years agoGCC workaround: use explicit qualification to avoid injected class name.
John McCall [Sat, 4 Mar 2017 21:46:14 +0000 (21:46 +0000)]
GCC workaround: use explicit qualification to avoid injected class name.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52625

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

7 years agoRefactor ConstantInitBuilder to allow other frontends to more
John McCall [Sat, 4 Mar 2017 21:26:29 +0000 (21:26 +0000)]
Refactor ConstantInitBuilder to allow other frontends to more
easily extend the aggregate-builder API.  Stupid missing language
features.

Also add APIs for constructing a relative reference and computing
the offset of a position from the start of the initializer.

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

7 years ago[index] C++: Improve handling of typedefs as base names in C++ class declarations
Argyrios Kyrtzidis [Sat, 4 Mar 2017 17:54:56 +0000 (17:54 +0000)]
[index] C++: Improve handling of typedefs as base names in C++ class declarations

Report the typedef as reference, and desugar it to report the underlying class as an
implicit 'base' reference.
Reporting the underlying base class for 'base' relations matches the ObjC handling and
leads to a simpler model.

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

7 years ago[index] ObjC: Improve handling of typedefs as base names in ObjC interface declarations
Argyrios Kyrtzidis [Sat, 4 Mar 2017 17:54:53 +0000 (17:54 +0000)]
[index] ObjC: Improve handling of typedefs as base names in ObjC interface declarations

- Report the typedef reference occurrence
- Mark super or protocol references as 'implicit' when they come from a typedef.

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

7 years ago[ODRHash] Try again to fix build bot.
Richard Trieu [Sat, 4 Mar 2017 03:04:15 +0000 (03:04 +0000)]
[ODRHash] Try again to fix build bot.

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

7 years agoHandle null QualType better in Stmt::Profile
Richard Trieu [Sat, 4 Mar 2017 02:42:41 +0000 (02:42 +0000)]
Handle null QualType better in Stmt::Profile

If the QualType is null, calling ASTContext::getCanonicalType on it will lead
to an assert.  This was found while testing a new use for Stmt::Profile, so
there is no test case for this.

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

7 years ago[ODRHash] Change test to try to appease buildbot.
Richard Trieu [Sat, 4 Mar 2017 02:05:13 +0000 (02:05 +0000)]
[ODRHash] Change test to try to appease buildbot.

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

7 years ago[scan-build-py] create decorator for compiler wrapper methods
Laszlo Nagy [Sat, 4 Mar 2017 01:08:05 +0000 (01:08 +0000)]
[scan-build-py] create decorator for compiler wrapper methods

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

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

7 years ago[ODRHash] Add support for detecting different method properties.
Richard Trieu [Sat, 4 Mar 2017 00:08:58 +0000 (00:08 +0000)]
[ODRHash] Add support for detecting different method properties.

Now print diagnostics for static, virtual, inline, volatile, and const
differences in methods.  Also use DeclarationName instead of IdentifierInfo
for additional robustness in diagnostic printing.

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

7 years agoRestrict test arch-specific-libdir.c to Linux
Pirama Arumuga Nainar [Fri, 3 Mar 2017 23:48:15 +0000 (23:48 +0000)]
Restrict test arch-specific-libdir.c to Linux

Summary: This fails on Windows due to dependence on path separators.

Reviewers: rnk, srhines

Subscribers: llvm-commits

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

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

7 years agoAdd arch-specific directory to search path
Pirama Arumuga Nainar [Fri, 3 Mar 2017 23:20:49 +0000 (23:20 +0000)]
Add arch-specific directory to search path

Summary:

This change adds an arch-specific subdirectory in <ResourceDir>/lib/<OS>
to the linker search path.  This path also gets added as '-rpath' for
native compilation if a runtime is linked in as a shared object.  This
allows arch-specific libraries to be installed alongside clang.

Reviewers: danalbert, cbergstrom, javed.absar

Subscribers: srhines

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

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

7 years agoReland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint...
Dominic Chen [Fri, 3 Mar 2017 18:02:02 +0000 (18:02 +0000)]
Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers

Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952.

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

Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits

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

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

7 years ago[Analyzer] Terminate analysis on OpenMP code instead of assertion crash
Aleksei Sidorin [Fri, 3 Mar 2017 16:58:53 +0000 (16:58 +0000)]
[Analyzer] Terminate analysis on OpenMP code instead of assertion crash

* ExprEngine assumes that OpenMP statements should never appear in CFG.
  However, current CFG doesn't know anything about OpenMP and passes
  such statements as CFG nodes causing "UNREACHABLE executed!" crashes.
  Since there is no OpenMP implementation in ExprEngine or CFG,
  we stop the analysis on OpenMP statements to avoid crashes.

This fixes PR31835.

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

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

7 years ago[PowerPC] Enable -fomit-frame-pointer by default for PPC
Nemanja Ivanovic [Fri, 3 Mar 2017 09:49:17 +0000 (09:49 +0000)]
[PowerPC] Enable -fomit-frame-pointer by default for PPC

As is the case on platforms like Mips, X86 and SystemZ, the -fomit-frame-pointer
should be enabled by default on PPC when optimizing at -O1 and above. This
brings the behaviour of LLVM on PPC in line with GCC.

Committing on behalf of Hiroshi Inoue.

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

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

7 years agoFix msc-version.c test to handle _MSC_VER=1910
Dave Bartolomeo [Fri, 3 Mar 2017 00:08:55 +0000 (00:08 +0000)]
Fix msc-version.c test to handle _MSC_VER=1910

Previously, VC++ has always set _MSC_VER to a four-digit value with the two least significant digits set to zero. Visual Studio 2017, however, sets _MSC_VER=1910, and we expect to update the least significant digit as we release major updates for VS 2017. This patch fixes the msc-version.c test to handle non-zero values in the two least significant digits of _MSC_VER.

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

7 years agoRevert "Reland 3: [analyzer] NFC: Update test infrastructure to support multiple...
Dominic Chen [Thu, 2 Mar 2017 23:30:53 +0000 (23:30 +0000)]
Revert "Reland 3: [analyzer] NFC: Update test infrastructure to support multiple constraint managers"

This reverts commit ea36f1406e1f36bf456c3f3929839b024128e468.

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

7 years agoReland 3: [analyzer] NFC: Update test infrastructure to support multiple constraint...
Dominic Chen [Thu, 2 Mar 2017 23:05:45 +0000 (23:05 +0000)]
Reland 3: [analyzer] NFC: Update test infrastructure to support multiple constraint managers

Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952.

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

Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits

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

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

7 years agoRevert "Reland 2: [analyzer] NFC: Update test infrastructure to support multiple...
Dominic Chen [Thu, 2 Mar 2017 22:58:06 +0000 (22:58 +0000)]
Revert "Reland 2: [analyzer] NFC: Update test infrastructure to support multiple constraint managers"

This reverts commit f93343c099fff646a2314cc7f4925833708298b1.

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

7 years agoReland 2: [analyzer] NFC: Update test infrastructure to support multiple constraint...
Dominic Chen [Thu, 2 Mar 2017 22:45:24 +0000 (22:45 +0000)]
Reland 2: [analyzer] NFC: Update test infrastructure to support multiple constraint managers

Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952.

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

Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits

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

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

7 years agoPromote ConstantInitBuilder to be a public CodeGen API; it's
John McCall [Thu, 2 Mar 2017 20:04:19 +0000 (20:04 +0000)]
Promote ConstantInitBuilder to be a public CodeGen API; it's
a generally useful utility for other frontends.  NFC.

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

7 years agoAdd coding and shebang.
Vassil Vassilev [Thu, 2 Mar 2017 18:47:22 +0000 (18:47 +0000)]
Add coding and shebang.

Reviewed by Artem Dergachev (D26030)!

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

7 years agoMark function as llvm dump method.
Vassil Vassilev [Thu, 2 Mar 2017 18:13:19 +0000 (18:13 +0000)]
Mark function as llvm dump method.

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

7 years agoDocument that code inlined into a nodebug function also won't get any
Adrian Prantl [Thu, 2 Mar 2017 18:06:51 +0000 (18:06 +0000)]
Document that code inlined into a nodebug function also won't get any
debug info.

Suggested by Paul Robinson in feedback on r296488, thanks!

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

7 years agoSerialization: use the PCH chain to check PCH mode
Saleem Abdulrasool [Thu, 2 Mar 2017 17:37:11 +0000 (17:37 +0000)]
Serialization: use the PCH chain to check PCH mode

When we are deciding whether we are creating a PCH or a module, we would
check if the ModuleMgr had any elements to switch into PCH mode.
However, when creating a module, the size may be 1.  This would result
in us going down the wrong path.

This was found by cross-compiling the swift standard library.  Use the
PCH chain length instead to identify the PCH mode.

Unfortunately, I have not yet been able to create a simple test case for
this, but have verified that this fixes the swift standard library
construction.

Thanks to Adrian Prantl for help and discussions with this change!

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

7 years agoDon't write to LLVMStyle.JavaScriptQuotes twice. No behavior change.
Nico Weber [Thu, 2 Mar 2017 14:51:54 +0000 (14:51 +0000)]
Don't write to LLVMStyle.JavaScriptQuotes twice. No behavior change.

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

7 years ago[clang-format] Use number of unwrapped lines for short namespace
Krasimir Georgiev [Thu, 2 Mar 2017 09:54:44 +0000 (09:54 +0000)]
[clang-format] Use number of unwrapped lines for short namespace

Summary:
This patch makes the namespace comment fixer use the number of unwrapped lines
that a namespace spans to detect it that namespace is short, thus not needing
end comments to be added.
This is needed to ensure clang-format is idempotent. Previously, a short namespace
was detected by the original source code lines. This has the effect of requiring two
runs for this example:
```
namespace { class A; }
```
after first run:
```
namespace {
class A;
}
```
after second run:
```
namespace {
class A;
} // namespace
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoclang-format: [JS] Properly format object literals with shorthands.
Daniel Jasper [Wed, 1 Mar 2017 19:47:28 +0000 (19:47 +0000)]
clang-format: [JS] Properly format object literals with shorthands.

Before:
  return {
    a,
    b: 'b', c,
  };

After:
  return {
    a,
    b: 'b',
    c,
  };

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

7 years agoclang-format: [JS/TS] Properly understand cast expressions.
Daniel Jasper [Wed, 1 Mar 2017 19:26:12 +0000 (19:26 +0000)]
clang-format: [JS/TS] Properly understand cast expressions.

Many things were wrong:
- We didn't always allow wrapping after "as", which can be necessary.
- We used to Undestand the identifier after "as" as a start of a name.
- We didn't properly parse the structure of the expression with "as"
  having the precedence of relational operators

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

7 years ago[PCH] Avoid VarDecl emission attempt if no owning module avaiable
Bruno Cardoso Lopes [Wed, 1 Mar 2017 19:18:42 +0000 (19:18 +0000)]
[PCH] Avoid VarDecl emission attempt if no owning module avaiable

This is a stopgap fix for PR31863, a regression introduced in r276159.

Consider this snippet:

struct FVector;
struct FVector {};
struct FBox {
  FVector Min;
  FBox(int);
};
namespace {
FBox InvalidBoundingBox(0);
}

While parsing the DECL_VAR for 'struct FBox', clang recursively read all the
dep decls until it finds the DECL_CXX_RECORD forward declaration for 'struct
FVector'. Then, it resumes all the way up back to DECL_VAR handling in
`ReadDeclRecord`, where it checks if `isConsumerInterestedIn` for the decl.

One of the condition for `isConsumerInterestedIn` to return false is if the
VarDecl is imported from a module `D->getImportedOwningModule()`, because it
will get emitted when we import the relevant module. However, before checking
if it comes from a module, clang checks if `Ctx.DeclMustBeEmitted(D)`, which
triggers the emission of 'struct FBox'. Since one of its fields is still
incomplete, it crashes.

Instead, check if `D->getImportedOwningModule()` is true before calling
`Ctx.DeclMustBeEmitted(D)`.

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

rdar://problem/30173654

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

7 years agoIntroduce an 'external_source_symbol' attribute that describes the origin
Alex Lorenz [Wed, 1 Mar 2017 18:06:25 +0000 (18:06 +0000)]
Introduce an 'external_source_symbol' attribute that describes the origin
and the nature of a declaration

This commit adds an external_source_symbol attribute to Clang. This attribute
specifies that a declaration originates from an external source and describes
the nature of that source. This attribute will be used to improve IDE features
like 'jump-to-definition' for mixed-language projects or project that use
auto-generated code.

rdar://30423368

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

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

7 years ago[Test] NFC: Fixed typo in comments
Charles Li [Wed, 1 Mar 2017 17:55:03 +0000 (17:55 +0000)]
[Test] NFC: Fixed typo in comments

Changed "declerations" to "declarations"

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

7 years ago[analyzer] pr32088: Don't destroy the temporary if its initializer causes return.
Devin Coughlin [Wed, 1 Mar 2017 17:48:39 +0000 (17:48 +0000)]
[analyzer] pr32088: Don't destroy the temporary if its initializer causes return.

In the following code involving GNU statement-expression extension:
  struct S {
    ~S();
  };

  void foo() {
    const S &x = ({ return; S(); });
  }
function 'foo()' returns before reference x is initialized. We shouldn't call
the destructor for the temporary object lifetime-extended by 'x' in this case,
because the object never gets constructed in the first place.

The real problem is probably in the CFG somewhere, so this is a quick-and-dirty
hotfix rather than the perfect solution.

A patch by Artem Dergachev!

rdar://problem/30759076

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

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