Commit Graph

38165 Commits

Author SHA1 Message Date
Sean Callanan 0aae04175b Updated the AST importer to support importing
LinkageSpecDecls.  This is relevant when LLDB
wants to import Decls from non-C++ modules,
since many declarations are in extern "C"
blocks.

llvm-svn: 223860
2014-12-10 00:00:37 +00:00
Sean Callanan 8759649013 Modified the Objective-C lexer and parser (only
in debugger mode) to accept @import declarations
and pass them to the debugger.  

In the preprocessor, accept import declarations
if the debugger is enabled, but don't actually
load the module, just pass the import path on to 
the preprocessor callbacks.

In the Objective-C parser, if it sees an import
declaration in statement context (usual for LLDB),
ignore it and return a NullStmt.

llvm-svn: 223855
2014-12-09 23:47:56 +00:00
David Blaikie d73f3c6b73 DebugInfo: Correct location of aggregate assignment
llvm-svn: 223854
2014-12-09 23:33:26 +00:00
David Majnemer b511603281 AST: Don't assume two zero sized objects live at different addresses
Zero sized objects may overlap with each other or any other object.

This fixes PR21786.

llvm-svn: 223852
2014-12-09 23:32:34 +00:00
Fariborz Jahanian df833a4918 Objective-C SDK modernizer. Modernize to use
property-dot-syntax when receiver is 'super'. 
rdar://19140267

llvm-svn: 223846
2014-12-09 22:36:47 +00:00
David Blaikie 00de22f963 DebugInfo: Correct location of initialization of auto __complex
llvm-svn: 223842
2014-12-09 22:15:02 +00:00
David Blaikie 7f138811cd DebugInfo: Correct the location of initializations of auto.
llvm-svn: 223839
2014-12-09 22:04:13 +00:00
David Blaikie 93e9cf8aa4 DebugInfo: Correct location for compound complex assignment
llvm-svn: 223835
2014-12-09 21:32:00 +00:00
David Blaikie 8ec8dfecd1 DebugInfo: Accurate location information for complex assignment
llvm-svn: 223828
2014-12-09 21:10:43 +00:00
David Blaikie 538deffd2d DebugInfo: Emit the correct location for initialization of a complex variable
Especially useful for sanitizer reports.

llvm-svn: 223825
2014-12-09 20:52:24 +00:00
Duncan P. N. Exon Smith a66e30517b Fix a GCC error from r223803
llvm-svn: 223814
2014-12-09 19:22:40 +00:00
Duncan P. N. Exon Smith fb49491477 IR: Update clang for Metadata/Value split in r223802
Match LLVM API changes from r223802.

llvm-svn: 223803
2014-12-09 18:39:32 +00:00
Chandler Carruth 04ca0bba9c Re-work the Clang system for classifying Intel x86 CPUs to use their
basic microarchitecture names, and add support (with tests) for parsing
all of the masic microarchitecture names for CPUs documented to be
accepted by GCC with -march. I didn't go back through the 32-bit-only
old microarchitectures, but this at least brings the recent architecture
names up to speed. This is essentially the follow-up to the LLVM commit
r223769 which did similar cleanups for the LLVM CPUs.

One particular benefit is that you can now use -march=westmere in Clang
and get the LLVM westmere processor which is a different ISA variant (!)
and so quite significant.

Much like with r223769, I would appreciate the Intel folks carefully
thinking about the macros defined, names used, etc for the atom chips
and newest primary x86 chips. The current patterns seem quite strange to
me, especially here in Clang.

Note that I haven't replicated the per-microarchitecture macro defines
provided by GCC. I'm really opposed to source code using these rather
than using ISA feature macros.

llvm-svn: 223776
2014-12-09 14:50:25 +00:00
Duncan P. N. Exon Smith 00a4da73d5 Revert "[modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1."
This reverts commit r223753.  It broke the Green Dragon build for a few
hours:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/
  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/consoleFull#43901905849ba4694-19c4-4d7e-bec5-911270d8a58c

I suspect `clang-tools-extra` just needs a follow-up for an API change,
but I'm not the right one to look into it.

llvm-svn: 223759
2014-12-09 06:35:37 +00:00
Richard Smith 0152e78146 [modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1.
For files named by -fmodule-map-file=, and files found by 'extern module'
directives, this flag specifies that we should resolve filenames relative to
the current working directory rather than relative to the directory in which
the module map file resides. This is aimed at fixing path handling, in
particular for relative -I paths, when building modules that represent
components of the current project (rather than libraries installed on the
current system, which the current project has as dependencies, where we'd
typically expect the module map files to be looked up implicitly).

llvm-svn: 223753
2014-12-09 03:20:04 +00:00
David Blaikie 73ca56942d DebugInfo: Correctly identify the location of C++ member initializer list elements
This particularly helps the fidelity of ASan reports (which can occur
even in these examples - if, for example, one uses placement new over a
buffer of insufficient size - now ASan will correctly identify which
member's initialization went over the end of the buffer).

This doesn't cover all types of members - more coming.

llvm-svn: 223726
2014-12-09 00:32:22 +00:00
Richard Smith 0c6387f759 [modules] If the same .pcm file is imported via two different paths, don't
complain that the contained modules are defined twice.

llvm-svn: 223724
2014-12-09 00:14:36 +00:00
David Majnemer ae394819c8 Revert "Driver: Objective-C should respect -fno-exceptions"
This reverts commit r223455.  It's been succesfully argued that
-fexceptions (at the driver level) is a misnomer and has little to do
with -fobjc-exceptions.

llvm-svn: 223723
2014-12-09 00:12:30 +00:00
Kaelyn Takata a15a6dc78e Handle possible TypoExprs in member initializers.
Includes a new test case since none of the existing tests were hitting
this code path.

llvm-svn: 223705
2014-12-08 22:41:42 +00:00
David Blaikie 0b7fad656b DebugInfo: Ensure the store for an assignment is attributed to the beginning of the assignment expression
llvm-svn: 223699
2014-12-08 21:48:57 +00:00
Daniel Jasper a536df4b28 clang-format: Indent correctly in conditional expressions after return.
This only applies when not aligning after the return itself (which is
commonly done for C++.

Before:
  return aaaaaaaaaa
      ? bbbbbbbbbb(
             bbbbbb)  // This is indented relative to aaaaaaaaaa.
      : b;

After:
  return aaaaaaaaaa
      ? bbbbbbbbbb(
            bbbbbb)
      : b;

llvm-svn: 223694
2014-12-08 21:28:31 +00:00
Daniel Jasper 211e1329cc clang-format: [Java] Always break after annotations of multiline decls.
Before:
  @Mock DataLoader loooooooooooooooooooooooader =
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  @Mock
  DataLoader loooooooooooooooooooooooader =
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 223688
2014-12-08 20:08:04 +00:00
Justin Bogner 970ac60573 InstrProf: Use LLVM's -instrprof pass for profiling
The logic for lowering profiling counters has been moved to an LLVM
pass. Emit the intrinsics rather than duplicating the whole pass in
clang.

llvm-svn: 223683
2014-12-08 19:04:51 +00:00
Daniel Jasper 3431b75069 clang-format: Support commas in lambda return types.
Before:
  auto next_pair = [](A * a) -> pair<A*, A*>{};

After:
  auto next_pair = [](A* a) -> pair<A*, A*>{};

llvm-svn: 223652
2014-12-08 13:22:37 +00:00
Argyrios Kyrtzidis 56af7e6ab4 [libclang] Use same USR encoding for 'char' regardless of what the target considers the sign to be.
Should fix the clang-hexagon-elf bot.

llvm-svn: 223642
2014-12-08 09:09:05 +00:00
Argyrios Kyrtzidis 1d5e542fb2 [libclang] Encode InjectedClassNameType in the USR.
llvm-svn: 223634
2014-12-08 08:48:43 +00:00
Argyrios Kyrtzidis 80537a4146 [libclang] Encode location info for anonymous embedded tag decls.
Otherwise the USR will conflict with different embedded tag decls.

llvm-svn: 223633
2014-12-08 08:48:37 +00:00
Argyrios Kyrtzidis f66cef7575 [libclang] Use same USR encoding for 'class' as 'struct'.
'class' and 'struct' can be used interchangebly for forward references.
Use the same encoding otherwise we may get into a weird situation where the USR for the same
declaration is different based on whether the definition of the tag reference is visible or not.

llvm-svn: 223632
2014-12-08 08:48:33 +00:00
Argyrios Kyrtzidis 0e387dc330 [libclang] Encode C++11 rvalue reference types in the USR.
llvm-svn: 223631
2014-12-08 08:48:27 +00:00
Argyrios Kyrtzidis f581909b3b [libclang] Encode the C++11 method reference qualifier in the USR.
llvm-svn: 223630
2014-12-08 08:48:21 +00:00
Argyrios Kyrtzidis ca044547d2 [libclang] Reflect in USR generation that 'signed char' and 'unsigned char' can overload a 'char' in C++, by giving them distinct encodings.
llvm-svn: 223629
2014-12-08 08:48:17 +00:00
Argyrios Kyrtzidis d06ce400c2 [libclang] Function templates can be 'overloaded' by return type, so encode the return type in the USR
and handle DependentNameType in order to be able to distinguish them.

llvm-svn: 223628
2014-12-08 08:48:11 +00:00
Daniel Jasper 55aed6777f clang-format: Don't merge lines with comments.
Before:
  int f() { // comment return 42; }

After:
  int f() { // comment
    return 42;
  }

This fixes llvm.org/PR21769.

llvm-svn: 223609
2014-12-07 16:44:49 +00:00
Paul Robinson 01105887ab Rename a couple of preprocessor symbols to be more descriptive. NFC.
Review feedback from recent changes to GetSVN.cmake.

llvm-svn: 223578
2014-12-06 05:06:37 +00:00
Richard Smith 223d3f2e4d [modules] If we import a module, and we've seen a module map that describes the
module, use the path from the module map file in preference to the path from
the .pcm file when resolving relative paths in the .pcm file. This allows
diagnostics (and .d output) to give relative paths if the module was found via
a relative path.

llvm-svn: 223577
2014-12-06 03:21:08 +00:00
Kostya Serebryany 597dcc7a8d No memcpy for copy ctor with -fsanitize-address-field-padding=1
Summary:
When -fsanitize-address-field-padding=1 is present
don't emit memcpy for copy constructor.
Thanks Nico for the extra test case.

Test Plan: regression tests

Reviewers: thakis, rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

Differential Revision: http://reviews.llvm.org/D6515

llvm-svn: 223563
2014-12-06 01:23:08 +00:00
Richard Smith 4a89a06d0d PR21217: Slightly more eagerly load -fmodule-map-file= files and provide
diagnostics if they don't exist. Based on a patch by John Thompson!

llvm-svn: 223561
2014-12-06 01:13:41 +00:00
Richard Smith 3464e321b8 Additional safety for the root cause of regression in r223443; make the module
map path more canonical before hashing it. No functionality change.

llvm-svn: 223547
2014-12-06 00:09:19 +00:00
Richard Smith 7ed1bc9eb0 [modules] Instead of storing absolute paths in a .pcm file, store the path to
the root of the module and use paths relative to that directory wherever
possible. This is a step towards allowing explicit modules to be relocated
without being rebuilt, which is important for some kinds of distributed builds,
for good paths in diagnostics, and for appropriate .d output.

This is a recommit of r223443, reverted in r223465; when joining together
imported file paths, we now use the system's separator rather than always
using '/'. This avoids path mismatches between the original module build and
the module user on Windows (at least, in some cases). A more comprehensive
fix will follow.

llvm-svn: 223539
2014-12-05 22:42:13 +00:00
Hans Wennborg 76b005398d ASTDumper: print whether a function is constexpr
llvm-svn: 223538
2014-12-05 22:38:57 +00:00
Paul Robinson 91f0edc55f Specify the name of the generated header only once. NFC.
This will also simplify a private patch that we have.

llvm-svn: 223537
2014-12-05 22:32:49 +00:00
Richard Smith a2686713ef Make DiagnosticErrorTrap work even if SuppressAllDiagnostics is enabled.
Patch by Brad King!

llvm-svn: 223525
2014-12-05 21:52:58 +00:00
Matt Arsenault b9e9dc5e89 Workaround attribute ordering issue with kernel only attributes
Placing the attribute after the kernel keyword would incorrectly
reject the attribute, so use the smae workaround that other
kernel only attributes use.

Also add a FIXME because there are two different phrasings now
for the same error, althoug amdgpu_num_[sv]gpr uses a consistent one.

llvm-svn: 223490
2014-12-05 18:03:58 +00:00
Matt Arsenault 43cfcbca3f Use else if when checking multiple attributes.
Only one of these can really match.

llvm-svn: 223489
2014-12-05 18:03:55 +00:00
Aaron Ballman a6f759e423 Modify __has_attribute so that it only looks for GNU-style attributes. Removes the ability to look for generic attributes and keywords via this macro, which has the potential to be a breaking change. However, since there is __has_cpp_attribute and __has_declspec_attribute, and given the limited usefulness of querying a generic attribute name regardless of syntax, this seems like the correct path forward.
llvm-svn: 223468
2014-12-05 15:24:55 +00:00
Aaron Ballman 3c0f9b4a7d Added a new preprocessor macro: __has_declspec_attribute. This can be used as a way to determine whether Clang supports a __declspec spelling for a given attribute, similar to __has_attribute and __has_cpp_attribute.
llvm-svn: 223467
2014-12-05 15:05:29 +00:00
Aaron Ballman 8928552500 Temporarily reverting r223443 due to bot breakage.
llvm-svn: 223465
2014-12-05 14:52:04 +00:00
Daniel Jasper 31f6c54733 clang-format: Support NS_OPTIONS, CF_ENUM and CF_OPTIONS.
This fixes llvm.org/PR21756.

llvm-svn: 223458
2014-12-05 10:42:21 +00:00
David Majnemer 153c3948f1 Driver: Objective-C should respect -fno-exceptions
Clang attempted to replicate a GCC bug: -fobjc-exceptions forces
-fexceptions to be enabled.  However, this has unintended effects and
other awkard side effects that Clang doesn't "correctly" ape (e.g. it's
impossible to turn off C++ exceptions in ObjC++ mode).

Instead, -f[no]objc-exceptions and -f[no]cxx-exceptions now have an
identical relationship with -f[no]exceptions.

llvm-svn: 223455
2014-12-05 08:56:55 +00:00
David Majnemer 8de6864146 Driver: Cleanup -fexceptions behavior
No functionality change is intended, just a cleanup of the logic clang
uses to determine what -fexceptions/-fno-exceptions ends up doing.

llvm-svn: 223453
2014-12-05 08:11:58 +00:00