]> granicus.if.org Git - clang/log
clang
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

7 years ago[clang-format] Don't add namespace end comments for unbalanced right braces after...
Krasimir Georgiev [Wed, 1 Mar 2017 16:38:08 +0000 (16:38 +0000)]
[clang-format] Don't add namespace end comments for unbalanced right braces after namespace end

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

7 years ago[clang-format] Add a new flag FixNamespaceComments to FormatStyle
Krasimir Georgiev [Wed, 1 Mar 2017 15:35:39 +0000 (15:35 +0000)]
[clang-format] Add a new flag FixNamespaceComments to FormatStyle

Summary:
This patch enables namespace end comments under a new flag FixNamespaceComments,
which is enabled for the LLVM and Google styles.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoIntroducing clang::tooling::AtomicChange for refactoring tools.
Eric Liu [Wed, 1 Mar 2017 13:14:01 +0000 (13:14 +0000)]
Introducing clang::tooling::AtomicChange for refactoring tools.

Summary:
An AtomicChange is used to create and group a set of source edits, e.g.
replacements or header insertions. Edits in an AtomicChange should be related,
e.g. replacements for the same type reference and the corresponding header
insertion/deletion.

An AtomicChange is uniquely identified by a key position and will either be
fully applied or not applied at all. The key position should be the location
of the key syntactical element that is being changed, e.g. the call to a
refactored method.

Next step: add a tool that applies AtomicChange.

Reviewers: klimek, djasper

Reviewed By: klimek

Subscribers: alexshap, cfe-commits, djasper, mgorny

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

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

7 years agoFix r296605 so that stuff in #ifndef SWIG blocks is still formatted.
Daniel Jasper [Wed, 1 Mar 2017 11:10:11 +0000 (11:10 +0000)]
Fix r296605 so that stuff in #ifndef SWIG blocks is still formatted.

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

7 years agoclang-format: Ignore contents of #ifdef SWIG .. #endif blocks.
Daniel Jasper [Wed, 1 Mar 2017 10:47:52 +0000 (10:47 +0000)]
clang-format: Ignore contents of #ifdef SWIG .. #endif blocks.

Those blocks are used if C++ code is SWIG-wrapped (see swig.org) and
usually do not contain C++ code. Also cleanup the implementation of for #if 0
and #if false a bit.

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

7 years ago[Sema] Improve side effect checking for unused-lambda-capture warning
Malcolm Parsons [Wed, 1 Mar 2017 10:23:38 +0000 (10:23 +0000)]
[Sema] Improve side effect checking for unused-lambda-capture warning

Summary:
Don't warn about unused lambda captures that involve copying a
value of a type that cannot be trivially copied and destroyed.

Fixes PR31977

Reviewers: rsmith, aaron.ballman

Subscribers: cfe-commits

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

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

7 years ago[Sema] Add variable captured by a block to the enclosing lambda's
Akira Hatanaka [Wed, 1 Mar 2017 06:11:25 +0000 (06:11 +0000)]
[Sema] Add variable captured by a block to the enclosing lambda's
potential capture list.

Fix Sema::getCurLambda() to return the innermost lambda scope when there
is a block enclosed in the lambda. Previously, the method would return a
nullptr in such cases, which would prevent a variable captured by the
enclosed block to be added to the lambda scope's potential capture list.

rdar://problem/28412462

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

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

7 years agoAdd warning for inconsistent overrides on destructor.
Richard Trieu [Wed, 1 Mar 2017 03:07:55 +0000 (03:07 +0000)]
Add warning for inconsistent overrides on destructor.

The exisiting warning for inconsistent overrides does not include the destructor
as it was noted in review that it was too noisy.  Instead, add to a separate
warning group that is off by default for users who want consistent warnings
between methods and destructors.

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

7 years ago[Analyzer] Fix crash in ObjCPropertyChecker on protocol property
Devin Coughlin [Wed, 1 Mar 2017 01:47:37 +0000 (01:47 +0000)]
[Analyzer] Fix crash in ObjCPropertyChecker on protocol property

Fix a crash in the ObjCPropertyChecker when analyzing a 'copy' property of an
NSMutable* type in a protocol.

rdar://problem/30766684

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

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

7 years ago[PS4] Set our default dialect to C++11. NFC for other targets.
Paul Robinson [Wed, 1 Mar 2017 01:01:10 +0000 (01:01 +0000)]
[PS4] Set our default dialect to C++11. NFC for other targets.
Reapplies r296209 now that r296549 has fixed what really seems to be
the last problematic test.

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

7 years ago[Test] Make Lit tests C++11 compatible - IR ordering
Charles Li [Wed, 1 Mar 2017 00:10:00 +0000 (00:10 +0000)]
[Test] Make Lit tests C++11 compatible - IR ordering

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

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

7 years ago[ODRHash] Add basic support for CXXRecordDecl
Richard Trieu [Tue, 28 Feb 2017 21:24:38 +0000 (21:24 +0000)]
[ODRHash] Add basic support for CXXRecordDecl

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

7 years agoAllow attributes before union definition
Erich Keane [Tue, 28 Feb 2017 20:44:39 +0000 (20:44 +0000)]
Allow attributes before union definition

permits typedef union __attribute__((transparent_union)) {...}

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

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

7 years agoclang-format: [Java] Fix bug in enum formatting.
Daniel Jasper [Tue, 28 Feb 2017 18:28:15 +0000 (18:28 +0000)]
clang-format: [Java] Fix bug in enum formatting.

Before:
  public enum VeryLongEnum {
    ENUM_WITH_MANY_PARAMETERS("aaaaaaaaaaaaaaaaaaaaaa",
                              "bbbbbbbbbbbbbbbbbbbbbbbbbbb",
                              "ccccccccccccccccccc")
    ,
    SECOND_ENUM("a", "b", "c");

    private VeryLongEnum(String a, String b, String c) {}
  }

After:
  public enum VeryLongEnum {
    ENUM_WITH_MANY_PARAMETERS("aaaaaaaaaaaaaaaaaaaaaa",
                              "bbbbbbbbbbbbbbbbbbbbbbbbbbb",
                              "ccccccccccccccccccc") ,
    SECOND_ENUM("a", "b", "c");

    private VeryLongEnum(String a, String b, String c) {}
  }

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

7 years agoMigrate all of aarch64-linux-gnu to \01_mcount instead of just when passing along...
Eric Christopher [Tue, 28 Feb 2017 17:22:05 +0000 (17:22 +0000)]
Migrate all of aarch64-linux-gnu to \01_mcount instead of just when passing along gnueabi as this matches both gcc and what the kernel expects.

More of PR27311

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

7 years agoDriver: Update devtoolset usage for RHEL
Tom Stellard [Tue, 28 Feb 2017 16:46:19 +0000 (16:46 +0000)]
Driver: Update devtoolset usage for RHEL

- remove path to dts-1.x (corresponds to gcc 4.7)
- add path to dts-6 (corresponds to 6.x)

Patch By: Maria Gottschalk

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

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

7 years ago[Sema] Detect more array index out of bounds when C++ overloaded operators are used
Daniel Marjamaki [Tue, 28 Feb 2017 14:53:50 +0000 (14:53 +0000)]
[Sema] Detect more array index out of bounds when C++ overloaded operators are used

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

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

7 years agoBlacklist arbitrary @\\w+ JSDoc tags from wrapping.
Martin Probst [Tue, 28 Feb 2017 11:08:24 +0000 (11:08 +0000)]
Blacklist arbitrary @\\w+ JSDoc tags from wrapping.

Summary:
Also limits the blacklisting to only apply when the tag is actually
followed by a parameter in curly braces.

    /** @mods {long.type.must.not.wrap} */

vs

    /** @const this is a long description that may wrap. */

Reviewers: djasper

Subscribers: klimek, krasimir, cfe-commits

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

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

7 years agoclang/test/Format/inplace.cpp: Avoid using wildcard.
NAKAMURA Takumi [Tue, 28 Feb 2017 10:05:56 +0000 (10:05 +0000)]
clang/test/Format/inplace.cpp: Avoid using wildcard.

MSYS' tools don't do globbing.

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

7 years ago[ARM] Don't pass -arm-execute-only to cc1as
Christof Douma [Tue, 28 Feb 2017 09:09:53 +0000 (09:09 +0000)]
[ARM] Don't pass -arm-execute-only to cc1as

The option -mexecute-only is translated into the backend option
-arm-execute-only. But this option only makes sense for the compiler and
the assembler does not recognize it. This patch stops clang from passing
this option to the assembler.

Change-Id: I4f4cb1162c13cfd50a0a36702a4ecab1bc0324ba
Review: https://reviews.llvm.org/D30414

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

7 years ago[clang-format] Fix test failure caused by "rm" on some buildbots.
Haojian Wu [Tue, 28 Feb 2017 09:03:07 +0000 (09:03 +0000)]
[clang-format] Fix test failure caused by "rm" on some buildbots.

The begining command "rm" will return 1 when there is not such file to
delete.

This patch is to remove it, as it's not needed for the test.

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

7 years agoSet ABIs correctly for OpenBSD/arm; soft float and aapcs-linux.
Brad Smith [Tue, 28 Feb 2017 03:20:26 +0000 (03:20 +0000)]
Set ABIs correctly for OpenBSD/arm; soft float and aapcs-linux.

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

7 years agoRevert "Reland: [analyzer] NFC: Update test infrastructure to support multiple constr...
Dominic Chen [Tue, 28 Feb 2017 01:50:23 +0000 (01:50 +0000)]
Revert "Reland: [analyzer] NFC: Update test infrastructure to support multiple constraint managers"

This reverts commit 1b28d0b10e1c8feccb971abb6ef7a18bee589830.

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

7 years agoReland: [analyzer] NFC: Update test infrastructure to support multiple constraint...
Dominic Chen [Tue, 28 Feb 2017 00:02:36 +0000 (00:02 +0000)]
Reland: [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@296414 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: Don't leave behind temp files in -i mode on Windows, PR26125, reloaded
Nico Weber [Mon, 27 Feb 2017 22:59:58 +0000 (22:59 +0000)]
clang-format: Don't leave behind temp files in -i mode on Windows, PR26125, reloaded

Second attempt after http://llvm.org/viewvc/llvm-project?rev=296166&view=rev

In the first attempt, Code (the memory buffer backing the input file) was reset
before overwriteChangedFiles() was called, but overwriteChangedFiles() still
reads from it.  This time, load the whole input file into memory instead of
using mmap when formatting in-place.

(Since the test is identical to what was in the repo before chapuni's revert,
svn diff doesn't show it – see the above link for the test.)

https://reviews.llvm.org/D30385

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

7 years agoPR32042: Create inlined debug info for EmitInlinedInheritingCXXConstructorCall.
Adrian Prantl [Mon, 27 Feb 2017 21:30:05 +0000 (21:30 +0000)]
PR32042: Create inlined debug info for EmitInlinedInheritingCXXConstructorCall.

When clang emits an inheriting C++ constructor it may inline code
during the CodeGen phase. This patch ensures that any debug info in
this inlined code gets a proper inlined location. Otherwise we can end
up with invalid debug info metadata, since all inlined local variables
and function arguments would be reparented into the call site.

Analogous to ApplyInlineLocation this patch introduces a
ApplyInlineDebugLocation scoped helper to facilitate entering an
inlined scope and cleaning up afterwards.

This fixes one of the issues discovered in PR32042.

rdar://problem/30679307

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

7 years agoUBSan docs: Explicitly mention that `-fsanitize=unsigned-integer-overflow` does not...
Nico Weber [Mon, 27 Feb 2017 21:27:07 +0000 (21:27 +0000)]
UBSan docs: Explicitly mention that `-fsanitize=unsigned-integer-overflow` does not catch UB.

https://reviews.llvm.org/D27455

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

7 years agoRemove unused variable
David Blaikie [Mon, 27 Feb 2017 21:14:42 +0000 (21:14 +0000)]
Remove unused variable

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

7 years ago[ubsan] Factor out logic to emit a range check. NFC.
Vedant Kumar [Mon, 27 Feb 2017 19:46:19 +0000 (19:46 +0000)]
[ubsan] Factor out logic to emit a range check. NFC.

This is a readability improvement, but it will also help prep an
upcoming patch to detect UB loads from bitfields.

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

7 years agoenable -flto=thin in clang-cl
Bob Haarman [Mon, 27 Feb 2017 19:40:19 +0000 (19:40 +0000)]
enable -flto=thin in clang-cl

Summary: This enables LTO to be used with the clang-cl frontend.

Reviewers: rnk, hans

Reviewed By: hans

Subscribers: pcc, cfe-commits, mehdi_amini, Prazek

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

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

7 years ago[clang-format] Add a NamespaceEndCommentsFixer
Krasimir Georgiev [Mon, 27 Feb 2017 13:28:36 +0000 (13:28 +0000)]
[clang-format] Add a NamespaceEndCommentsFixer

Summary:
This patch adds a NamespaceEndCommentsFixer TokenAnalyzer for clang-format,
which fixes end namespace comments.
It currently supports inserting and updating existing wrong comments.

Example source:
```
namespace A {
int i;
}

namespace B {
int j;
} // namespace A
```

after formatting:
```
namespace A {
int i;
} // namespace A

namespace B {
int j;
} // namespace B
```

Reviewers: klimek, djasper

Reviewed By: djasper

Subscribers: klimek, mgorny

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

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

7 years agoclang-format: [JS] whitespace after async in arrow functions.
Martin Probst [Mon, 27 Feb 2017 11:15:53 +0000 (11:15 +0000)]
clang-format: [JS] whitespace after async in arrow functions.

Summary:
Async arrow functions should be marked with a whitespace after the async keyword, before the parameter list:
    x = async () => foo();

Before:
    x = async() => foo();

This makes it easier to tell apart an async arrow function from a call to a function called async.

Reviewers: bkramer

Subscribers: cfe-commits, klimek

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

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

7 years ago[analyzer] clarify 'result is garbage value' when it is out of bounds
Daniel Marjamaki [Mon, 27 Feb 2017 10:44:24 +0000 (10:44 +0000)]
[analyzer] clarify 'result is garbage value' when it is out of bounds

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

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

7 years ago[GeneratePCHAction] If preprocessor option 'AllowPCHWithCompilerErrors' is enabled...
Argyrios Kyrtzidis [Mon, 27 Feb 2017 03:52:36 +0000 (03:52 +0000)]
[GeneratePCHAction] If preprocessor option 'AllowPCHWithCompilerErrors' is enabled, don't delete the produced PCH file if error diagnostics occurred.

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

7 years agoRevert "[analyzer] NFC: Update test infrastructure to support multiple constraint...
Dominic Chen [Mon, 27 Feb 2017 03:29:25 +0000 (03:29 +0000)]
Revert "[analyzer] NFC: Update test infrastructure to support multiple constraint managers"

This reverts commit 8e7780b9e59ddaad1800baf533058d2c064d4787.

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

7 years ago[analyzer] NFC: Update test infrastructure to support multiple constraint managers
Dominic Chen [Mon, 27 Feb 2017 02:36:15 +0000 (02:36 +0000)]
[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@296312 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd a cc1 flag for setting the existing Preprocessor option 'AllowPCHWithCompilerErrors'.
Argyrios Kyrtzidis [Mon, 27 Feb 2017 02:06:18 +0000 (02:06 +0000)]
Add a cc1 flag for setting the existing Preprocessor option 'AllowPCHWithCompilerErrors'.

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

7 years ago[X86] DAZ Macros Relocation
Oren Ben Simhon [Sun, 26 Feb 2017 11:58:15 +0000 (11:58 +0000)]
[X86] DAZ Macros Relocation

The DAZ feature introduces the denormal zero support for x86.
Currently the definitions are located under SSE3 header, however there are some SSE2 targets that support the feature as well.

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

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

7 years ago[index] Add 'Parameter' symbol kind and 'Local' symbol property to distinguish functi...
Argyrios Kyrtzidis [Sun, 26 Feb 2017 05:37:56 +0000 (05:37 +0000)]
[index] Add 'Parameter' symbol kind and 'Local' symbol property to distinguish function-local symbols

Parameters have a 'child' relation to their function/method.
Also add an option '-include-locals' to 'c-index-test core' to enable indexing of function-local symbols.

Original patch from Nathan Hawes with some changes by me.
https://reviews.llvm.org/D30304

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

7 years agoUpdate cxx_dr_status page.
Richard Smith [Sat, 25 Feb 2017 23:54:18 +0000 (23:54 +0000)]
Update cxx_dr_status page.

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

7 years agoC++ DR1611, 1658, 2180: implement "potentially constructed subobject" rules for speci...
Richard Smith [Sat, 25 Feb 2017 23:53:05 +0000 (23:53 +0000)]
C++ DR1611, 1658, 2180: implement "potentially constructed subobject" rules for special member functions.

Essentially, as a base class constructor does not construct virtual bases, such
a constructor for an abstract class does not need the corresponding base class
construction to be valid, and likewise for destructors.

This creates an awkward situation: clang will sometimes generate references to
the complete object and deleting destructors for an abstract class (it puts
them in the construction vtable for a derived class). But we can't generate a
"correct" version of these because we can't generate references to base class
constructors any more (if they're template specializations, say, we might not
have instantiated them and can't assume any other TU will emit a copy).
Fortunately, we don't need to, since no correct program can ever invoke them,
so instead emit symbols that just trap.

We should stop emitting references to these symbols, but still need to emit
definitions for compatibility.

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

7 years ago[test] Disable test/Index/pch-from-libclang.c for non-darwin systems.
Argyrios Kyrtzidis [Sat, 25 Feb 2017 19:17:11 +0000 (19:17 +0000)]
[test] Disable test/Index/pch-from-libclang.c for non-darwin systems.

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

7 years ago[test] Use cc1 -triple for test/Index/pch-from-libclang.c.
Argyrios Kyrtzidis [Sat, 25 Feb 2017 18:55:32 +0000 (18:55 +0000)]
[test] Use cc1 -triple for test/Index/pch-from-libclang.c.

Note quite sure why driver -target has no effect.

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

7 years ago[test] Add target to test/Index/pch-from-libclang.c.
Argyrios Kyrtzidis [Sat, 25 Feb 2017 18:35:53 +0000 (18:35 +0000)]
[test] Add target to test/Index/pch-from-libclang.c.

Attempt to fix the failing bots.

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

7 years ago[driver] Pass a resource dir without the '/../' part.
Argyrios Kyrtzidis [Sat, 25 Feb 2017 18:14:35 +0000 (18:14 +0000)]
[driver] Pass a resource dir without the '/../' part.

This get the resource dir string to match with the one from libclang (which is not adding '/../'),
and allows clang to accept a modules-enabled PCH that was created by libclang.

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

7 years ago[modules] For -module-file-info, print out the resource dir path, since it is include...
Argyrios Kyrtzidis [Sat, 25 Feb 2017 18:14:31 +0000 (18:14 +0000)]
[modules] For -module-file-info, print out the resource dir path, since it is included in the module hash.

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

7 years agoAlso test OpenBSD/powerpc here for the various types expected to be the same across...
Brad Smith [Sat, 25 Feb 2017 16:35:18 +0000 (16:35 +0000)]
Also test OpenBSD/powerpc here for the various types expected to be the same across archs.

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