Commit Graph

52888 Commits

Author SHA1 Message Date
Hans Wennborg 275efb9e50 Don't dllimport/export destructor variants implemented by thunks.
MSVC doesn't export these functions, so trying to import them doesnt' work.
Also, don't let any dll attributes on the CXXDestructorDecl influence the
thunk's linkage -- they should always be linkonce_odr.

This takes care of the FIXME's for this in Nico's tests.

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

llvm-svn: 209706
2014-05-28 01:52:23 +00:00
Alexander Kornienko 83a4e18f4c Retain isImplicit flag for local variable declarations when instantiating
templates.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 209686
2014-05-27 21:29:22 +00:00
Ben Langmuir 6fa878d86d Add a test that we don't store stale modtime in modules
The change from r209195 turned out to be important to avoid saving stale
modification time/expected size information in a module file when there
are 3 or more modules in a dependency chain and the bottom one is
rebuilt. So add a test for that.

rdar://problem/17038180

llvm-svn: 209682
2014-05-27 19:57:48 +00:00
James Dennett 1575cb49cd Add range accessors for captures of a LambdaExpr.
Summary:
This adds LambdaExpr::captures(), LambdaExpr::explicit_captures()
and LambdaExpr::implicit_captures() as simple wrappers over the underlying
*_begin()/*_end() functions.

Reviewers: aaron.ballman

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

llvm-svn: 209679
2014-05-27 19:13:04 +00:00
Fariborz Jahanian 0c1c3113e8 Objective-C. Fixes an obscuer crash caused by multiple inclusion of
same framework after complaining about duplicate class definition.
// rdar://17024681

llvm-svn: 209672
2014-05-27 18:26:09 +00:00
Renato Golin a627a103d0 Fix pr19841, bb are also unnamed
llvm-svn: 209668
2014-05-27 17:01:21 +00:00
Renato Golin 345c9cc5f4 Fix pr19841.cpp on release mode
llvm-svn: 209666
2014-05-27 16:51:36 +00:00
Renato Golin e7b3d5dcb4 Revert small change to EmitDeclRefLValue
That small change, although it looked harmless, it made emitting the LValue
on the PHI node without the proper cast. Reverting it fixes PR19841.

llvm-svn: 209663
2014-05-27 16:46:27 +00:00
NAKAMURA Takumi 74bae981a5 ASTMatchers.h: Appease msc17.
llvm-svn: 209661
2014-05-27 15:13:51 +00:00
Alexander Musman 8bd31e69a4 Parsing/Sema for OMPCollapseClause.
Actual usage in Sema for collapsing loops will in some future patch.

llvm-svn: 209660
2014-05-27 15:12:19 +00:00
Manuel Klimek a2c2a4faa0 Make equalsNode work with pointers to subtypes.
llvm-svn: 209652
2014-05-27 12:31:10 +00:00
Manuel Klimek 909b5c94c0 Adds child traversal matchers for IfStmt's then and else branches.
llvm-svn: 209649
2014-05-27 10:04:12 +00:00
Manuel Klimek 2af0a91cc4 Allow hasBody on CXXForRangeStmt nodes and update the docs.
llvm-svn: 209647
2014-05-27 07:45:18 +00:00
Craig Topper 0dbb783c7b [C++11] Use 'nullptr'. StaticAnalyzer edition.
llvm-svn: 209642
2014-05-27 02:45:47 +00:00
Aaron Ballman 5a1ef6b411 Rejecting the mutable specifier on a freestanding type declaration, instead of supporting it as a "extension" (which serves no purpose). Un-XFAILing the test for mutable specifiers.
llvm-svn: 209635
2014-05-26 17:03:54 +00:00
Daniel Jasper 60553be5fd clang-format: Split up moveStateToNextToken.
No functional changes intended.

llvm-svn: 209626
2014-05-26 13:10:39 +00:00
Daniel Jasper ba1b6bb667 clang-format: Keep '{' of dict literals on the same line in Allman style
Before:
  void f()
  {
    [object
        someMethod:@
        { @"a" : @"b" }];
  }

After:
  void f()
  {
    [object someMethod:@{ @"a" : @"b" }];
  }

This fixes llvm.org/PR19854.

llvm-svn: 209615
2014-05-26 07:24:34 +00:00
Craig Topper c3ec149bb2 [C++11] Use 'nullptr'. Sema edition.
llvm-svn: 209613
2014-05-26 06:22:03 +00:00
Craig Topper 236bde3d6f [C++11] Use 'nullptr'.
llvm-svn: 209612
2014-05-26 06:21:51 +00:00
Nico Rieck 68694b53ab Sema: Add dll attribute tests for member functions
llvm-svn: 209598
2014-05-25 10:35:03 +00:00
Nico Rieck 99f12ef44f Sema: Add dll attribute tests for variable templates
llvm-svn: 209597
2014-05-25 10:34:36 +00:00
Nico Rieck 755a36f593 IRGen: Add more tests for dll attributes
llvm-svn: 209596
2014-05-25 10:34:16 +00:00
Hans Wennborg 905f806098 Fix some misplaced spaces around 'override'
llvm-svn: 209588
2014-05-24 20:18:32 +00:00
Tim Northover 573cbee543 AArch64/ARM64: rename ARM64 components to AArch64
This keeps Clang consistent with backend naming conventions.

llvm-svn: 209579
2014-05-24 12:52:07 +00:00
Tim Northover 25e8a6754e AArch64/ARM64: update Clang after AArch64 removal.
A few (mostly CodeGen) parts of Clang were tightly coupled to the
AArch64 backend. Now that it's gone, they will not even compile.

I've also deduplicated RUN lines in many of the AArch64 tests. This
might improve "make check-all" time noticably: some of those NEON
tests were monsters.

llvm-svn: 209578
2014-05-24 12:51:25 +00:00
Yaron Keren 188cafb030 CXXInfo memory should be released after calling the destructor
instead of before. The wrong order had no effect since Deallocate() 
does nothing right now, but we may replace allocator in the future.

llvm-svn: 209567
2014-05-24 07:19:25 +00:00
Hans Wennborg e9277401b7 This test doesn't need -O2 -disable-llvm-optzns
I forgot to fix this one in r209145. We use these flags on dllimport tests
to make sure we emit code for available_externaly functions and don't inline
the IR.

llvm-svn: 209564
2014-05-23 23:29:44 +00:00
Akira Hatanaka c0303355e9 Recommit r209532 with -ffreestanding.
This is a test case for r209489.

llvm-svn: 209559
2014-05-23 22:12:01 +00:00
Akira Hatanaka d59c92d047 Remove test while I investigate why the test is breaking the bots.
llvm-svn: 209558
2014-05-23 21:35:50 +00:00
Richard Smith a1406fa513 Recompute the injected class name type for a class template specialization
rather than saving and restoring it.

llvm-svn: 209557
2014-05-23 21:31:59 +00:00
Akira Hatanaka 3f1b632ad8 XFAIL test which is breaking some of the build bots.
llvm-svn: 209556
2014-05-23 21:24:24 +00:00
Reid Kleckner 563f0e852c Use comdats to avoid double initialization of weak data
Initializers of global data that can appear multiple TUs (static data
members of class templates or __declspec(selectany) data) are now in a
comdat group keyed on the global variable being initialized.  On
non-Windows platforms, this is a code size and startup time
optimization.  On Windows, this is necessary for ABI compatibility with
MSVC.

Fixes PR16959.

Reviewers: rsmith

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

llvm-svn: 209555
2014-05-23 21:13:45 +00:00
Richard Smith 871cd4c131 [modules] If a referenced-but-not-instantiated class template specialization
gets explicitly specialized, don't reuse the previous class template
specialization declaration as a new declaration. The benefit here is fairly
marginal, it harms source fidelity, and this is horrible to model if the
specialization was imported from another module (without this change, it
asserts or worse).

llvm-svn: 209552
2014-05-23 21:00:28 +00:00
Hans Wennborg a926d84c4b Emit used/dllexport inline method definitions in nested classes (PR19743, PR11170)
The previous code that was supposed to handle this didn't work
since parsing of inline method definitions is delayed to the end
of the outer class definition. Thus, when HandleTagDeclDefinition()
got called for the inner class, the inline functions in that class
had not been parsed yet.

Richard suggested that the way to do this is by handling inline
method definitions through a new ASTConsumer callback.

I really wanted to call ASTContext::DeclMustBeEmitted() instead of
checking for attributes, but doing that causes us to compute linkage,
and then we fail with "error: unsupported: typedef changes linkage
of anonymous type, but linkage was already computed" on tests like
this: (from SemaCXX/undefined-internal.cpp) :-/

  namespace test7 {
    typedef struct {
      void bar();
      void foo() { bar(); }
    } A;
  }

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

llvm-svn: 209549
2014-05-23 20:37:38 +00:00
Hans Wennborg be4be16be3 Don't suppress warning about dllimport on typedefs etc. in MicrosoftExt mode
It's true the MSVC doesn't warn about dllimport when applied to e.g. a typedef,
but that applies to dllexport too. I'd like us to be consistent, and I think
the right thing to do is to warn.

The original test that came with implementing the old behaviour doesn't provide
a good motivation, and it said it was checking that we're not repoting an *error*,
which is still true since this is just a warning.

There are plenty of tests e.g. in Sema/dllimport.c to check that we do warn
about dllimport on non functions or variables.

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

llvm-svn: 209546
2014-05-23 20:16:41 +00:00
Nico Rieck ffd8a3364c Sema: Add more tests for dll attributes on inline functions
llvm-svn: 209542
2014-05-23 19:07:49 +00:00
Nico Rieck 4da7debf7d Fix broken FileCheck prefix
llvm-svn: 209541
2014-05-23 19:07:25 +00:00
Nico Rieck f84814f9b4 Fix typo
llvm-svn: 209540
2014-05-23 19:07:09 +00:00
Ben Langmuir 5de00f3b56 Stopgap fix for finding module for a file mapped in the VFS
If we lookup a path using its 'real' path first, we need to ensure that
when we run header search we still use the VFS-mapped path or we will
not be able to find the corresponding module for the header.

The real problem is that we tie the name of a file to its underlying
FileEntry, which is uniqued by inode, so we only ever get the first name
it is looked up by. This doesn't work with modules, which rely on a
specific file system structure.  I'm hoping to have time to write up a
proposal for fixing this more permanently soon, but as a stopgap this
patch updates the name of the file's directory if it comes from a VFS
mapping.

llvm-svn: 209534
2014-05-23 18:15:47 +00:00
Manuel Klimek 8651081bbe Add the hasRangeInit() matcher for range-based for loop.
llvm-svn: 209533
2014-05-23 17:49:03 +00:00
Akira Hatanaka 4625f85bb7 Test case for r209489.
llvm-svn: 209532
2014-05-23 17:35:08 +00:00
Manuel Klimek 5fbdc93d97 Make dead return statement detection more robust against changes in the CFG.
This change is a precondition to the proposed change to handle temporary
dtors correctly.

The idea is to explicitly search for the next return that doesn't have other
paths into it (that is, if the current block is dead, the block containing the
return must be dead, too). Thus, introducing non-control-flow block
transitions will not break the logic.

llvm-svn: 209531
2014-05-23 17:09:56 +00:00
Manuel Klimek a33815be22 Make the ParentVector default to size 2.
As Jordan noted, it makes more sense when we store it in the ParentMap,
and doesn't really make a difference when we return it from getParents.

llvm-svn: 209530
2014-05-23 16:58:18 +00:00
Sylvestre Ledru e8103abdbc revert "r209526 List the function/method name in the index page of scan-build "
Depends on http://reviews.llvm.org/D3762

llvm-svn: 209527
2014-05-23 16:47:42 +00:00
Sylvestre Ledru 970d3189e6 List the function/method name in the index page of scan-build
llvm-svn: 209526
2014-05-23 16:40:46 +00:00
Warren Hunt 51ec916e20 [MS-ABI] Silence warning from r209523
no functional change.

llvm-svn: 209525
2014-05-23 16:26:32 +00:00
Sylvestre Ledru df70a7ba99 Replace system() by native perl calls
llvm-svn: 209524
2014-05-23 16:10:00 +00:00
Warren Hunt 5c2b4ea662 [MS-ABI] Implements MS-compatible RTTI
Enables the emission of MS-compatible RTTI data structures for use with 
typeid, dynamic_cast and exceptions.  Does not implement dynamic_cast 
or exceptions.  As an artiface, typeid works in some cases but proper 
support an testing will coming in a subsequent patch.

majnemer has fuzzed the results.  Test cases included.

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

llvm-svn: 209523
2014-05-23 16:07:43 +00:00
Dario Domizioli d179d939a8 [test] Force a triple in the pragma optimize test due to expected mangled names.
No functional change to the compiler.
This should just make the test pass on all buildbots.

llvm-svn: 209515
2014-05-23 13:53:12 +00:00
Nikola Smiljanic 3a01af0805 PR19352 - getLocation() points to the wrong position for FriendDecls
llvm-svn: 209511
2014-05-23 12:48:27 +00:00
Dario Domizioli 13a0a38fe0 Implemented support for "pragma clang optimize on/off", based on attribute 'optnone'.
This patch implements support for selectively disabling optimizations on a
range of function definitions through a pragma. The implementation is that
all function definitions in the range are decorated with attribute
'optnone'.

    #pragma clang optimize off
    // All function definitions in here are decorated with 'optnone'.
    #pragma clang optimize on
    // Compilation resumes as normal.

llvm-svn: 209510
2014-05-23 12:13:25 +00:00
Robert Lytton 57dd5cf441 Fix '-main-file-name <name>' so that it is used for the ModuleID.
Summary:
Previously, you could not specify the original file name when passing a preprocessed file into the compiler
Now you can use 'clang -Xclang -main-file-name -Xclang <original file name> ...'
Or 'clang -cc1 -main-file-name <original file name> ...'

llvm-svn: 209503
2014-05-23 07:34:08 +00:00
Alexander Kornienko 145050288c Clean DiagRanges. Fix a possible problem introduced in r209468.
llvm-svn: 209491
2014-05-23 01:37:30 +00:00
Akira Hatanaka 5d28ea1451 Fix a bug in xmmintrin.h.
The last step of _mm_cvtps_pi16 should use _mm_packs_pi32, which is a function
that reads two __m64 values and packs four 32-bit values into four 16-bit
values.  

<rdar://problem/16873717>

llvm-svn: 209489
2014-05-23 00:38:07 +00:00
Rafael Espindola b73c973d3b Don't set unnamed_addr in CreateRuntimeVariable.
This was fairly broken. For example,

@__dso_handle would or would not get an unnamed_addr depending on how many
global destructors were used in a translation unit.

The consensus was that not every runtime variable is unnamed_addr and that
__dso_handle handle should not be, so just don't add unnamed_addr in
CreateRuntimeVariable.

llvm-svn: 209484
2014-05-22 23:33:27 +00:00
Richard Smith 64c0630585 Avoid allocating extra memory to handle the lazy definition data pointer for
CXXRecordDecls when modules is enabled.

llvm-svn: 209482
2014-05-22 23:19:02 +00:00
Rafael Espindola ce5c6091e0 Don't reduce the stack protector level given -fstack-protector.
Before -fstack-protector would always force a level of 1, even if the default
was 2.

Patch by Brad Smith.

llvm-svn: 209479
2014-05-22 22:57:39 +00:00
Alexander Kornienko 0a0d6b4bb1 Use error_code::success() instead of make_error_code(llvm::errc::success).
llvm-svn: 209477
2014-05-22 22:06:08 +00:00
Alexey Samsonov 99ee10d2b8 Unify the name of compiler-rt builtins library on Linux.
Call it "libclang_rt.builtins-<arch>.a" to be consistent
with sanitizers/profile libraries naming. Modify Makefile
and CMake build systems and Clang driver accordingly.

Fixes PR19822.

llvm-svn: 209474
2014-05-22 21:13:30 +00:00
Richard Smith df3520581a If a class template specialization from one module has its definition
instantiated in another module, and the instantiation uses a partial
specialization, include the partial specialization and its template arguments
in the update record. We'll need them if someone imports the second module and
tries to instantiate a member of the template.

llvm-svn: 209472
2014-05-22 20:59:29 +00:00
Hans Wennborg 5ebffb5555 Don't warn about undefined inline functions if they're dllexport/import
llvm-svn: 209471
2014-05-22 20:45:53 +00:00
Alexander Kornienko d3b4e08960 Remove limits on the number of fix-it hints and ranges in the DiagnosticsEngine.
Summary:
The limits on the number of fix-it hints and ranges attached to a
diagnostic are arbitrary and don't apply universally to all users of the
DiagnosticsEngine. The way the limits are enforced may lead to diagnostics
generating invalid sets of fixes. I suggest removing the limits, which will also
simplify the implementation.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: klimek, cfe-commits

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

llvm-svn: 209468
2014-05-22 19:56:11 +00:00
Abramo Bagnara 847c660ad5 Improved location for non-constant initializers diagnostics.
llvm-svn: 209466
2014-05-22 19:20:46 +00:00
Matt Arsenault 328b52e88a Forgot to add updated datalayout test
llvm-svn: 209465
2014-05-22 18:57:49 +00:00
Matt Arsenault 23e7b084b4 Update R600 datalayout
llvm-svn: 209464
2014-05-22 18:33:55 +00:00
Hans Wennborg f436b2837c An inline function redeclaration does not drop the dllimport attribute
llvm-svn: 209449
2014-05-22 15:46:15 +00:00
Daniel Jasper 94ea5bb115 clang-format: Add basic test for -style=none.
llvm-svn: 209447
2014-05-22 15:13:48 +00:00
Daniel Jasper c64b09acc3 clang-format: Introduce DisableFormat that prevents formatting.
And "none" pseudo-style indicating that formatting should be not
applied.

(1) Using .clang-format with "DisableFormat: true" effectively prevents
formatting for all files within the folder containing such .clang-format
file.

(2) Using -fallback-style=none together with -style=file prevents
formatting when .clang-format is not found, which can be used in on-save
callback.

Patch by Adam Strzelecki. Thank you!

llvm-svn: 209446
2014-05-22 15:12:22 +00:00
Daniel Jasper 565ed5ed08 clang-format: Don't use Allman brace breaking for ObjC blocks.
It just seems wrong. This fixes llvm.org/PR19736.

llvm-svn: 209440
2014-05-22 13:53:55 +00:00
Daniel Jasper bd630737bd clang-format: Fix corner case in AllowShortBlocksOnASingleLine.
Before:
  template <int> struct A4 { A4() { }
  };

After:
  template <int i> struct A4 {
    A4() {}
  };

This fixes llvm.org/PR19813 (at least the part that isn't working as
intended).

llvm-svn: 209438
2014-05-22 13:25:26 +00:00
Tim Northover 15ff71deea MachO: look for nearby tools on all MachO platforms.
This brings "-arch armv7m" (etc) behaviour more in line with what's expected
for developers on OS X, and allows Clang to find an "ld" (for example) in the
same directory instead of using the default /usr/bin/ld.

Unfortunately no test because it relies on the specific place Clang is running
from.

rdar://problem/16427320

llvm-svn: 209437
2014-05-22 13:12:14 +00:00
Tim Northover cc346a92e3 Revert "TMP"
This reverts r209433. Sorry about that, it needs a test & better message.

llvm-svn: 209435
2014-05-22 12:55:29 +00:00
Tim Northover e5c6f4c304 MachO: perform ARM ABI detection even for non-Darwin triples.
When "-arch armv7m" is specified, we want "aapcs", for example.

rdar://problem/16581138

llvm-svn: 209434
2014-05-22 12:54:30 +00:00
Tim Northover 36ce1e056c TMP
llvm-svn: 209433
2014-05-22 12:54:24 +00:00
Rafael Espindola 2d401f5bb5 Use stack protector strong by default on OpenBSD.
Use stack protector strong by default to match the base OS and ports/packages
compiler policy.

Patch by Brad Smith.

llvm-svn: 209432
2014-05-22 12:52:35 +00:00
Daniel Jasper 91b032ab55 clang-format: Fix braced list detection.
Before:
  static_assert(std::is_integral<int> {} + 0, "");
  int a = std::is_integral<int> {}
  + 0;

After:
  static_assert(std::is_integral<int>{} + 0, "");
  int a = std::is_integral<int>{} + 0;

llvm-svn: 209431
2014-05-22 12:46:38 +00:00
Daniel Jasper 438059e509 clang-format: Fix incorrect braced init identification.
Before:
  int foo(int i) {
    return fo1 {}
    (i);
  }
  int foo(int i) {
    return fo1 {}
    (i);
  }

After:
  int foo(int i) { return fo1{}(i); }
  int foo(int i) { return fo1{}(i); }

This fixes llvm.org/PR19812.

llvm-svn: 209428
2014-05-22 12:11:13 +00:00
Daniel Jasper 1f6c7e9358 clang-format: Store pointers to seen formatting states.
As the memory ownership is handled by the SpecificBumpPtrAllocator
anyway, there is no need to duplicate states when inserting them into
the Seen-set. This leads to an improvement of ~10% on the benchmark
formatting file.

No functional changes intended.

llvm-svn: 209422
2014-05-22 11:47:01 +00:00
Daniel Jasper 62f73ec1ef clang-format: Fix vim-integration for empty files.
Discovered by Ahmed Charles in http://reviews.llvm.org/D3018.

llvm-svn: 209417
2014-05-22 11:37:05 +00:00
Daniel Jasper 49802ef93b clang-format: [JS] Understand line breaks in concatenated strings.
Before:
  var literal = 'hello ' + 'world';

After:
  var literal = 'hello ' +
                'world';

There is no reason to concatenated two string literals with a '+' unless
the line break is intended.

llvm-svn: 209413
2014-05-22 09:10:04 +00:00
Daniel Jasper 3948516a03 clang-format: Correctly identify multiplications in braces init lists.
Before:
  int i{a *b};

After:
  int i{a * b};

Also fix unrelated issue where braced init lists were counted as blocks
and prevented single-line functions.

llvm-svn: 209412
2014-05-22 09:00:33 +00:00
Alexander Musman 515ad8c490 This patch adds a helper class (CGLoopInfo) for marking memory instructions with llvm.mem.parallel_loop_access metadata.
It also adds a simple initial version of codegen for pragma omp simd (it will change in the future to support all the clauses).

Differential revision: http://reviews.llvm.org/D3644

llvm-svn: 209411
2014-05-22 08:54:05 +00:00
Daniel Jasper 5f3ea477cf clang-format: Correctly calculate line lenghts for nest blocks.
If simple (one-statement) blocks can be inlined, the length needs to be
calculated correctly.

Before (in JavaScript but this also affects lambdas, etc.):
  var x = {
    valueOf: function() { return 1; }
  };

After:
  var x = {valueOf: function() { return 1; }};

llvm-svn: 209410
2014-05-22 08:36:53 +00:00
Justin Bogner c65a66ddfe Frontend: Propagate ASTReaderListener API in ChainedASTReaderListener
ASTReaderListener's documentation states that visitInputFile will be
called based on the return values of needsInputFileVisitation and
needsSystemInputFileVisitation, but ChainedASTReaderListener may call
these methods on a child listener based on the values returned by the
other child.

Even worse, the calls to visitInputFile may be short-circuited due to
the use of the boolean or, so the calls to visit may not occur at all
for the second listener.

This updates ChainedASTReaderListener::visitInputFile to propagate the
ASTReaderListener behaviour to both children.

llvm-svn: 209394
2014-05-22 06:04:59 +00:00
Craig Topper a13603a247 [C++11] Use 'nullptr'. Serialization edition.
llvm-svn: 209392
2014-05-22 05:54:18 +00:00
Craig Topper 49a2790fb3 [C++11] Use 'nullptr'. Frontend edition.
llvm-svn: 209389
2014-05-22 04:46:25 +00:00
Richard Trieu 9098c9f1a8 Add hasSameType overload to ASTContext for Type pointers. Switch a type
comparison check to use this instead of calling Type::getCanonicalTypeInternal

llvm-svn: 209378
2014-05-22 01:39:16 +00:00
Justin Bogner 44fa45034b VirtualFileSystem: Fix a few directory traversal bugs in VFSWriter
There are a couple of issues with writing VFS maps that are awkward to
fix within the current mutually recursive approach. Instead, replace
the algorithm with an iterative version that uses an explicit stack of
directories.

Includes tests for cases the old approach was tripping on.

llvm-svn: 209332
2014-05-21 22:46:51 +00:00
Alp Toker 6521ecc083 Provide an aka for the C++ operator name macro diagnostic
llvm-svn: 209322
2014-05-21 21:23:39 +00:00
David Majnemer e37a6ce9f7 Sema: Implement DR244
Summary:
Naming the destructor using a typedef-name for the class-name is
well-formed.

This fixes PR19620.

Reviewers: rsmith, doug.gregor

Subscribers: cfe-commits

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

llvm-svn: 209319
2014-05-21 20:19:59 +00:00
Alp Toker ab54f46eec cindex/test_cursor.py: no need to skip implicit decls in tests
clang was fixed some time ago to always skip "builtins and other cruft" so
tools no longer need hacks like this.

Passes nosetests.

llvm-svn: 209316
2014-05-21 19:17:38 +00:00
Benjamin Kramer f3a11c1051 Remove outdated diagnostic.
llvm-svn: 209304
2014-05-21 15:57:22 +00:00
Serge Pavlov 921c2ba18b Improved recovery of switch statement
Make better diagnostic produced by erroneous switch statement.
It fixes PR19022.

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

llvm-svn: 209302
2014-05-21 14:48:43 +00:00
Rafael Espindola f5bbe27d28 Move virtual methods out of line.
This is generally a good thing and in this case should also fix the
BUILD_SHARED_LIBS=ON build (see pr19774).

llvm-svn: 209300
2014-05-21 14:19:22 +00:00
Manuel Klimek 95403e6f60 Make the parent-map use significantly less memory.
On test files I ran this on, memory consumption overall went down from
2.5G to 2G, without performance regressions.
I also investigated making DynTypedNode by itself smaller (by pulling
out pointers for everything that doesn't fit in 8 bytes). This led to
another 200-300MB saved, but also introduced a significant regression in
performance due to the memory management overhead.

llvm-svn: 209297
2014-05-21 13:28:59 +00:00
Daniel Jasper 2a958321c8 clang-format: Fix corner case working around one-per-line dict literals.
Before:
  var object_literal_with_long_name = {
    a: 'aaaaaaaaaaaaaaaaaa', b: 'bbbbbbbbbbbbbbbbbb'
  };

After:
  var object_literal_with_long_name = {
    a: 'aaaaaaaaaaaaaaaaaa',
    b: 'bbbbbbbbbbbbbbbbbb'
  };

llvm-svn: 209296
2014-05-21 13:26:58 +00:00
Daniel Jasper 5ebb2f3625 clang-format: Fix incorrect macro call detection.
In:
  struct A {
    A()
        noexcept(....) {}
  };

'A()' is not a macro call.
This fixes llvm.org/PR19814.

llvm-svn: 209294
2014-05-21 13:08:17 +00:00
Daniel Jasper b16b969d7c clang-format: [JS] Support different function literal style.
Before:
  goog.array.forEach(array, function() {
                              doSomething();
                              doSomething();
                            },
                     this);

After:
  goog.array.forEach(array, function() {
    doSomething();
    doSomething();
  }, this);

llvm-svn: 209291
2014-05-21 12:51:23 +00:00
Renato Golin 9258aa5543 Make global named registers internal variables
llvm-svn: 209289
2014-05-21 10:40:27 +00:00
Yaron Keren 885ea4253d DeclVisitor is not used here.
llvm-svn: 209285
2014-05-21 09:02:49 +00:00
Alp Toker b05e0b53b9 Preprocessor: support defined() with operator names for MS compatibility
Also flesh out missing tests, improve diagnostic QOI and fix a couple of corner
cases found in the process.

Fixes PR10606.

llvm-svn: 209276
2014-05-21 06:13:51 +00:00
Craig Topper 161e4db52f [C++11] Use 'nullptr'. Parser edition.
llvm-svn: 209275
2014-05-21 06:02:52 +00:00
Craig Topper 8a13c4180e [C++11] Use 'nullptr'. CodeGen edition.
llvm-svn: 209272
2014-05-21 05:09:00 +00:00
Alp Toker 773649296d utils/CmpDriver: add brief documentation to indicate what this does
llvm-svn: 209268
2014-05-21 02:08:10 +00:00
Alp Toker b671e34c36 SourceManager: Use setMainFileID() consistently
Eliminate createMainFileID() / createMainFileIDForMemBuffer() utility
functions. These didn't add much convenience and conflated two distinct
operations.

This change makes things easier to follow by providing a consistent interface
and getting rid of a bunch of cast-to-voids.

llvm-svn: 209266
2014-05-21 01:12:41 +00:00
Argyrios Kyrtzidis c02a0dbe41 [objcmt] Make sure we don't edit the return type to add 'instancetype' if the return type is already that.
rdar://16961577

llvm-svn: 209264
2014-05-21 00:24:20 +00:00
Eric Christopher 4015e124e3 Update for paired llvm commit with AsmVerbose.
llvm-svn: 209261
2014-05-21 00:00:03 +00:00
Eric Christopher 6c553d6240 Remove test. Replacing it with a backend test with the optimized IR.
llvm-svn: 209260
2014-05-21 00:00:01 +00:00
Justin Bogner 5719614b77 libclang: Give each VirtualFileOverlay unit test its own name
llvm-svn: 209257
2014-05-20 23:52:11 +00:00
Eric Christopher bd8652d272 Make this test emit llvm IR rather than assembly.
llvm-svn: 209255
2014-05-20 23:23:51 +00:00
Justin Bogner 1c078f2b1f VirtualFileSystem: Fix false positives in YAMLVFSWriter::containedIn
Checking if a path starts with another path isn't sufficient for
determining if one is contained within the heirarchy of the other.
We need to ensure that the substring ends at a directory boundary.

llvm-svn: 209250
2014-05-20 22:12:58 +00:00
Alp Toker 6883743fd8 Reduce string duplication
If we're so keen on saving a dynamic allocation to add the trailing space, we
might as well do it in style.

llvm-svn: 209247
2014-05-20 22:03:47 +00:00
Alp Toker fdafb94f01 RAV reunification: merge Lambda body visitation to DRAV
llvm-svn: 209246
2014-05-20 22:03:39 +00:00
Alp Toker 8425c43c2a RAV reunification: merge DISPATCH_STMT() macro back to standard RAV
Also add the missing undef in both files.

llvm-svn: 209245
2014-05-20 22:03:27 +00:00
Alp Toker d92674ce81 RAV reunification: merge r190728
llvm-svn: 209244
2014-05-20 22:03:18 +00:00
Justin Bogner 9c785294fb VirtualFileSystem: Add YAMLVFSWriter to generate VFS mapping files
This moves the logic to write a JSON VFS mapping from the C api into
VirtualFileSystem, so that we can use it internally.

No functional change.

llvm-svn: 209241
2014-05-20 21:43:27 +00:00
Eric Christopher acca0085c1 Update for llvm change to avoid having global flag setting in TargetMachine.
llvm-svn: 209239
2014-05-20 21:25:41 +00:00
Aaron Ballman 2f22b94201 Cleaning up some range-based for loops so that the automatic type deduction is more explicit about pointers and const. Did some minor drive-by const correctness fixes and identifier updates as well. No functional changes.
llvm-svn: 209233
2014-05-20 19:47:14 +00:00
Peter Collingbourne 786283734a Revert r209231, "Update AttributeReference.rst."
According to Aaron, this is being generated on the server now.

llvm-svn: 209232
2014-05-20 19:38:07 +00:00
Peter Collingbourne 450a0b1dc9 Update AttributeReference.rst.
llvm-svn: 209231
2014-05-20 19:27:39 +00:00
Duncan P. N. Exon Smith 6f782b12aa Fix testcase from r209228
llvm-svn: 209229
2014-05-20 19:20:23 +00:00
Duncan P. N. Exon Smith d22b97c30b GlobalValue: Testcase for hidden visibility and local linkage
This is a testcase for r209227, a change in LLVM that automatically sets
visibility to default when the linkage is changed to local (rather than
asserting).

What this testcase triggers is hard to reproduce otherwise:  the
`GlobalValue` is created (with non-local linkage), the visibility is set
to hidden, and then the linkage is set to local.

PR19760

llvm-svn: 209228
2014-05-20 19:04:31 +00:00
Yaron Keren 065da7c53a Fixed spelling.
llvm-svn: 209224
2014-05-20 18:23:05 +00:00
Jordan Rose 7afd71e4ff Add a check for tautological bitwise comparisons to -Wtautological-compare.
This catches issues like:

if ((x & 8) == 4) { ... }
if ((x | 4) != 3) { ... }

Patch by Anders Rönnholm!

llvm-svn: 209221
2014-05-20 17:31:11 +00:00
Peter Collingbourne d2402470ee Make the wording for the flatten docs a little clearer.
llvm-svn: 209220
2014-05-20 17:30:03 +00:00
Eric Christopher 4c08be18b1 Fix testcase for case.
llvm-svn: 209218
2014-05-20 17:15:31 +00:00
Peter Collingbourne 41af7c2fdc Implement the flatten attribute.
This is a GNU attribute that causes calls within the attributed function
to be inlined where possible. It is implemented by giving such calls the
alwaysinline attribute.

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

llvm-svn: 209217
2014-05-20 17:12:51 +00:00
Eric Christopher c9e2a68905 Clean up language and grammar.
Based on a patch by jfcaron3@gmail.com!
PR19806

llvm-svn: 209215
2014-05-20 17:10:39 +00:00
NAKAMURA Takumi 32d832af98 clang/test/SemaCXX/err_init_conversion_failed.cpp: Tweak for i686-msvc.
For targeting i686-msvc, declarations are seen as thiscall like;

  void (template_test::S::*)(const int &) __attribute__((thiscall))
  void (template_test::S::*)(int) __attribute__((thiscall))

It didn't affect x86_64-msvc.

llvm-svn: 209212
2014-05-20 15:44:42 +00:00
Aaron Ballman 981ba24156 None of these attributes require FunctionTemplate to be explicitly listed as part of their subject definition. FunctionTemplateDecls are not what the attribute appertains to in the first place -- it attaches to the underlying FunctionDecl.
The attribute emitter was using FunctionTemplate to map the diagnostic to "functions or methods", but that isn't a particularly clear diagnostic in these cases anyway (since they do not apply to ObjC methods). Updated the attribute emitter to remove custom logic for FunctionTemplateDecl, and updated the test cases for the change in diagnostic wording.

llvm-svn: 209209
2014-05-20 14:10:53 +00:00
Daniel Jasper 069e5f4858 clang-format: [JS] Understand top-level function literals properly.
llvm-svn: 209205
2014-05-20 11:14:57 +00:00
Robert Lytton db8c1cb02c XCore target: sort typestring enum fields alphabetically
llvm-svn: 209196
2014-05-20 07:19:33 +00:00
Ben Langmuir 5988590363 Speculative fix for Windows buildbot after r209138
It appears that Windows doesn't like renaming over open files, which we
do in clearOutputFiles. The file being compiled should be safe to
removed, but this isn't very satisfying - we don't want to manually
manage the lifetime of files we cannot prove have no references.

llvm-svn: 209195
2014-05-20 05:55:04 +00:00
Craig Topper ccbc35edc2 [C++11] Use 'nullptr'. Tooling edition.
llvm-svn: 209192
2014-05-20 04:51:16 +00:00
Craig Topper 2554294321 [C++11] Use 'nullptr'. Analysis edition.
llvm-svn: 209191
2014-05-20 04:30:07 +00:00
Richard Trieu 5fe0a42ae9 Fix diagnostic message for member function pointer mismatches where one of the
classes is a template argument.

llvm-svn: 209190
2014-05-20 04:10:24 +00:00
Richard Trieu ccedd52736 Ignore void returning overloaded functions fom -Wunused-comparison. PR19791.
llvm-svn: 209186
2014-05-20 01:34:43 +00:00
Alp Toker 57cccec446 ARCMT/GC-check-warn-nsalloc.m: don't provide a diag group
This diagnostic is now controlled solely by -no-ns-alloc-error thus matching
the original intended behaviour.

llvm-svn: 209184
2014-05-19 23:48:49 +00:00
Adrian Prantl 2dbdd20d37 Demote the "Debug Info Version" module flag to llvm::Module::Warning
behavior on mismatch. The AutoUpgrader will drop incompatible debug info
any way and also emit a warning diagnostic for it.

rdar://problem/16926122

llvm-svn: 209182
2014-05-19 23:40:06 +00:00
Renato Golin c296d951a7 Using SmallString and correct addr var
llvm-svn: 209180
2014-05-19 23:25:25 +00:00
Alp Toker 97b084f528 Improve test verification from r209172
llvm-svn: 209175
2014-05-19 22:56:13 +00:00
Alp Toker 403a4f9b82 Get ARCMT/GC-check-warn-nsalloc.m working
The -no-ns-alloc-error migration option now causes the diagnostic to be ignored
completely. If this isn't desired, the error can be downgraded to a warning
using the usual -Wno-error=arcmt-ns-alloc.

Note that we can't use -verify right now on this test because
VerifyDiagnosticConsumer gets confused by multiple SourceManager instances,
which is presumably the reason it was XFAILed in the first place and why the
regression wasn't detected. We'll grep instead for now.

llvm-svn: 209172
2014-05-19 22:51:11 +00:00
Renato Golin 156a853ccb Fix usage of string when StringRef was needed
Also adding a variable to the test, so release bots match %1.
This should also calm the gdb buildbot.

.

llvm-svn: 209171
2014-05-19 22:36:19 +00:00
Richard Smith 1be902c02f [modules] Fix ODR violation: there's another clang::TypeLocVisitor elsewhere.
llvm-svn: 209169
2014-05-19 22:34:38 +00:00
Richard Smith ff6c0c18a8 [module] Remove a header that isn't used and doesn't compile.
llvm-svn: 209168
2014-05-19 22:20:41 +00:00
Peter Collingbourne b4728c12e8 Implement the no_split_stack attribute.
This is a GNU attribute that allows split stacks to be turned off on a
per-function basis.

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

llvm-svn: 209167
2014-05-19 22:14:34 +00:00
Richard Smith 851072efb7 If two sibling modules declare the same entity, and we indirectly pull a
declaration of that entity in from one of those modules, keep track of the fact
that we've not completed the redeclaration chain yet so that we can pull the
remaining declarations in from the other module if they're needed.

llvm-svn: 209161
2014-05-19 20:59:20 +00:00
Hans Wennborg 7f26fa6715 Allow dllimport on function definitions when they're template instantiations
llvm-svn: 209157
2014-05-19 20:14:13 +00:00
Renato Golin 230c5eb4bd Non-allocatable Global Named Register
This patch implements global named registers in Clang, lowering to the just
created intrinsics in LLVM (@llvm.read/write_register). A new type of LValue
had to be created (Register), which just adds support to carry the metadata
node containing the name of the register. Two new methods to emit loads and
stores interoperate with another to emit the named metadata node.

No guarantees are being made and only non-allocatable global variable named
registers are being supported. Local named register support is unchanged.

llvm-svn: 209149
2014-05-19 18:15:42 +00:00
Aaron Ballman 194cfa9b21 Removing an XFAIL which shouldn't apply. We no longer care about MSVC 9, and this test probably should not have been XFAILed everywhere regardless. The test passes on Windows with MSVC 12.
llvm-svn: 209148
2014-05-19 17:58:28 +00:00
Hans Wennborg 5161db61a9 test/CodeGenCXX/dllexport.cpp: -O2 and -disable-llvm-optzns aren't nedded
We only need them on the dllimport.cpp test to make sure that we emit code
for available_externaly functions, and don't inline the IR.

llvm-svn: 209145
2014-05-19 17:23:01 +00:00
Ben Langmuir caea13185e Don't refresh stat() info for pcm files
Follow-up fix for 209138.  Actually, since we already have this file
open, we don't want to refresh the stat() info, since that might be
newer than what we have open (bad!).

llvm-svn: 209143
2014-05-19 17:04:28 +00:00
Aaron Ballman 06c59e2598 This test doesn't need to be XFAILed anywhere; it just needed to be updated to the appropriate diagnostic wording.
llvm-svn: 209140
2014-05-19 16:35:00 +00:00
Ben Langmuir ca39214f4e Fix use-after-free and spurious error during module load
FileManager::invalidateCache is not safe to call when there may be
existing references to the file. What module load failure needs is
to refresh so stale stat() info isn't stored.

This may be the last user of invalidateCache; I'll take a look and
remove it if possible in a future commit.

This caused a use-after-free error as well as a spurious error message
that a module was "found in both 'X.pcm' and 'X.pcm'" in some cases.

llvm-svn: 209138
2014-05-19 16:13:45 +00:00
Anton Yartsev 45056dc50a [analyzer] Alpha and implicit checker lists, expand/collapse feature.
The list of alpha and the list of implicit checkers added. An ability to expand/collapse long texts added. Markup fixed.

http://reviews.llvm.org/D3457

llvm-svn: 209131
2014-05-19 15:04:55 +00:00
Aaron Ballman 9ae6c62161 This test is XFAILed on Windows, but I cannot see a reason as to why it should be failing. The original commit which XFAILed this was r111581, which suggested something was wrong with file remapping, but that may have been subsequently fixed.
Removing the XFAIL, but will watch the build bots to see if any go red because of this. Local testing on Windows succeeds.

llvm-svn: 209130
2014-05-19 15:02:10 +00:00
Aaron Ballman 857c7fb448 Fixing some comments in this test. No functional changes.
llvm-svn: 209128
2014-05-19 14:52:09 +00:00
Joey Gouly b1d23a8db3 [OpenCL] Reject reqd_work_group_size(X, Y, Z) where X, Y or Z == 0.
Patch by Pedro Ferreira!

llvm-svn: 209127
2014-05-19 14:41:38 +00:00
Oliver Stannard 9b2a7d4f2d Pass -gdwarf-N options to integrated assembler
llvm-svn: 209124
2014-05-19 13:39:13 +00:00
Oliver Stannard a3afc69b94 ARM: PCS non-compliance when struct is padded to avoid register/stack split, and requires internal padding
When we were padding a struct to avoid splitting it between registers and
the stack, we were throwing away the type which the argument should be coerced
to.

llvm-svn: 209122
2014-05-19 13:10:05 +00:00
Manuel Klimek fcfc213c3f Make the ARCMT tests self-contained.
This is necessary to reduce staging times on parallel build systems.

llvm-svn: 209120
2014-05-19 11:51:44 +00:00
Daniel Jasper 7f0c517168 clang-format: Don't force line breaks in ObjC calls with ColumnLimit 0.
Before:
  [self.x a:b c:d];

Got reformatted toi (with ColumnLimit set to 0):
  [self.x a:b
          c:d];

llvm-svn: 209114
2014-05-19 08:06:34 +00:00
Daniel Jasper 0dd5291e69 clang-format: [JS] Support ES6 destructuring assignments.
Before:
  var[a, b, c] = [1, 2, 3];

After:
  var [a, b, c] = [1, 2, 3];

llvm-svn: 209113
2014-05-19 07:37:07 +00:00
Daniel Jasper 78214397a3 clang-format: [JS] Support for EC6 arrow functions.
Before:
  var b = a.map((x) = > x + 1);

After:
  var b = a.map((x) => x + 1);

llvm-svn: 209112
2014-05-19 07:27:02 +00:00
Alp Toker 180e327f1c RAV reunification: MSPropertyRefExpr visitation
r179585 introduced different MSPropertyRefExpr visitation for RAV and DRAV that
appears to have been unintentional. Let's use the more complete one.

llvm-svn: 209101
2014-05-18 21:01:45 +00:00
Alp Toker b69030a8bd RAV reunification: merge r162133 (visit the TypeLoc when RecursiveASTVisitor visits a CompoundLiteralExpr)
llvm-svn: 209100
2014-05-18 21:00:44 +00:00
Alp Toker f66ed2d430 Ongoing RAV reunification
* Shuffle around code to reduce delta between the two RAVs.
 * Merge r189185 that was applied only to one of the RAVs and became apparent during the unification work.
 * Fix Enqueue data recursion typo.

Our delta is down to +-579!

llvm-svn: 209093
2014-05-18 18:38:28 +00:00
Alp Toker b67c67bbe0 Format the two RecursiveASTVisitors
Apply current ToT clang-format on the two RAVs to reduce delta and help
identify differences between the two.

We lose a little pretty formatting in the headers but that's the price to pay
so we can diff these two files effectively and look to a future where we don't
have to maintain two copies of this code.

Formatting and whitespace only.

llvm-svn: 209092
2014-05-18 18:38:19 +00:00
Alp Toker f3ce43e690 Begin RAV reunification: s/DataRecursiveASTVisitor/RecursiveASTVisitor/
Define a macro to reduce the delta between RecursiveASTVisitor and
DataRecursiveASTVisitor.

Some years ago, someone thought it was a good idea to copy the entire RAV to
support cursor visitation in libclang.

Since then the two have diverged needlessly and the rest is history.

This series of commits aims to reduce delta between the two so that we can
reason about their differences, apply bugfixes that were only made to one but
not the other, and ultimately find a way to unify two two chunks of code.

llvm-svn: 209091
2014-05-18 18:38:08 +00:00
Alp Toker 7755aff556 Remove historical Unicode TODOs
There's no immediate demand or plan to work on these.

llvm-svn: 209090
2014-05-18 18:37:59 +00:00
Benjamin Kramer f30d4460fc Remove unused diagnostic.
llvm-svn: 209087
2014-05-18 12:05:21 +00:00
Saleem Abdulrasool 6deb816c1c Driver: force restricted IT blocks for Windows on ARM
Windows on ARM expects ARMv8 (restricted IT) conditional instructions only.
Force enable the restricted IT mode via the backend option when targeting WoA.

llvm-svn: 209086
2014-05-18 06:42:02 +00:00
Craig Topper d2d442ca73 [C++11] Use 'nullptr'. Lex edition.
llvm-svn: 209083
2014-05-17 23:10:59 +00:00
Rafael Espindola 234405bd0f Update for llvm api change.
llvm-svn: 209077
2014-05-17 21:30:14 +00:00
Rafael Espindola 6172277e9f Update for llvm api change.
llvm-svn: 209074
2014-05-17 19:58:16 +00:00
Craig Topper 210e1aded7 [C++11] Use 'nullptr'. ASTMatchers edition.
llvm-svn: 209070
2014-05-17 18:49:24 +00:00
Craig Topper 92fc2dfa6f [C++11] Use 'nullptr'. Driver edition.
llvm-svn: 209069
2014-05-17 16:56:41 +00:00
Saleem Abdulrasool b9081f4490 CodeGen: remove MinGW and Cygwin legacy entries
These are now treated as environments.  Remove references to these enumeration
values in order to clean up the unused enumeration entries in LLVM.  The target
normalisation prior to tool invocation should ensure that the old values
continue to function properly.

llvm-svn: 209068
2014-05-17 15:46:59 +00:00
Alp Toker 2d57cea256 Provide and use a safe Token::getRawIdentifier() accessor
llvm-svn: 209061
2014-05-17 04:53:25 +00:00
Richard Smith ec2748a8ad More fixes for isBetterOverloadCandidate not being a strict weak ordering. The
bug was obvious from inspection, figuring out a way to test it was... less so.

llvm-svn: 209060
2014-05-17 04:36:39 +00:00
Argyrios Kyrtzidis d4d5534034 [objcmt] Don't wrap a PCH generation action with a ObjCMigrateAction one, it messes up the PCH file.
rdar://16941811

llvm-svn: 209059
2014-05-17 04:35:12 +00:00
Richard Smith 9516eee2f2 Switch to a more efficient expression of this check.
llvm-svn: 209055
2014-05-17 02:21:47 +00:00
Richard Smith 6fdeaabda9 Correct incoherent function versus function template partial ordering for conversion operators (the comparison could claim that two conversion operators are both better than each other). Actually implement DR495, rather than passing its test by chance because the declarations happened to be in the "lucky" order.
llvm-svn: 209054
2014-05-17 01:58:45 +00:00
Alp Toker b0869036c1 Tweak diagnostic wording for init list narrowing
The conventional form is '<action> to silence this warning'.

Also call the diagnostic an 'issue' rather than a 'message' because the latter
term is more widely used with reference to message expressions.

llvm-svn: 209052
2014-05-17 01:13:18 +00:00
Richard Smith fdcd710199 Add missed file from r209046.
llvm-svn: 209047
2014-05-16 23:16:06 +00:00
Richard Smith 053f6c6c9e If a declaration is loaded, and then a module import adds a redeclaration, then
ensure that querying the first declaration for its most recent declaration
checks for redeclarations from the imported module.

This works as follows:
 * The 'most recent' pointer on a canonical declaration grows a pointer to the
   external AST source and a generation number (space- and time-optimized for
   the case where there is no external source).
 * Each time the 'most recent' pointer is queried, if it has an external source,
   we check whether it's up to date, and update it if not.
 * The ancillary data stored on the canonical declaration is allocated lazily
   to avoid filling it in for declarations that end up being non-canonical.
   We'll still perform a redundant (ASTContext) allocation if someone asks for
   the most recent declaration from a decl before setPreviousDecl is called,
   but such cases are probably all bugs, and are now easy to find.

Some finessing is still in order here -- in particular, we use a very general
mechanism for handling the DefinitionData pointer on CXXRecordData, and a more
targeted approach would be more compact.

Also, the MayHaveOutOfDateDef mechanism should now be expunged, since it was
addressing only a corner of the full problem space here. That's not covered
by this patch.

Early performance benchmarks show that this makes no measurable difference to 
Clang performance without modules enabled (and fixes a major correctness issue
with modules enabled). I'll revert if a full performance comparison shows any
problems.

llvm-svn: 209046
2014-05-16 23:01:30 +00:00
Rafael Espindola 0fcad8837b Use getAliasee instead of getAliasedGlobal.
No functionality change.

llvm-svn: 209038
2014-05-16 22:20:18 +00:00
Eric Christopher e76eee4638 Missed a ! in the if statement when these were being set and the options
are inverted in clang and llvm.

I'll attempt to get a testcase for this that doesn't involve compiling to .s,
but it's unlikely.

llvm-svn: 209017
2014-05-16 20:46:14 +00:00
Rafael Espindola b2633b9793 Update for llvm api change.
Now that llvm cannot represent alias cycles, we have to diagnose erros just
before trying to close the cycle. This degrades the errors a bit. The real
solution is what it was before: if we want to provide good errors for these
cases, we have to be able to find a clang level decl given a mangled name
and produce the error from Sema.

llvm-svn: 209008
2014-05-16 19:35:48 +00:00
Joey Gouly 0d9a2b2205 [ASTMatchers] Move the 'isImplicit' matcher from CXXConstructorDecl to Decl.
llvm-svn: 209006
2014-05-16 19:31:08 +00:00
Alp Toker 2e9ce4c565 Merge a couple of copy-and-pasted functions
No change in functionality.

llvm-svn: 209005
2014-05-16 18:59:21 +00:00
Alp Toker 6ac2cd01d2 Rename SourceManager::createFileIDForMemBuffer()
It makes more sense to just overload createFileID().

Gardening only.

llvm-svn: 209002
2014-05-16 17:23:01 +00:00
Alp Toker 77273fc52a Tooling: use stderr, not stdout for missing command line messages
Matches other tooling output that use stderr.

llvm-svn: 208988
2014-05-16 13:45:29 +00:00
Rafael Espindola 9750ce7ebd Update for llvm API change.
llvm-svn: 208984
2014-05-16 13:34:28 +00:00
Sylvestre Ledru 3cbaa468c2 Improve a scan-build message
llvm-svn: 208951
2014-05-16 07:03:15 +00:00
Duncan P. N. Exon Smith 540c3cd817 InstrProf: Look for the PIC-version of the profile runtime
If `-shared` is specified, pull in a PIC-version of the profile runtime,
which was added to compiler-rt in r208947.  I'm hoping this will get the
bots on my side.

llvm-svn: 208948
2014-05-16 04:09:41 +00:00
Richard Smith debcd500a0 Push implicitly-declared allocation functions into the IdResolver. Otherwise,
declaration merging in modules is unable to find them and we get bogus errors
and even crashes.

llvm-svn: 208944
2014-05-16 02:14:42 +00:00
Richard Smith ee390436b9 Replace a fake enum class with the real thing.
llvm-svn: 208943
2014-05-16 01:56:53 +00:00
Ben Langmuir 5bf828dd34 Switch another write_escaped to yaml::escape
I missed one in r206443.

llvm-svn: 208941
2014-05-16 01:38:59 +00:00
Duncan P. N. Exon Smith 9121220804 InstrProf: Set profile data to visibility hidden
Shared objects are fairly broken for InstrProf right now -- a follow-up
commit in compiler-rt will fix the rest of this.

The main problem here is that at link time, profile data symbols in the
shared object might get used instead of symbols from the main
executable, creating invalid profile data sections.

<rdar://problem/16918688>

llvm-svn: 208939
2014-05-16 01:24:00 +00:00