Commit Graph

67766 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 898c241b26 [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.

llvm-svn: 296975
2017-03-04 17:54:56 +00:00
Argyrios Kyrtzidis 266cfa30dc [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.

llvm-svn: 296974
2017-03-04 17:54:53 +00:00
Richard Trieu f4b54fe64b [ODRHash] Try again to fix build bot.
llvm-svn: 296958
2017-03-04 03:04:15 +00:00
Richard Trieu a5f4ade268 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.

llvm-svn: 296956
2017-03-04 02:42:41 +00:00
Richard Trieu 054c35c0c1 [ODRHash] Change test to try to appease buildbot.
llvm-svn: 296953
2017-03-04 02:05:13 +00:00
Laszlo Nagy 2e9c9220b6 [scan-build-py] create decorator for compiler wrapper methods
Differential Revision: https://reviews.llvm.org/D29260

llvm-svn: 296937
2017-03-04 01:08:05 +00:00
Richard Trieu 583e2c175a [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.

llvm-svn: 296932
2017-03-04 00:08:58 +00:00
Pirama Arumuga Nainar 07215cce89 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

llvm-svn: 296929
2017-03-03 23:48:15 +00:00
Pirama Arumuga Nainar 65a16dd858 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

llvm-svn: 296927
2017-03-03 23:20:49 +00:00
Dominic Chen 184c6242fa 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

llvm-svn: 296895
2017-03-03 18:02:02 +00:00
Aleksei Sidorin f82a63277a [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

llvm-svn: 296884
2017-03-03 16:58:53 +00:00
Nemanja Ivanovic e96e697294 [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

llvm-svn: 296861
2017-03-03 09:49:17 +00:00
Dave Bartolomeo 8ffce2ade3 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.

llvm-svn: 296843
2017-03-03 00:08:55 +00:00
Dominic Chen 09d66f7528 Revert "Reland 3: [analyzer] NFC: Update test infrastructure to support multiple constraint managers"
This reverts commit ea36f1406e1f36bf456c3f3929839b024128e468.

llvm-svn: 296841
2017-03-02 23:30:53 +00:00
Dominic Chen feaf9ff5ee 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

llvm-svn: 296837
2017-03-02 23:05:45 +00:00
Dominic Chen 4a90bf8c3f Revert "Reland 2: [analyzer] NFC: Update test infrastructure to support multiple constraint managers"
This reverts commit f93343c099fff646a2314cc7f4925833708298b1.

llvm-svn: 296836
2017-03-02 22:58:06 +00:00
Dominic Chen 1cb0256a3c 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

llvm-svn: 296835
2017-03-02 22:45:24 +00:00
John McCall 5ad740756f Promote ConstantInitBuilder to be a public CodeGen API; it's
a generally useful utility for other frontends.  NFC.

llvm-svn: 296806
2017-03-02 20:04:19 +00:00
Vassil Vassilev 3dd966b0ce Add coding and shebang.
Reviewed by Artem Dergachev (D26030)!

llvm-svn: 296781
2017-03-02 18:47:22 +00:00
Vassil Vassilev b27106804a Mark function as llvm dump method.
llvm-svn: 296779
2017-03-02 18:13:19 +00:00
Adrian Prantl 5db6a947a2 Document that code inlined into a nodebug function also won't get any
debug info.

Suggested by Paul Robinson in feedback on r296488, thanks!

llvm-svn: 296776
2017-03-02 18:06:51 +00:00
Saleem Abdulrasool 97d25552ed 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!

llvm-svn: 296769
2017-03-02 17:37:11 +00:00
Nico Weber 3ffedcdfa3 Don't write to LLVMStyle.JavaScriptQuotes twice. No behavior change.
llvm-svn: 296749
2017-03-02 14:51:54 +00:00
Krasimir Georgiev 9163fe2aba [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

llvm-svn: 296736
2017-03-02 09:54:44 +00:00
Daniel Jasper 893b8adca2 clang-format: [JS] Properly format object literals with shorthands.
Before:
  return {
    a,
    b: 'b', c,
  };

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

llvm-svn: 296664
2017-03-01 19:47:28 +00:00
Daniel Jasper 01b8783a05 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

llvm-svn: 296659
2017-03-01 19:26:12 +00:00
Bruno Cardoso Lopes 84df6e99b8 [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

llvm-svn: 296656
2017-03-01 19:18:42 +00:00
Alex Lorenz d5d27e16d4 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

llvm-svn: 296649
2017-03-01 18:06:25 +00:00
Charles Li ceccf2d738 [Test] NFC: Fixed typo in comments
Changed "declerations" to "declarations"

llvm-svn: 296648
2017-03-01 17:55:03 +00:00
Devin Coughlin bfa8e28dbb [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

llvm-svn: 296646
2017-03-01 17:48:39 +00:00
Krasimir Georgiev 85c3704c0d [clang-format] Don't add namespace end comments for unbalanced right braces after namespace end
llvm-svn: 296638
2017-03-01 16:38:08 +00:00
Krasimir Georgiev 32eaa864e3 [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

llvm-svn: 296632
2017-03-01 15:35:39 +00:00
Eric Liu 9e745b7292 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

llvm-svn: 296616
2017-03-01 13:14:01 +00:00
Daniel Jasper 62703eb8a7 Fix r296605 so that stuff in #ifndef SWIG blocks is still formatted.
llvm-svn: 296608
2017-03-01 11:10:11 +00:00
Daniel Jasper eab6cd474c 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.

llvm-svn: 296605
2017-03-01 10:47:52 +00:00
Malcolm Parsons ded2306208 [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

llvm-svn: 296602
2017-03-01 10:23:38 +00:00
Akira Hatanaka 7cbbb88f23 [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

llvm-svn: 296584
2017-03-01 06:11:25 +00:00
Richard Trieu 07c9338841 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.

llvm-svn: 296572
2017-03-01 03:07:55 +00:00
Devin Coughlin 1bf65c8c0d [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

llvm-svn: 296562
2017-03-01 01:47:37 +00:00
Paul Robinson 18c12d534d [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.

llvm-svn: 296554
2017-03-01 01:01:10 +00:00
Charles Li f22a68714f [Test] Make Lit tests C++11 compatible - IR ordering
Differential Revision: https://reviews.llvm.org/D30430

llvm-svn: 296549
2017-03-01 00:10:00 +00:00
Richard Trieu 48143749f8 [ODRHash] Add basic support for CXXRecordDecl
llvm-svn: 296521
2017-02-28 21:24:38 +00:00
Erich Keane 2fe684bb14 Allow attributes before union definition
permits typedef union __attribute__((transparent_union)) {...}

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

llvm-svn: 296518
2017-02-28 20:44:39 +00:00
Daniel Jasper e154020dc5 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) {}
  }

llvm-svn: 296499
2017-02-28 18:28:15 +00:00
Eric Christopher fb834a8278 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

llvm-svn: 296490
2017-02-28 17:22:05 +00:00
Tom Stellard d088de6116 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

llvm-svn: 296485
2017-02-28 16:46:19 +00:00
Daniel Marjamaki 20a209e453 [Sema] Detect more array index out of bounds when C++ overloaded operators are used
Differential Revision: https://reviews.llvm.org/D30192

llvm-svn: 296477
2017-02-28 14:53:50 +00:00
Martin Probst bb46a7dd2a 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

llvm-svn: 296467
2017-02-28 11:08:24 +00:00
NAKAMURA Takumi d6fc6730ce clang/test/Format/inplace.cpp: Avoid using wildcard.
MSYS' tools don't do globbing.

llvm-svn: 296460
2017-02-28 10:05:56 +00:00
Christof Douma 8723946e91 [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
llvm-svn: 296454
2017-02-28 09:09:53 +00:00