Commit Graph

52435 Commits

Author SHA1 Message Date
Alp Toker 87d3975369 libclang: remove 'CXDiagnostic_Remark'
The change was landed without review or test cases.

It trivially broke almost any stable application checking for Severity >=
CXDiagnostic_Error or indeed any other kind of severity comparison upon
encountering a 'remark'.

Mapped to CXDiagnostic_Warning until a workable solution is proposed to the
list that preserves API stability.

(It's also not clear why the rest of r202475 wasn't simply implemented as a
modifier to the existing 'warning' level.)

llvm-svn: 207319
2014-04-26 14:43:53 +00:00
Nick Lewycky 0c2986f78e Add mangling for attribute enable_if. The demangling patch for libcxxabi is still in review.
llvm-svn: 207296
2014-04-26 00:14:00 +00:00
Warren Hunt f0ffdb2e60 Fixed Assert In CGRecordLowering
Prior to this patch, CGRecordLower assumed that virtual bases could not 
be placed before the nvsize of an object.  This isn't true in Itanium 
mode, virtual bases are placed at dsize rather than vnsize and in the 
case of zero sized non-virtual bases nvsize can be larger than dsize.  
This patch fixes CGRecordLowering to avoid an assert and to clip 
bitfields properly in this case.  A test case is included.

llvm-svn: 207280
2014-04-25 21:56:30 +00:00
Saleem Abdulrasool b9f07e3dbc CodeGen: add __yield intrinsic for ARM
The __yield intrinsic generates a hint instruction to indicate that the thread
is not performing any useful operations at the moment.  This is for
compatibility with MSVC, although, the intrinsic is also part of the ACLE, and
is enabled globally as a result.

llvm-svn: 207275
2014-04-25 21:13:29 +00:00
Benjamin Kramer 694acb3375 Make test pass on 32 bit architectures.
llvm-svn: 207268
2014-04-25 20:49:10 +00:00
Benjamin Kramer 1adc8c3391 Print detailed vector type information on diagnostics.
We never aka vector types because our attributed syntax for it is less
comprehensible than the typedefs. This leaves the user in the dark when
the typedef isn't named that well.

Example:
  v2s v; v4f w;
  w = v;

The naming in this cases isn't even that bad, but the error we give is
useless without looking up the actual typedefs.
t.c:6:5: error: assigning to 'v4f' from incompatible type 'v2s'

Now:
t.c:6:5: error: assigning to 'v4f' (vector of 4 'float' values) from
    incompatible type 'v2s' (vector of 2 'int' values)

We do this for all diagnostics that print a vector type.

llvm-svn: 207267
2014-04-25 20:41:38 +00:00
Nico Weber e68b847fdb Fix leak of GlobalModuleIndex::IdentifierIndex, found by LSan.
llvm-svn: 207262
2014-04-25 19:45:23 +00:00
Richard Smith 6c6ef822b0 PR19558: don't produce an "unused variable" warning for a variable template partial specialization.
llvm-svn: 207260
2014-04-25 19:21:40 +00:00
Saleem Abdulrasool 0fd930e86c CodeGen: replace use of @llvm.arm.sevl with @llvm.arm.hint
Use the new generic @llvm.arm.hint hint intrinsic rather than the specialised
@llvm.arm.sevl hint instruction.

llvm-svn: 207243
2014-04-25 17:25:46 +00:00
David Majnemer 01bbd1b1c3 CodeGen: Cleanup variable linkage calculation
Almost all linkage calculation for VarDecls occured inside of
GetLLVMLinkageVarDefinition except for static data members.  Centralize
the logic so that it can be more readily reused.

No functionality change.

llvm-svn: 207241
2014-04-25 17:08:41 +00:00
David Majnemer f6acb76cb6 CodeGen: Refactor linkage/visibility calculation
It turns out that linkage and visibility have rather similar logic for
both functions and non-variable globals.  Split the calculation out so
that both sides may share this code.

No functionality change.

llvm-svn: 207239
2014-04-25 17:07:16 +00:00
David Blaikie 103a2de0b4 Push unique_ptr ownership of ASTUnits further back into their factories.
llvm-svn: 207237
2014-04-25 17:01:33 +00:00
Hans Wennborg 26a4430ee5 clang-cl: /fallback only applies to C or C++ files
We would previously hit an assert if using /fallback with an .ll file.

llvm-svn: 207234
2014-04-25 16:44:17 +00:00
Hans Wennborg bbb5f07626 clang-cl: pass -debug flag to the linker when compiling with debug info
llvm-svn: 207233
2014-04-25 16:24:19 +00:00
David Blaikie 39808ff901 Improve ownership of ASTUnits in libTooling by using std::unique_ptr.
llvm-svn: 207229
2014-04-25 14:49:37 +00:00
Rafael Espindola f828526268 Revert "Reland r206934 with a hopefully fixed test"
This reverts commit r207155.
The test was still failing.

llvm-svn: 207225
2014-04-25 13:29:03 +00:00
Kostya Serebryany d0f841ce4a fix a test-only leak found by lsan, PR19521
llvm-svn: 207223
2014-04-25 12:58:42 +00:00
Justin Bogner 3212b18bbf CodeGen: Avoid instrumenting implicit Decls more effectively
We don't assign counters for implicit Decls, but we were emitting code
to increment the (non-existent) counters and adding empty counter
lists in the output. This fixes the checks in assignRegionCounters and
emitInstrumentationData to do the right thing, and adds an assert for
the pathological case of emitting zero counters.

llvm-svn: 207203
2014-04-25 07:20:05 +00:00
Saleem Abdulrasool 05f9613610 bindings: expose C++ access specifiers
Expose the enum CX_CXXAccessSpecifier in the python bindings as a property of
the cursor.  If access specifier is not applicable to the node, return the
INVALID specifier rather than raising an exception.

Patch by Tamás Szeli!

llvm-svn: 207173
2014-04-25 02:58:03 +00:00
Reid Kleckner 02fefcfc3b Reland r206934 with a hopefully fixed test
llvm-svn: 207155
2014-04-24 23:06:17 +00:00
Richard Smith eb36ddf462 If we see an explicit instantiation declaration or definition of a function
after we've already instantiated a definition for the function, pass it to the
ASTConsumer again so that it knows the specialization kind has changed and can
update the function's linkage.

This only matters if we instantiate the definition of the function before we
reach the end of the TU; this can happen in at least three different ways:
C++11 constexpr functions, C++14 deduced return types, and functions
instantiated within modules.

llvm-svn: 207152
2014-04-24 22:45:46 +00:00
Nico Weber d19e6a7e54 MicrosoftVTableContext: Don't leak VPtrInfos. Found by LSan, PR19522.
llvm-svn: 207138
2014-04-24 19:52:12 +00:00
Nico Weber 655af097a1 Fix a tiny test-only leak, found by LSan.
llvm-svn: 207137
2014-04-24 19:04:10 +00:00
Hans Wennborg ac156e2225 Intrin.h: remove __rdtsc and __rdtscp declarations
Since r207132, these are defined in ia32intrin.h.

llvm-svn: 207134
2014-04-24 18:40:06 +00:00
Andrea Di Biagio 7ceec07cf6 [X86] Add Clang support for intrinsics __rdtsc and __rdtscp.
This patch:
 1. Adds a definition for two new GCCBuiltins in BuiltinsX86.def:
   __builtin_ia32_rdtsc;
   __builtin_ia32_rdtscp;

 2. Replaces the already existing definition of intrinsic __rdtsc in
    ia32intrin.h with a simple call to the new GCC builtin __builtin_ia32_rdtsc.

 3. Adds a definition for the new intrinsic __rdtscp in ia32intrin.h

llvm-svn: 207132
2014-04-24 18:26:35 +00:00
Jordan Rose 7d2a5e6862 Squelch leak found by LSan by handling missing switch case.
Also, use the enum type in the switch so this doesn't happen again.

PR19523

llvm-svn: 207128
2014-04-24 17:27:18 +00:00
Daniel Sanders 81ea601b54 [mips] Support 128-bit int in N32 ABI by overriding TargetInfo::hasInt128Type()
Summary: The condition in the base class is rather strange. It says a target has the 128-bit integer type if the size of a pointer is >= 64-bits. N32 has 32-bit pointers but 64-bit integers. I'm a bit reluctant to change this for all targets so this patch makes the method virtual and overrides it for MIPS64.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits

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

llvm-svn: 207121
2014-04-24 16:05:26 +00:00
Tim Northover f4aee52345 AArch64: update tests to new way of printing NEON lists.
llvm-svn: 207117
2014-04-24 14:06:31 +00:00
NAKAMURA Takumi 3f27673e40 CommentToXMLConverter: Don't use "default" to method(s). It is unavailable in msc17.
llvm-svn: 207107
2014-04-24 12:44:34 +00:00
Daniel Sanders ff1c044ada [mips] Correct size_t and ptrdiff_t for N32.
Summary:
Correct size_t to be unsigned int and ptrdiff_t to be signed long. The types were the correct size before this change but
the exact type matters for name mangling and exception handling in C++.

Reviewers: atanasyan

Reviewed By: atanasyan

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

llvm-svn: 207093
2014-04-24 09:58:52 +00:00
Dmitri Gribenko 4f4dd17d05 Comment to XML conversion: use unique_ptr for SimpleFormatContext
llvm-svn: 207087
2014-04-24 07:52:31 +00:00
Argyrios Kyrtzidis edfe07fca0 Simplify leak fix of r207076, by just disposing the previous CXString.
llvm-svn: 207081
2014-04-24 06:05:40 +00:00
Nico Weber dc493cf13b Don't leak _all_ directives in -verify mode. Found by LSan, PR19520.
llvm-svn: 207079
2014-04-24 05:39:55 +00:00
Nico Weber 568dacc4aa Don't leak invalid RegexDirectives. Probably a small part of PR19520.
llvm-svn: 207077
2014-04-24 05:32:03 +00:00
Nico Weber aacf0313a5 Fix two leaks found by LSan.
A CursorPlatformAvailability can have several "unavailable" attributes, don't
leak all but the first.  I'm not sure if there can be several "deprecate"ds too,
but add the same logic there to keep the two code paths looking the same.

llvm-svn: 207076
2014-04-24 05:16:45 +00:00
Nico Weber dbd07fadae Fix two leaks found by LSan (one is test-only).
The result of llvm::MemoryBuffer::getMemBuffer() needs to be freed. Don't
pass "don't free" flag to overrideFileContents() to fix.

llvm-svn: 207075
2014-04-24 04:58:41 +00:00
Nico Weber 4fcf0c7b29 Fix two test-only leaks found by LSan.
The result of getBufferForFile() must be freed.
(Should we change functions that expect the caller to assume ownership so
that they return unique_ptrs instead? Then the type system makes sure we get
this right.)

llvm-svn: 207074
2014-04-24 04:26:18 +00:00
Nico Weber 82098cb6df Fix two leaks in c-index-test found by LSan.
The result of clang_getCursorSpelling() needs to be clang_getCursorSpelling()ed.

llvm-svn: 207073
2014-04-24 04:14:12 +00:00
Nico Weber 52fbbb16a1 Fix four more test-only leaks found by LSan.
Tool::run() doesn't take ownership of the passed action.

llvm-svn: 207071
2014-04-24 03:48:09 +00:00
Nico Weber 1f29ccf3fb Revert the "don't leak" part of r207065, looks like the bots don't like it :-/
http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/22506

llvm-svn: 207070
2014-04-24 03:31:27 +00:00
Nico Weber 7c3ccb032e Fix 3 test-only leaks found by LSan.
llvm-svn: 207068
2014-04-24 03:30:22 +00:00
Nico Weber 7deebef657 More spellchecking for Index.h
llvm-svn: 207067
2014-04-24 03:17:47 +00:00
Nico Weber dd9c19fe94 compeltions are never appropriate.
llvm-svn: 207066
2014-04-24 03:06:18 +00:00
Nico Weber 7de358e936 Don't leak objects in load-from-ast path unless DisableFree is set.
Also update a comment to match a code change that was done in r110978.

llvm-svn: 207065
2014-04-24 02:42:04 +00:00
Richard Smith f17fdbd791 When two templates get merged together, also merge their pattern declarations
together. This is extremely hairy, because in general we need to have loaded
both the template and the pattern before we can determine whether either should
be merged, so we temporarily violate the rule that all merging happens before
reading a decl ends, but *only* in the case where a template's pattern is being
loaded while loading the template itself.

In order to accomodate this for class templates, delay loading the injected
class name type for the pattern of the template until after we've loaded the
template itself, if we happen to load the template first.

llvm-svn: 207063
2014-04-24 02:25:27 +00:00
Michael J. Spencer 807cf41e2f Fix test to not depend on llvm optimizations.
llvm-svn: 207062
2014-04-24 02:16:29 +00:00
Nico Weber 1ada62654f Bury leaked sema pointer when reading from AST files.
Should suppress several LSan reports.

llvm-svn: 207056
2014-04-24 00:51:03 +00:00
Nico Weber 303ff60693 Fix another leak in ParseMicrosoftAsmStatement(), found by LSan.
llvm-svn: 207040
2014-04-23 22:07:21 +00:00
Reid Kleckner cae82a205e Suppress unused variable warning
llvm-svn: 207039
2014-04-23 22:03:04 +00:00
Richard Trieu d19d9dd365 Change -Wfloating-point-conversion to -Wfloat-conversion.
llvm-svn: 207037
2014-04-23 21:53:59 +00:00
Abramo Bagnara 6a9eaa2ebf Fixed comments (thanks to Richard Smith).
llvm-svn: 207036
2014-04-23 21:49:00 +00:00
Nico Weber 2d942deb19 Make RewriteRope less confusing for me. No intended behavior change.
llvm-svn: 207032
2014-04-23 21:42:27 +00:00
Nico Weber 795f6a9d7c Fix leak introduced in r194610, found by LSan.
LSan folks: LSan pointed to
    #0 0x4953e0 in operator new[](unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:64
    #1 0x7fb82af5372f in clang::RewriteRope::MakeRopeString(char const*, char const*) llvm/tools/clang/lib/Rewrite/Core/RewriteRope.cpp:796
instead of to the actual leak, which made tracking this down slower than
it could have been.

llvm-svn: 207031
2014-04-23 21:41:51 +00:00
Abramo Bagnara b8dcece68f Moved operator delete to public area to appease gcc and conform to C++ standard.
llvm-svn: 207027
2014-04-23 21:28:18 +00:00
Ben Langmuir ffbafa2af0 Do not print inferred submodules explicitly in __inferred_module.map
Otherwise including a header in your source file that is not included by
framework's umbrella header will silently add an empty submodule with that
name.

is automatically translated to
@import Foo.NotInModule;

which then would have succeeded because the inferred module map
contained an empty submodule called NotInModule.

llvm-svn: 207024
2014-04-23 21:10:46 +00:00
Nico Weber 01708cdcad Fix a memory leak found by LSan.
llvm-svn: 207013
2014-04-23 19:19:20 +00:00
John Thompson 2d94bbb0c0 Quick fix for layering that broke shared library build.
llvm-svn: 207011
2014-04-23 19:04:32 +00:00
Reid Kleckner e9591b33e2 MS ABI: Use a different guard variable for each weak global
We were using the same guard variable and failing to initialize the
second global.

Clang is still not MS ABI compatible in this area.  Fixing that is
PR16959, which will require LLVM changes to @llvm.global_ctors.

llvm-svn: 207008
2014-04-23 18:22:11 +00:00
Richard Smith 5b21db89d0 Make TypeDecl much less friendly.
llvm-svn: 207007
2014-04-23 18:20:42 +00:00
Fariborz Jahanian 9da2a799ab Objective-C [IRGen]. Fixes a crash in IRGen involving use of
'typeof' to extract type of an @encode expression used
in an initializer. // rdar://16655340

llvm-svn: 207004
2014-04-23 17:44:58 +00:00
Jordan Rose e811ab9582 [analyzer] Fix a leak found by LSan.
PR19524

llvm-svn: 207001
2014-04-23 16:54:52 +00:00
Alexander Kornienko fe65998777 Don't pass llvm::DenseSet<> by value.
Summary: Fixes massive performance problems on large translation units.

Reviewers: jordan_rose

Reviewed By: jordan_rose

Subscribers: cfe-commits

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

llvm-svn: 206999
2014-04-23 16:39:41 +00:00
Diego Novillo 9e43084fb4 Review feedback.
llvm-svn: 206997
2014-04-23 15:21:23 +00:00
Diego Novillo 897c59ce09 Review feedback.
llvm-svn: 206996
2014-04-23 15:21:21 +00:00
Diego Novillo 8ebff32487 Review feedback
llvm-svn: 206995
2014-04-23 15:21:20 +00:00
Diego Novillo a5256bf9fd Add documentation for sample profiling support.
Summary:
This documents the usage of sample profilers with Clang and the
profile format expected by LLVM's optimizers. It also documents the
profile conversion tool used by Linux Perf.

Reviewers: doug.gregor

CC: cfe-commits

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

llvm-svn: 206994
2014-04-23 15:21:07 +00:00
NAKAMURA Takumi ec9a7c0449 Prune \param introduced in r206977, possibly committed ahead. [-Wdocumentation]
llvm-svn: 206993
2014-04-23 15:13:39 +00:00
Logan Chien bf9e3843c4 Add missing test input for r206979.
llvm-svn: 206992
2014-04-23 15:00:03 +00:00
Aaron Ballman 47bff44d3d The rewrite constructor should actually rewrite.
llvm-svn: 206987
2014-04-23 14:40:19 +00:00
Aaron Ballman 8e8026d5b3 Replacing a naked pointer with a unique_ptr. No functional changes intended.
llvm-svn: 206986
2014-04-23 14:26:59 +00:00
Aaron Ballman b834050953 Minor formatting and simplification cleanup -- no functional changes intended.
llvm-svn: 206985
2014-04-23 14:22:06 +00:00
Aaron Ballman bf58a6a892 Updated to be a bit more const friendly. Also switched the linkage to be static since this function is file-local. No functional changes intended.
llvm-svn: 206982
2014-04-23 13:58:21 +00:00
John Thompson e0a5afe812 Fix unused variable.
llvm-svn: 206981
2014-04-23 13:45:44 +00:00
Logan Chien 6a00cc8306 Add aarch64-linux-android triple for Android.
llvm-svn: 206979
2014-04-23 13:36:23 +00:00
John Thompson 2255f2ce90 Initial implementation of -modules-earch-all option, for searching for symbols in non-imported modules.
llvm-svn: 206977
2014-04-23 12:57:01 +00:00
Timur Iskhodzhanov 9f23b203d3 Add yet another vtordisp test
llvm-svn: 206974
2014-04-23 12:46:26 +00:00
Rafael Espindola e3e047e768 This reverts commit r206934 and r206935.
The original messages were:
  "Driver: Honor %INCLUDE% when built with MinGW"
  "Add missing test triples"

The test was still failing on OS X.

llvm-svn: 206973
2014-04-23 12:38:13 +00:00
Evgeniy Stepanov eeb820f572 Update Target::createMCAsmParser calls for the LLVM interface change.
Patch by Yuri Gorshenin.

llvm-svn: 206970
2014-04-23 11:15:49 +00:00
James Molloy 3a9a023eb6 [ARM64] Enable more CodeGen tests for ARM64. The crypto and neon intrinsics tests needed changing slightly due to the naming differences between AArch64 and ARM64.
llvm-svn: 206964
2014-04-23 10:26:23 +00:00
James Molloy 8bdd24b1a9 [ARM64] Change inline assembly constraints to be more lax, to match the behaviour of Clang/AArch64 and GCC.
GCC allows sub-64bit values to use the 'r' register constraint.

llvm-svn: 206963
2014-04-23 10:26:19 +00:00
James Molloy a7a23c1cce [ARM64] Enable the test aarch64-type-sizes.c for ARM64 BE.
This completes the port of r203918 (cpirker "AArch64_be specific clang target settings") to ARM64.

llvm-svn: 206962
2014-04-23 10:26:12 +00:00
James Molloy 7f4ba53ef0 [ARM64] Add a missed case label for arm64_be, and enable the aarch64-varargs test for arm64_be.
This ensures that r203917 (cpirker "AArch64_be varargs processing for ARM ABI") is ported to ARM64.

llvm-svn: 206961
2014-04-23 10:26:08 +00:00
David Majnemer e3785bb03e MS ABI: Implement mangling for ref-qualifiers on methods
Mangle ref-qualifiers like the Nov 2013 CTP.

This fixes PR19361.

llvm-svn: 206946
2014-04-23 05:16:56 +00:00
David Majnemer b926dbcfe3 MS ABI: Use range-based for loops in the mangler
No functional change.

llvm-svn: 206945
2014-04-23 05:16:53 +00:00
David Majnemer 02e9af4032 MS ABI: Cleanup some egregious style violations
No functional change.

llvm-svn: 206944
2014-04-23 05:16:51 +00:00
David Majnemer c7b85c4380 AST: Cleanup/simplify some LV calculation code
No functional change.

llvm-svn: 206943
2014-04-23 05:16:48 +00:00
Justin Bogner 0cbb6d86c8 CodeGen: Unify handling guard variables in the Itanium C++ ABI
We previously treated ARM separately from the generic Itanium ABI for
initializing guard variables. This code duplication led to things like
the ARM path missing the memory barrier for threadsafe handling, and a
highly misleading comment about how we were (mis)using the generic ABI
for ARM64 when really it went through the ARM codepath.

This unifies the two code paths. Functionally, this changes the ARM
and ARM64 codepath to use one byte loads instead of 4 and 8,
respectively, and adds the missing atomic acquire to these loads.
Other architectures are unchanged.

llvm-svn: 206937
2014-04-23 01:50:10 +00:00
Reid Kleckner c85b9a5f54 Add missing test triples
llvm-svn: 206935
2014-04-23 00:57:34 +00:00
Reid Kleckner 9aff2ca27c Driver: Honor %INCLUDE% when built with MinGW
Users are expected to pass system includes through the INCLUDE
environment variable on Windows.  There's no reason to change behavior
based on the toolchain used to build Clang.

I didn't change the registry searching code because I'm not sure it
builds with mingw and I'm not set up to test it.

llvm-svn: 206934
2014-04-23 00:15:12 +00:00
Reid Kleckner 77b45ba301 Driver: Avoid a duplicate path separator and clean up code
llvm-svn: 206933
2014-04-23 00:15:01 +00:00
Richard Smith 70ee92fa4d Add some missing checks for C++1y digit separators that don't in fact separate
digits. Turns out we have completely separate lexing codepaths for floating
point numbers depending on whether or not they start with a zero. Who knew...
=)

llvm-svn: 206932
2014-04-22 23:50:25 +00:00
Richard Smith 06ffb45ce4 PR18746: If a constexpr function has a dependent return type and no return
statements, don't diagnose; the return type might end up being 'void'.

Patch by Rahul Jain! Tiny tweaks by me.

llvm-svn: 206929
2014-04-22 23:14:23 +00:00
Justin Bogner f893a6551b Driver: Skip the -fmodules-cache-path argument in driver crash diags
The modules cache path shouldn't be included in crash reports, as it's
a system (or run) specific directory.

llvm-svn: 206922
2014-04-22 21:30:17 +00:00
Diego Novillo b344224949 Use a manipulator to add a value to the current diagnostic flag.
Summary:
This addresses the feedback to
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140421/103598.html

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 206920
2014-04-22 19:56:49 +00:00
Quentin Colombet 6a9cf2629a [Driver][ARM64] Add a testcase for r206227.
llvm-svn: 206914
2014-04-22 18:29:43 +00:00
Fariborz Jahanian 953d18a988 Objective-C ARC. Under ARC, addition of 'bridge' attribute
on CF type is not sufficient and bridge casting is
still required for proper ownership semantics.
// rdar://16650445

llvm-svn: 206910
2014-04-22 17:42:01 +00:00
Ben Langmuir 749323fadb Attempt to fix null ASTContext in ASTUnit error path
We don't need the ASTContext for the diagnostics, only the language
options, which we can get from the compiler invocation. It worries me
how many categorically different states the ASTUnit class can be in
depending on how it is being constructed/used.

llvm-svn: 206909
2014-04-22 17:40:12 +00:00
Timur Iskhodzhanov 6b12850d27 Fix PR19487, PR19505 and PR19506 -- redundant vtordisp thunks when the final overrider is present in both a vbase and nvbase
Reviewed at http://reviews.llvm.org/D3449

llvm-svn: 206908
2014-04-22 17:32:02 +00:00
DeLesley Hutchins f1a311653a Thread safety analysis: add array operations to SExpr.
llvm-svn: 206907
2014-04-22 17:31:23 +00:00
DeLesley Hutchins 7834001496 Thread safety analysis: fix warning.
llvm-svn: 206899
2014-04-22 14:51:04 +00:00
NAKAMURA Takumi 7c0cd63d0d Try to fix warnings to escape '@' as '\@'. [-Wdocumentation-html]
clang/include/clang/Format/Format.h:185:8: error: HTML tag 'tt' requires an end tag [-Werror,-Wdocumentation-html]
    /// <tt>@property (readonly)</tt> instead of <tt>@property(readonly)</tt>.
        ~^~~

llvm-svn: 206893
2014-04-22 13:28:08 +00:00
Alexander Musman 8dba66412b [OPENMP] parsing 'linear' clause (for directive 'omp simd')
Differential Revision: http://reviews.llvm.org/D3272

llvm-svn: 206891
2014-04-22 13:09:42 +00:00
Tim Northover 761aa37e3e ARM64: update NEON test to improved backend codegen
llvm-svn: 206890
2014-04-22 12:45:55 +00:00
Dmitri Gribenko 6db07e2ab7 Comment parsing: close a hole in CDATA escaping in XML output
llvm-svn: 206886
2014-04-22 12:34:52 +00:00
Dmitri Gribenko 93043620bc Comment parsing: in the generated XML file, mark HTML that is safe to pass
through to the output even if the input comment comes from an untrusted source

Attribute filtering is currently based on a blacklist, which right now includes
all event handler attributes (they contain JavaScipt code).  It should be
switched to a whitelist, but going over all of the HTML5 spec requires a
significant amount of time.

llvm-svn: 206882
2014-04-22 10:59:13 +00:00
NAKAMURA Takumi f7e53446cd DiagnosticsEngine::Report(): Fix a warning. [-Wdocumentation]
llvm-svn: 206871
2014-04-22 08:32:01 +00:00
NAKAMURA Takumi 1fce16934f Update clang/test/PCH/single-token-macro.c corresponding to r206791.
__stdcall is defined as __attribute__((__stdcall__)) for targeting mingw32.

llvm-svn: 206870
2014-04-22 08:16:58 +00:00
Chandler Carruth 1034666777 [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE
definition below all of the header #include lines, clang edition.

If you want more details about this, you can see some of the commits to
Debug.h in LLVM recently. This is just the clang section of a cleanup
I've done for all uses of DEBUG_TYPE in LLVM.

llvm-svn: 206849
2014-04-22 03:17:02 +00:00
Richard Smith e334c01773 Move the C++11 ExtWarn for converting a string literal to 'char*' out of
-Wc++11-compat-deprecated-writable-strings. It's neither a C++11 compatibility
warning nor a deprecated feature, it's just ill-formed.

In passing, add that warning to -Wdeprecated, where it belongs.

llvm-svn: 206833
2014-04-22 01:11:06 +00:00
Richard Trieu 393197a08e Move the warning of implicit cast of a floating point to an integer out of
-Wconversion and into it's own group, -Wfloating-point-conversion.

llvm-svn: 206832
2014-04-22 01:01:05 +00:00
DeLesley Hutchins f8b412adbb Thread safety analysis: misc updates to SExpr handling. Fix to minimal SSA,
function parameters, and compound assignment.

llvm-svn: 206827
2014-04-21 23:18:18 +00:00
Diego Novillo 9f23997732 Allow adding a value to a flag in diagnostics.
Summary:
This allows callers of Diags.Report() to append a value to the name of
the flag associated with the diagnostic. This is useful in cases like
the -Rpass flag, where we want the diagnostic to show the name of the
pass that matched the pattern. Instead of showing "... [-Rpass]", this
allows us to show "... [-Rpass=passname]".

Reviewers: rsmith

CC: cfe-commits

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

llvm-svn: 206826
2014-04-21 23:16:03 +00:00
Chandler Carruth 57f5fbe3b2 [Modules] Update Clang's two files that use DEBUG(...) without defining
DEBUG_TYPE to do so. LLVM's Debug.h requires this as of r206822.

llvm-svn: 206823
2014-04-21 22:55:36 +00:00
Chandler Carruth 48ec7c0569 [Modules] Remove the only use of the DEBUG(...) macro in the compiler
parts of Clang. I don't really have any opinion about whether using that
macro is good or bad, but its odd that this is the only one, and Eric
seemed happy with just nuking it for now.

llvm-svn: 206806
2014-04-21 22:32:54 +00:00
Reid Kleckner 70cfa66fe3 Try to fix bad Twine usage in r206791 with std::string
I'm pretty sure I was referencing destroyed temporaries here.  I'm open
to suggestions on how to write this better.

llvm-svn: 206804
2014-04-21 22:29:45 +00:00
Reid Kleckner 4760683b04 MinGW: Define __stdcall&co when -fms-extensions is disabled
This is for compatibility with GCC.

Reviewers: asl

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

llvm-svn: 206791
2014-04-21 20:58:00 +00:00
Timur Iskhodzhanov d60ae72c42 Split out the rest of MS ABI multiple inheritance tests
Intentionally duplicate base class definitions per test, so it's easier to copy tests while debugging failures.

llvm-svn: 206782
2014-04-21 20:23:34 +00:00
Fariborz Jahanian 29cdbc6319 Objective-C. Patch to allow use of dot syntax on class
objects to fund root class's instance methods.
// rdar://16650575

llvm-svn: 206781
2014-04-21 20:22:17 +00:00
Ben Langmuir 4898cde4e1 Allow submodule inferrences with a missing umbrella when the module is unavailable
If the module is unavailable because of a missing header, don't diagnose
a "module * {}" declaration for having a missing umbrella.

llvm-svn: 206776
2014-04-21 19:49:57 +00:00
Ted Kremenek dd21b89a25 Handle possible trailing '/' in xcode-select output. Patch by Jeff Olson.
llvm-svn: 206752
2014-04-21 14:13:22 +00:00
Richard Smith 86dbed7577 Initialize clang::Module::IsMissingRequirement. Fix msan issue and hopefully some builder failures.
llvm-svn: 206736
2014-04-21 07:28:16 +00:00
Bob Wilson 373af73ad4 ARM64: Do not expand variadic HFA/HVA arguments with the Darwin ABI.
Unlike the standard AAPCS64 ABI, variadic arguments are always passed on the
stack with the Darwin ABI, and this was not being considered when deciding
whether to expand HFA/HVA arguments in a call. An HFA argument with a "float"
base type was being expanded into separate "float" arguments, each of which
was then extended to a double, resulting in a serious mismatch from what is
expected by the va_arg implementation. <rdar://problem/15777067>

llvm-svn: 206729
2014-04-21 01:23:39 +00:00
Bob Wilson 3abf169549 Fix a comment typo.
llvm-svn: 206728
2014-04-21 01:23:36 +00:00
Alp Toker 3a3ee3e376 cindex.py: Avoid deprecated function
Implement Diagnostic::category_name() using clang_getDiagnosticCategoryText()
instead of the deprected clang_getDiagnosticCategoryName().

Preserves existing behaviour and API covered by existing tests.

llvm-svn: 206712
2014-04-20 01:07:03 +00:00
Alp Toker 5f072d814f Remove some empty statements
Cleanup only.

llvm-svn: 206709
2014-04-19 23:55:49 +00:00
Alp Toker f424a597df Fix and restore the macro-multiline.c test
This test didn't work as intended and was ultimately disabled some years ago in
r169458.

Indeed it's not clear if the '\n' was ever passed through to the driver
correctly given that lit would insert '&& {' at the newline.

Test rewritten to use printf/xargs to insert '\n' in a more reliable manner and
to use FileCheck for verification.

llvm-svn: 206703
2014-04-19 21:40:58 +00:00
Alp Toker 07508405f4 Disallow driver use in more Sema tests
There are now only a handful of Sema tests remaining that use %clang in
SemaCXX, SemaObjC and SemaTemplate.

llvm-svn: 206688
2014-04-19 19:07:31 +00:00
Alp Toker 8ee5b01f34 Move ObjC Cocoa.h header test to Headers
This tests for broad compatibility with platform SDK headers using the clang
driver and so belongs alongside the other header ingtegration tests.

llvm-svn: 206687
2014-04-19 19:07:24 +00:00
Alp Toker 7591a05d14 Re-enable the C++11 modules integration test on OS X
XCode 5.1.1 has shipped with fixed SDK headers.

This reverts commit r200256.

Fixes PR18322.

llvm-svn: 206686
2014-04-19 19:07:19 +00:00
NAKAMURA Takumi f0c40f7952 clang/test/Index/pch-with-errors.c: Remove XFAIL added in r206294. It has been fixed since r206644.
llvm-svn: 206685
2014-04-19 16:49:22 +00:00
Richard Smith 3c326b36cc Speculative fix for buildbot failure. Apparently Clang 3.1 got move semantics wrong.
llvm-svn: 206682
2014-04-19 04:28:00 +00:00
DeLesley Hutchins a9db0019a2 Thread Safety Analysis: Convert to minimal SSA.
llvm-svn: 206681
2014-04-19 03:54:41 +00:00
Richard Smith cd45dbc5f2 When a module completes the definition of a class template specialization imported from another module, emit an update record, rather than using the broken decl rewriting mechanism. If multiple modules do this, merge the definitions together, much as we would if they were separate declarations.
llvm-svn: 206680
2014-04-19 03:48:30 +00:00
DeLesley Hutchins ae497deddf Thread Safety Analysis: Update SSA pass to handle loops.
llvm-svn: 206676
2014-04-19 00:35:54 +00:00
Ben Langmuir 993055f860 Fix a hole with nested unavailable submodules from r206664
If a module doesn't meet a requirement, neither do its submodules. If we
don't propogate that, we might think it's an error to be missing a
header in one of those submodules.

llvm-svn: 206673
2014-04-18 23:51:00 +00:00
Justin Bogner 8776638235 CodeGen: Remove an unused include
llvm-svn: 206667
2014-04-18 22:31:07 +00:00
Ben Langmuir ec8c975214 Don't build modules with (submodules with) missing headers
Unless they are in submodules that aren't available anyway, due to
requirements not being met.  Also, mark children as unavailable when the
parent is.

llvm-svn: 206664
2014-04-18 22:07:31 +00:00
Reid Kleckner 230f662d12 Fix sphinx-build warnings in clang docs.
llvm-svn: 206661
2014-04-18 21:55:49 +00:00
Reid Kleckner 5d21c4990f Add support for building Sphinx documentation when being inside LLVM source tree and using CMake
Patch by Daniel Liew <daniel.liew@imperial.ac.uk>!

llvm-svn: 206660
2014-04-18 21:55:46 +00:00
Justin Bogner 837a6f6f79 CodeGen: Use LLVM's InstrProfReader in -fprofile-instr-use=
Update clang to use the InstrProfReader from LLVM to read
instrumentation based profile data. This also switches us from the
naive text format to the binary format, since that's what's
implemented in the reader.

llvm-svn: 206658
2014-04-18 21:52:00 +00:00
Justin Bogner fc83c1105c [Cleanup] Remove a trailing whitespace
llvm-svn: 206657
2014-04-18 21:51:09 +00:00
Ben Langmuir 532fdc0d4f Don't read CompilerInstance fields that don't exist in ASTUnit
When transferring data from a CompilerInstance in an error path we need
to consider cases where the various fields are uninitialized.

llvm-svn: 206644
2014-04-18 20:39:48 +00:00
Justin Bogner 25463f1577 Teach users of OnDiskHashTable to define hash_value and offset types
This paves the way to making OnDiskHashTable work with hashes that are
not 32 bits wide and to making OnDiskHashTable work very large hash
tables. The LLVM change to use these types is upcoming.

llvm-svn: 206640
2014-04-18 20:27:24 +00:00
Justin Bogner bb094f0669 Remove OnDiskHashTable.h, since it's been moved to llvm
llvm-svn: 206637
2014-04-18 19:57:06 +00:00
Timur Iskhodzhanov 675bf27ab7 Split out the no-thunk multiple inheritance tests
Also, intentionally duplicate base class definitions per test, so it's easier to copy tests while debugging failures

llvm-svn: 206614
2014-04-18 15:10:05 +00:00
Dmitri Gribenko 62bcd925c0 Add more constness to module-related APIs
llvm-svn: 206595
2014-04-18 14:36:51 +00:00
Tim Northover 4dab69815c ARM64: make sure the caller is expected to extend in AAPCS.
This is one of those DarwinPCS differences. It'd been caught in
arguments, but not return values.

llvm-svn: 206594
2014-04-18 13:46:08 +00:00
Aaron Ballman 0491afaf5f Updating to use more range-based for loops, nullptr and auto. No functional changes.
llvm-svn: 206590
2014-04-18 13:13:15 +00:00
Tim Northover 07f1624aa2 ARM64: make sure HFAs on the stack get properly aligned.
Another AAPCS bug, part of PR19432.

llvm-svn: 206580
2014-04-18 10:47:44 +00:00
Reid Kleckner 7c1db7676e Fix a -Wmicrosoft warning on an unrepresentable enum
0x80000000 isn't representable as an int, which is the default enum
type.

llvm-svn: 206545
2014-04-18 01:21:55 +00:00
Duncan P. N. Exon Smith 85e349fd2c BackendUtil: Pass through -mdisable-tail-calls
The frontend option -fno-optimize-sibling-calls resolves to -cc1's
-mdisable-tail-calls, which is passed to the TargetMachine in the
backend.  PassManagerBuilder was adding the -tailcallelim pass anyway.

Use a new DisableTailCalls option in PassManagerBuilder to disable tail
calls harder.

Requires the matching commit in LLVM that adds DisableTailCalls.

<rdar://problem/16050591>

llvm-svn: 206543
2014-04-18 01:05:25 +00:00
Justin Bogner 534f14abe7 test: Use llvm-profdata merge in Profile tests
In preparation for using a binary format for instrumentation based
profiling, explicitly treat the test inputs as text and transform them
before running. This will allow us to leave the checked in files in
human readable format once the instrumentation format is binary.

No functional change.

llvm-svn: 206509
2014-04-17 22:49:06 +00:00
Reid Kleckner fd385407fa MS ABI: Don't append to vbtables that we shouldn't extend
This was probably a benign bug, since nobody would look at the vbtable
slots that we were filling in.

llvm-svn: 206508
2014-04-17 22:47:52 +00:00
Timur Iskhodzhanov ed11ae3d21 Follow-up to r206457 -- fix static adjustments for some subtle virtual inheritance cases
Reviewed at http://reviews.llvm.org/D3410

llvm-svn: 206504
2014-04-17 22:01:48 +00:00
Aaron Ballman e80bfcd048 Making some public members into private members. This also introduces a bit more const-correctness, and now uses some range-based for loops. No functional changes intended.
llvm-svn: 206503
2014-04-17 21:44:08 +00:00
Richard Smith 4b600d3f0b Fix comment.
llvm-svn: 206494
2014-04-17 20:39:09 +00:00
Richard Smith b45a6f72b6 Add missing serialization code for one of the CXXRecordDecl definition flags.
llvm-svn: 206493
2014-04-17 20:33:01 +00:00
Aaron Ballman 7a2fb5f436 Nitpicky refactoring -- use of nullptr and auto, made a bit more const-correct. No functional changes intended.
llvm-svn: 206491
2014-04-17 20:08:36 +00:00
John Thompson 4f52d44dce Revised per Dmitri's comments. My first exposure to range-based for loops, thanks!
llvm-svn: 206483
2014-04-17 18:17:36 +00:00
Nico Weber ffaf29a07b clang-format.py: Don't omit the first two words from error messages.
This reverts r172072.  clang-format used to use DiagnosticEngine to output
errors: http://llvm.org/viewvc/llvm-project?view=revision&revision=172071. Now
it doesn't, so this code is obsolete.

llvm-svn: 206479
2014-04-17 17:51:57 +00:00
Matt Arsenault 10e3ef8d2d Bug 18567: Fix constantexpr pointer casts with address spaces.
Getting a pointer into a struct at a non-zero offset would try to
use the default address space.

llvm-svn: 206478
2014-04-17 17:45:37 +00:00
John Thompson a39baf1ad0 Revised per Dmitri's comments. My first exposure to range-based for loops, thanks!
llvm-svn: 206474
2014-04-17 17:06:13 +00:00
Alexander Kornienko 67d9c8c87e Fix alignment of trailing block comments.
Summary:
This patch ensures that the lines of the block comments retain relative
column offsets. In order to do this WhitespaceManager::Changes representing
continuation of block comments keep a pointer on the change representing the
whitespace change before the block comment, and a relative column offset to this
change, so that the correct column can be reconstructed at the end of alignment
process.

Fixes http://llvm.org/PR19325

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

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

llvm-svn: 206472
2014-04-17 16:12:46 +00:00
Aaron Ballman ed5aced64e Since the object is new'ed in the enterCFG function, now deleting in the exitCFG function instead of the destructor to ensure proper pairing. This allows reuse of the builder without creating a memory leak.
llvm-svn: 206471
2014-04-17 15:23:50 +00:00
Keith Walker 8ff56f6080 Fix Profile:cxx-lambda.cpp test for targets that do not generate zeroext
Change an expected match to allow for the fact that some targets
may not generated the zeroext operation.

llvm-svn: 206467
2014-04-17 13:04:53 +00:00
James Molloy dc197ea30d [ARM64] Fix __clear_cache - ensure it is predefined.
llvm-svn: 206465
2014-04-17 12:51:42 +00:00
James Molloy 96061a6db1 [ARM64] Add ARM64 RUN lines to a bunch of tests that had AARCH64 RUN lines.
This covers all tests in tests/Driver and tests/Preprocessor, but there are some
failing tests in test/Sema that need looking into.

llvm-svn: 206464
2014-04-17 12:51:36 +00:00
James Molloy ec78aa46f2 [ARM64] Teach Targets.cpp about Cortex-A53 and Cortex-A57, and enable more tests.
llvm-svn: 206463
2014-04-17 12:51:28 +00:00
James Molloy 2b24fc41fc [ARM64] Plumb in big-endian - add arm64_be to the many switches where it was missing.
llvm-svn: 206462
2014-04-17 12:51:23 +00:00
James Molloy 9b1586b6cc [ARM64] Default to the 'generic' CPU, unless -arch is present for backwards compatibility.
llvm-svn: 206461
2014-04-17 12:51:17 +00:00
Aaron Ballman c11ba5dc9e Preventing future MSVC 2012 surprises with SimpleArray by giving it an explicit move assignment operator.
llvm-svn: 206460
2014-04-17 12:50:54 +00:00
Daniel Jasper ae8e0d8da9 clang-format: Respect BinPackParameters in Cpp11BracedListStyle.
With BinPackParameters=false and Cpp11BracedListStyle=true (i.e. mostly
for Chromium):

Before:
  const Aaaaaa aaaaa = {aaaaa, bbbbb,  ccccc,  ddddd,  eeeee, ffffff,
                        ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk};

After:
  const Aaaaaa aaaaa = {aaaaa,
                        bbbbb,
                        ccccc,
                        ddddd,
                        eeeee,
                        ffffff,
                        ggggg,
                        hhhhhh,
                        iiiiii,
                        jjjjjj,
                        kkkkkk};

This fixes llvm.org/PR19359. I am not sure we'll want this in all cases
in the long run, but I'll guess we'll get feedback on that.

llvm-svn: 206458
2014-04-17 11:32:02 +00:00
Timur Iskhodzhanov 057fa3a5a5 Fix PR19408 - Missing static this adjustment in a vtordisp thunk
Also fix a few other vtordisp-related bugs.

Reviewed at http://reviews.llvm.org/D3400

llvm-svn: 206457
2014-04-17 11:01:41 +00:00
Tim Northover 5ffc092700 ARM64: remove holes from *all* HFAs on the stack.
My first attempt to make sure HFAs were contiguous was in the block dealing
with padding registers, which meant it only triggered on the first stack-based
HFA. This should extend it to the rest as well.

Another part of PR19432.

llvm-svn: 206456
2014-04-17 10:20:38 +00:00
NAKAMURA Takumi de4077a5d3 SemaTemplate.cpp: Rework r206451. Removing an argument was really bad idea.
llvm-svn: 206452
2014-04-17 08:57:09 +00:00
NAKAMURA Takumi 518210e264 SemaTemplate.cpp: Appease msvc to get rid of default argument in lambda definition.
clang\lib\Sema\SemaTemplate.cpp(1826) : error C2064: term does not evaluate to a function taking 1 arguments

llvm-svn: 206451
2014-04-17 08:42:31 +00:00
Richard Smith 11a80dcb42 PR19340: If we see a declaration of a member of an unspecialized class template
that looks like it might be an explicit specialization, don't recover as an
explicit specialization (bypassing the check that would reject that).

llvm-svn: 206444
2014-04-17 03:52:20 +00:00
Ben Langmuir a56071c5fb When writing YAML in libclang, use yaml::escape instead of write_escaped
The YAMLParser has its own escaped string representation, and does not
handle octal escape sequences. When writing the virtual file system to a
YAML file, use yaml::escape().

llvm-svn: 206443
2014-04-17 03:31:02 +00:00
Richard Smith 4b55a9c841 Refactor all the checking for missing 'template<>'s when a declaration has a
template-id after its scope specifier into a single place.

llvm-svn: 206442
2014-04-17 03:29:33 +00:00
Richard Smith 0d963d6c49 Don't emit an ExtWarn on declarations of variable template specializations;
we'll already have issued the relevant diagnostic when we saw the declaration
of the primary template.

llvm-svn: 206441
2014-04-17 02:56:49 +00:00
Argyrios Kyrtzidis ec328b8e6f [Parser] Remove "add -fmodules" from the "use of '@import' when modules are disabled, add -fmodules" error.
We disable modules for C++, at which point this is confusing.
rdar://16641918

llvm-svn: 206440
2014-04-17 02:32:52 +00:00
Yunzhong Gao 06770f9381 Adding type info for f16c floating-point type. This is consistent with the
Itanium ABI in 2.9.2 Place of Emission.

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

llvm-svn: 206439
2014-04-17 02:26:26 +00:00
Richard Smith 100b24abc5 Implement [over.match.oper]p3 properly, by filtering the non-candidates out
when building the candidate set, rather than trying to contort name lookup into
handling this.

llvm-svn: 206436
2014-04-17 01:52:14 +00:00
Richard Smith 688866ba3e PR19452: Implement more of [over.match.oper]p3's restrictions on which non-member overloaded operators can be found when no operand is of class type. We used to fail to implement this rule if there was an operand of dependent type.
llvm-svn: 206435
2014-04-17 01:12:17 +00:00
Adrian Prantl 649f030819 Further simplify r206430.
rdar://problem/16636569.

llvm-svn: 206434
2014-04-17 01:04:01 +00:00
Ben Langmuir 47d1ca4838 Rename lib/Headers/module.map to module.modulemap
Don't install a file using the legacy spelling.

llvm-svn: 206431
2014-04-17 00:52:48 +00:00
Adrian Prantl 2c92e9cb53 Debug info: When collecting the parameters of C++ partial template
specializations collect all arguments and not just the ones from the
class template partial specialization from which this class template
specialization was instantiated. The debug info does not represent the
partial specialization otherwise and so specialized parameters would
go missing.

rdar://problem/16636569.

llvm-svn: 206430
2014-04-17 00:30:48 +00:00
Aaron Ballman fd987ecc73 Attempting to unbreak the MSVC 2012 build a second time.
llvm-svn: 206420
2014-04-16 21:32:23 +00:00
John Thompson bcdcc92e2f Added dump method for global module index.
llvm-svn: 206418
2014-04-16 21:03:41 +00:00
Joerg Sonnenberger 8280abe47f Handle -m32 for NetBSD/sparc64 correctly. Extend test case to also check
ARM, MIPS and i386 ABIs.

llvm-svn: 206416
2014-04-16 20:44:17 +00:00
Reid Kleckner 6f6e76dfe0 Revert "Move -fms-extensions predefined macros into InitPreprocessor"
This reverts commit r206413.

This was proposed before, but it's not clear if this is really a good
idea:
http://reviews.llvm.org/D3034

llvm-svn: 206415
2014-04-16 20:10:16 +00:00
Aaron Ballman 157779ed59 Attempting to unbreak the MSVC 2012 build.
llvm-svn: 206414
2014-04-16 19:59:42 +00:00
Reid Kleckner ae4759df00 Move -fms-extensions predefined macros into InitPreprocessor
If someone on Linux asks for -fms-extensions, there's no reason not to
define the feature test macros that MSVC defines.

llvm-svn: 206413
2014-04-16 19:47:06 +00:00
Diego Novillo 17b2a1b4b0 Fix check failure on hexagon targets.
This test was failing because there is no assembler for hexagon-elf on
this buildbot:

http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/10470

Fixed by adding -S to the driver invocation.

llvm-svn: 206412
2014-04-16 19:02:35 +00:00
Argyrios Kyrtzidis c747960855 Fix indentation, NFC.
llvm-svn: 206411
2014-04-16 18:45:32 +00:00
Argyrios Kyrtzidis de10366c06 [objc] -[NSObject init] is documented to not do anything, don't warn if subclasses do not call [super init] on their initializers.
Part of rdar://16568441

llvm-svn: 206410
2014-04-16 18:32:51 +00:00
Argyrios Kyrtzidis 441f626bd9 [objc] Consider new initializers inside @implementation when determining if the class
introduces new initializers.

Part of rdar://16568441

llvm-svn: 206409
2014-04-16 18:32:42 +00:00
Aaron Ballman af771c7b2a More minor refactoring. Updated for const-correctness, moved another deleted function to be private, 0 -> nullptr and some style corrections. No functional changes intended.
llvm-svn: 206406
2014-04-16 17:44:02 +00:00
Aaron Ballman 0e297988ec Minor cleanups for deleted functions to ensure they're a bit more robustly "deleted".
llvm-svn: 206404
2014-04-16 17:20:26 +00:00
Fariborz Jahanian db3a5dcc60 Objective-C rewriter. Use _WIN64 instead of __LLP64__
to conditinalize on 64bit length in a generated meta-data.
// rdar://16489050

llvm-svn: 206402
2014-04-16 17:03:06 +00:00
Diego Novillo 829b170048 Add support for optimization reports.
Summary:
This patch adds a new flag -Rpass=. The flag indicates the name
of the optimization pass that should emit remarks stating when it
made a transformation to the code.

This implements the design I proposed in:

https://docs.google.com/document/d/1FYUatSjZZO-zmFBxjOiuOzAy9mhHA8hqdvklZv68WuQ/edit?usp=sharing

Other changes:
- Add DiagnosticIDs::isRemark(). Use it in printDiagnosticOptions to
  print "-R" instead of "-W" in the diagnostic message.

- In BackendConsumer::OptimizationRemarkHandler, get a SourceLocation
  object out of the file name, line and column number. Use that location
  in the call to Diags.Report().

- When -Rpass is used without debug info a note is emitted alerting
  the user that they need to use -gline-tables-only -gcolumn-info to
  get this information.

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3226

llvm-svn: 206401
2014-04-16 16:54:24 +00:00
Duncan P. N. Exon Smith 4bc7731a29 InstrProf: Calculate a better function hash
The function hash should change when control flow changes.  This patch
hashes the type of each AST node that affects counters, rather than just
counting how many there are.  These types are combined into a small
enumerator that currently has 16 values.

The new hash algorithm packs the enums for consecutively visited types
into a `uint64_t`.  In order to save space for new types, the types are
assumed to be 6-bit values (instead of 4-bit).  In order to minimize
overhead for functions with little control flow, the `uint64_t` is used
directly as a hash if it never fills up; if it does, it's passed through
an MD5 context.

<rdar://problem/16435801>

llvm-svn: 206397
2014-04-16 16:03:27 +00:00
James Molloy afc352ce64 [ARM64] Plumb in the -mfpu= flag.
llvm-svn: 206395
2014-04-16 15:33:56 +00:00
James Molloy 75f5f9e629 [ARM64] Allow the disabling of NEON and crypto instructions. Update tests to pass -target-feature +neon.
llvm-svn: 206394
2014-04-16 15:33:48 +00:00
James Molloy 5e73df5cf0 [ARM64] Fix up predefines, including adding big endian support to Targets.cpp
llvm-svn: 206390
2014-04-16 15:06:20 +00:00
Aaron Ballman ed1547040c Minor formatting cleanups -- no functional changes intended.
llvm-svn: 206386
2014-04-16 13:16:19 +00:00
Daniel Jasper 0e61784ae5 clang-format: Add special case to reduce indentaiton in streams.
This is similar to how we treat assignments and seems to be generally
desirable.

Before:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                      aaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                      aaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 206384
2014-04-16 12:26:54 +00:00
Aaron Ballman 49b568ead8 Adding a move constructor (due to CopyOnWriteVector requiring move-only semantics) to appease MSVC.
llvm-svn: 206374
2014-04-16 11:09:33 +00:00
Chandler Carruth 26eaef72d0 Hopefully avoid a warning on some GCCs (but not all strangely,
preventing me from seeing it initially). GCC doesn't use the unused
attribute on members for anything, so while it works to suppress Clang's
warning for an unused private member, it adds a GCC warning for the
attribute. =/ Silence Clang's warning with a void cast in the
constructor instead which doesn't trigger any complaints from GCC.

llvm-svn: 206373
2014-04-16 11:04:33 +00:00
Richard Sandiford 28940af2bf Sema: Factor out argument range checks for builtin functions
No behavioural change intended.

llvm-svn: 206364
2014-04-16 08:47:51 +00:00
Evgeniy Stepanov a8931a4f8c Re-enable several builtins in non-gnu modes.
This is a partial revert of 183015.
By not recognizing things like _setjmp we lose (returns_twice) attribute on
them, which leads to incorrect code generation.
Fixes PR16138.

llvm-svn: 206362
2014-04-16 08:06:33 +00:00
Ted Kremenek 6f375e5604 -Wunreachable-code: refine recognition of unreachable "sigil" to cope with implicit casts in C++.
Fixes <rdar://problem/16631033>.

llvm-svn: 206360
2014-04-16 07:26:09 +00:00
Justin Bogner 4e3a01fa5f Lex: Fix __has_feature(cxx_exceptions) for objective C++
At one point, -fexceptions was a synonym for -fcxx-exceptions. While
the driver options still enables cxx-exceptions by default, the cc1
flag is purely about exception tables and this doesn't account for
objective C exceptions. Because of this, checking for the
cxx_exceptions feature in objective C++ often gives the wrong answer.

The cxx_exceptions feature should be based on the -fcxx-exceptions cc1
flag, not -fexceptions. Furthermore, at some point the tests were
changed to use cc1 even though they were testing the driver behaviour.
We're better off testing both the driver and cc1 here.

llvm-svn: 206352
2014-04-16 02:56:48 +00:00
NAKAMURA Takumi e9c88759a2 threadSafety::SExprBuilder::BlockInfo: Non-static member initializer is unavailable. Use default constructor instead.
llvm-svn: 206347
2014-04-16 01:22:22 +00:00
NAKAMURA Takumi ac5e64fbbe Reformat.
llvm-svn: 206346
2014-04-16 01:22:07 +00:00
NAKAMURA Takumi a14deb4a8b threadSafety::CopyOnWriteVector: Use LLVM_DELETED_FUNCTION here due to missing functionality of msc17.
llvm-svn: 206345
2014-04-16 01:21:53 +00:00
John Thompson 28331ae67e Fixed problem with exclude header. The exclude header argument needs to be relative to the module.map file.
llvm-svn: 206342
2014-04-16 00:07:06 +00:00
Duncan P. N. Exon Smith 2f75076de1 Fix build after r206338
llvm-svn: 206341
2014-04-15 23:58:06 +00:00
Richard Trieu beffb833dc Make -Wabsolute-value C++-aware.
Warn on std::abs() with unsigned argument.
Suggest std::abs as replacement for the C absolute value functions.
Suggest C++ headers if the specific std::abs overload is not found.

llvm-svn: 206340
2014-04-15 23:47:53 +00:00
NAKAMURA Takumi 2205952150 Format.cpp: Don't use initializer list.
llvm-svn: 206339
2014-04-15 23:29:04 +00:00
DeLesley Hutchins aab9aff058 Thread Safety Analysis: rewrite SSA pass to use the new SExpr and CFG
traversal system.  The new pass is still undergoing testing; no change in
functionality.

llvm-svn: 206338
2014-04-15 23:23:19 +00:00
Chandler Carruth 47c480875b [Allocator] Make the ContentCache object actually carry the 8-byte
alignment constraint rather than using the allocator function's over
alignment "feature". This was the only use of the "feature" which I plan
to remove next. =] Attaching the alignment to the type seems cleaner and
more principled anyways.

llvm-svn: 206324
2014-04-15 21:34:12 +00:00
Justin Bogner e2ef2a09ef CodeGen: Emit warnings for out of date profile data during PGO
This adds a warning that triggers when profile data doesn't match for
the source that's being compiled with -fprofile-instr-use=. This fires
only once per translation unit, as warning on every mismatched
function would be quite noisy.

llvm-svn: 206322
2014-04-15 21:22:35 +00:00
Justin Bogner 3f0c79ce8d CodeGen: Remove a comment that isn't in the right place
This comment also appears elsewhere where it actually makes sense, and
it's just confusing here.

llvm-svn: 206321
2014-04-15 20:37:41 +00:00
Richard Smith 93da092f10 Move comment back to being next to the thing it's describing.
llvm-svn: 206320
2014-04-15 20:27:15 +00:00
Justin Bogner 399093276c AST: Respect alignment attributes on typedef'd arrays
When instantiating an array that has an alignment attribute on it, we
were looking through the array type and only considering the element
type for the resulting alignment. We need to make sure we take the
array's requirements into account too.

llvm-svn: 206317
2014-04-15 20:12:41 +00:00
Quentin Colombet 9d8105130a [ARM64] Update tests to reflect the change of the default CPU in llvm.
llvm-svn: 206314
2014-04-15 19:09:58 +00:00
Ben Langmuir 8832c066a2 Honour -ivfsoverlay in ASTUnit to match clang
This allows code indexing, etc. to use the VFS in the same way as the
compiler.

llvm-svn: 206309
2014-04-15 18:16:25 +00:00
Eli Bendersky e1627b43f9 Replace push_back()s by initializer list for shorter and cleaner code.
llvm-svn: 206304
2014-04-15 17:19:26 +00:00
Eli Bendersky 8578c8f1e3 Add test case for r206302
llvm-svn: 206303
2014-04-15 16:57:53 +00:00
Eli Bendersky e06a2c4f90 Add support for CUDA __launch_bounds__ attribute to CodeGen.
Sema does have a CUDALaunchBoundsAttr, but CodeGen was doing nothing with it.
This change translates CUDALaunchBoundsAttr to maxntidx and minctasm
metadata, which NVPTX then translates to the correct PTX directives.

Patch by Manjunath Kudlur.

llvm-svn: 206302
2014-04-15 16:57:05 +00:00
Duncan P. N. Exon Smith 52eaffee03 verify-di: Call debug info verifier from clang
This is paired with a patch to LLVM that creates a separate pass for
verifying debug info.

<rdar://problem/15500563>

llvm-svn: 206301
2014-04-15 16:27:43 +00:00
Alp Toker 48c7e17a24 Fix a comment to match the implementation
llvm-svn: 206298
2014-04-15 16:24:50 +00:00
Tim Northover c801b4a2aa ARM64: track alignment padding registers on AAPCS targets
This implements clause C.8 of the AAPCS in the front-end, so that Clang
accurately knows when the registers run out and it has to insert padding before
the stack objects begin.

PR19432.

llvm-svn: 206296
2014-04-15 14:55:11 +00:00
Alexander Kornienko 64a42b8dd2 Fix assertion when breaking string literals with tab characters.
Summary: Fixes http://llvm.org/PR19368

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, klimek

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

llvm-svn: 206295
2014-04-15 14:52:43 +00:00
NAKAMURA Takumi eec6fa541c Mark clang/test/Index/pch-with-errors.c as XFAIL:mingw for now. Investigating.
This has been failing since r206202.

llvm-svn: 206294
2014-04-15 14:44:55 +00:00
Fraser Cormack 01648e0463 Allow address space qualifiers on OpenCL array parameters
llvm-svn: 206275
2014-04-15 11:38:29 +00:00
Nikola Smiljanic 1b4b6bac3b PR19178 __is_constructible returns true for abstract types.
llvm-svn: 206273
2014-04-15 11:30:15 +00:00
Daniel Jasper 783bac6bba clang-format: Understand proto text format without commas.
Also removed spaces before colons as they don't seem to be used
frequently.

Before:
optional int32 b = 2
    [(foo_options) = {aaaaaaaaaaaaaaaaaaa : 123 bbbbbbbbbbbbbbbbbbbbbbbb :
                          "baz"}];

After:
optional int32 b = 2 [(foo_options) = {aaaaaaaaaaaaaaaaaaa: 123,
                                       bbbbbbbbbbbbbbbbbbbbbbbb:"baz"}];

llvm-svn: 206269
2014-04-15 09:54:30 +00:00
Daniel Jasper 9d3adc06c6 x
llvm-svn: 206268
2014-04-15 09:54:24 +00:00
Fraser Cormack 111023cdc6 Test commit: minor formatting
llvm-svn: 206264
2014-04-15 08:59:09 +00:00
Daniel Jasper 20fd3c6ff7 clang-format: Basic support for C++1y.
Before:
  int bi{1 '000' 000};
After:
  int bi{1'000'000};

This fixes llvm.org/PR19342.

llvm-svn: 206263
2014-04-15 08:49:21 +00:00
Daniel Jasper 98583d522f clang-format: Early cut-off for inlining nested blocks.
Specifically, for a nested block or lambda, don't try to put the single
statement body inline, if it exceeds the column limit.

This should not change any observable behavior (as those would never
have led to the 'best' solution), but significantly speeds up formatting
time.

This fixes llvm.org/PR18761. Formatting time goes down from ~100s to a
few ms.

llvm-svn: 206260
2014-04-15 08:28:06 +00:00
Daniel Jasper c359ad00a6 clang-format: Cache results of formatting nested blocks.
This somewhat improves the performance problem reported in
llvm.org/PR18761. No other behavior changes intended.

llvm-svn: 206258
2014-04-15 08:13:47 +00:00
David Majnemer 2e159fb6db AST: Elaborated type specifier mangling occurs before nested-name
The Ts/Tu/Te manglings should occur before the nested-name's N.

llvm-svn: 206247
2014-04-15 05:51:25 +00:00
Aaron Ballman 9e3d7bd20b Partial revert of r206229, to get the build bots green again.
llvm-svn: 206237
2014-04-15 01:19:35 +00:00
Richard Trieu e729d9b598 Fix typo from r206232
llvm-svn: 206234
2014-04-15 01:06:38 +00:00
Richard Trieu e9fa266cba Fix a bad interaction between -Wtautological-overlap-compare and delayed
diagnostics which caused delayed diagnostics on dead paths to be emitted.

llvm-svn: 206232
2014-04-15 00:57:50 +00:00
Justin Bogner 81ab90f7ed CodeGen: Handle CapturedStmt in instrumentation based profiling
CapturedStmt was being ignored by instrumentation based profiling, and
its counters attributed to the containing function. Instead, we need
to treat this as a top level entity, like we do with blocks.

llvm-svn: 206231
2014-04-15 00:50:54 +00:00
Aaron Ballman ef5d94caf0 Fixing a typo, updating the diagnostic wording and logic based on post-commit review feedback. Amends r206186.
llvm-svn: 206229
2014-04-15 00:36:39 +00:00
Quentin Colombet d9f262098f [Driver][ARM64] Make sure the default CPU is passed to the assembler.
<rdar://problem/16573920>

llvm-svn: 206227
2014-04-15 00:27:35 +00:00
Reid Kleckner f80abc060c Fix warning in ms-x86-vtordisp test case
llvm-svn: 206224
2014-04-14 23:49:17 +00:00
Richard Smith a1a808c541 Ensure we evaluate VLA bounds if a variably-modified type is used as the
argument to __builtin_va_arg. Patch by Rahul Jain, some test massaging and
IR emission order changes by me.

llvm-svn: 206223
2014-04-14 23:47:48 +00:00
Nick Lewycky 646621e6a8 Make sure these two files are distinct, or else the modules system may, on certain file systems, treat them as if they were the same file.
llvm-svn: 206221
2014-04-14 22:30:21 +00:00
Ben Langmuir 4f5212a60e Add module name and module map file to -module-file-info
llvm-svn: 206217
2014-04-14 22:12:44 +00:00
Richard Smith 82dce550c8 PR19415: Converting 'constexpr' to 'const' in a non-static data member can fail
if the member is already 'const'. Don't assert in that case.

llvm-svn: 206205
2014-04-14 21:00:40 +00:00
Richard Smith ac9c9a006f PR19411: Walk lexical parents, not semantic parents, when determining whether a
DeclContext is (lexically) within a C language linkage specification.

llvm-svn: 206204
2014-04-14 20:23:58 +00:00
Ben Langmuir 6e63f50b2a Fix find command in test/Modules/prune.m broken by r206201
llvm-svn: 206203
2014-04-14 18:50:28 +00:00
Ben Langmuir ebcc8c43bd Add clang:: qualifier back to Module
Apparently this was required by some compilers.

llvm-svn: 206202
2014-04-14 18:21:04 +00:00
Ben Langmuir beee15e721 Allow multiple modules with the same name to coexist in the module cache
To differentiate between two modules with the same name, we will
consider the path the module map file that they are defined by* part of
the ‘key’ for looking up the precompiled module (pcm file).
Specifically, this patch renames the precompiled module (pcm) files from
  cache-path/<module hash>/Foo.pcm
to
  cache-path/<module hash>/Foo-<hash of module map path>.pcm

In addition, I’ve taught the ASTReader to re-resolve the names of
imported modules during module loading so that if the header search
context changes between when a module was originally built and when it
is loaded we can rebuild it if necessary.  For example, if module A
imports module B

first time:
clang -I /path/to/A -I /path/to/B ...

second time:
clang -I /path/to/A -I /different/path/to/B ...

will now rebuild A as expected.

* in the case of inferred modules, we use the module map file that
allowed the inference, not the __inferred_module.map file, since the
inferred file path is the same for every inferred module.

llvm-svn: 206201
2014-04-14 18:00:01 +00:00
Aaron Ballman 95d570335c Properly diagnose Microsoft __declspec attributes which have optional argument lists when the arguments are elided. eg)
__declspec(deprecated()) // error
__declspec(deprecated) // OK
__declspec(deprecated("")) // OK

llvm-svn: 206191
2014-04-14 16:44:26 +00:00
Justin Bogner da4e650e5c OnDiskHashTable: Make the iterable version separate.
Currently the on disk hash table's key_iterator and data_iterator make
the assumption that the table data starts exactly four bytes after the
base of the table. This happens to be true for all of the tables we
currently iterate over, but not for all of the OnDiskHashTables we
currently use. For example, key_ and data_iterator would iterate over
meaningless data if they were used on the hash tables in PTHLexer.

We make the API safer by breaking this into two types. One doesn't
have the iterators, and the other must be told where the payload
starts.

llvm-svn: 206189
2014-04-14 16:34:29 +00:00
Justin Bogner 8c1f0818c0 OnDiskHashTable: clang-format and consistent naming
No functional change. Style cleanups in OnDiskChainedHashTable in
preparation for some other changes here.

llvm-svn: 206188
2014-04-14 16:34:19 +00:00
Aaron Ballman 35f9421c55 Properly diagnose standard C++ attributes which have optional argument lists when the arguments are elided. eg)
[[deprecated()]] // error
[[deprecated]] // OK
[[deprecated("")]] // OK
[[gnu::deprecated()]] // OK

llvm-svn: 206186
2014-04-14 16:03:22 +00:00
Samuel Benzaquen f434c4fa3f Add support for named values in the parser.
Summary: Add support for named values in the parser.

Reviewers: pcc

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D3276

llvm-svn: 206176
2014-04-14 13:51:21 +00:00
Daniel Jasper 866468ae4d clang-format: Fix regression caused by r206165.
llvm-svn: 206173
2014-04-14 13:15:29 +00:00
Daniel Jasper 72ab43b28b clang-format: Fix incorrect &&-detection in macros.
Before:
  #define A(a, b) (a &&b)

After:
  #define A(a, b) (a && b)

This fixes llvm.org/PR19343.

llvm-svn: 206165
2014-04-14 12:50:02 +00:00
Daniel Jasper db8804b32b clang-format: Improve array literal formatting fix in r206161.
Instead of choosing based on the number of elements, simply respect the
user's choice of where to wrap array literals.

llvm-svn: 206162
2014-04-14 12:11:07 +00:00
Daniel Jasper af4fee2636 clang-format: With ColumnLimit=0, keep short array literals on a line.
Before:
    NSArray* a = [[NSArray alloc] initWithArray:@[
                                                   @"a"
                                                ]
                                      copyItems:YES];

After:
    NSArray* a = [[NSArray alloc] initWithArray:@[ @"a" ]
                                      copyItems:YES];

This fixed llvm.org/PR19080.

llvm-svn: 206161
2014-04-14 12:05:05 +00:00
Daniel Jasper c0d606a584 clang-format: Don't allow hanging indentation for operators on new lines
Before:
  if (aaaaaaaa && bbbbbbbbbbbbbbb // need to wrap
                  == cccccccccccccc) ...

After:
  if (aaaaaaaa
      && bbbbbbbbbbbbbbb // need to wrap
         == cccccccccccccc) ...

The same rule has already be implemented for BreakBeforeBinaryOperators
set to false in r205527.

llvm-svn: 206159
2014-04-14 11:08:45 +00:00
Manuel Klimek 68b03049e0 Format code around VCS conflict markers.
Now correctly formats:
  {
    int a;
    void f() {
      callme(some(parameter1,
  <<<<<<< text by the vcs
                  parameter2),
  ||||||| text by the vcs
                  parameter2),
             parameter3,
  ======= text by the vcs
                  parameter2, parameter3),
  >>>>>>> text by the vcs
             otherparameter);
    }
  }

llvm-svn: 206157
2014-04-14 09:14:11 +00:00
Daniel Jasper 35ec2b244a clang-format: Improve formatting of annotated variables.
Before:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(
      aaaaaaaaaaaa) = aaaaaaaa::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(aaaaaaaaaaaa) =
      aaaaaaaa::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 206155
2014-04-14 08:15:20 +00:00
Serge Pavlov 6a7ffbed8a Improve error recovery around colon.
Parse of nested name spacifier is modified so that it properly recovers
if colon is mistyped as double colon in case statement.
This patch fixes PR15133.

Differential Revision: http://llvm-reviews.chandlerc.com/D2870

llvm-svn: 206135
2014-04-13 16:52:03 +00:00
Logan Chien af24ad940d Fix diagnostics for C-style cast to function type.
If the C-style type cast is applied to the overloaded
function and the destination type is function type,
then Clang will crash with assertion failure.  For example,

    void foo(int);
    void foo(int, int);
    void bar() {
        typedef void (ft)(int);
        ft p = (ft)foo;
    }

In this case, the overloaded function foo will be cast to
a function type, which should be considered as an error.
But, unfortunately, since the function resolution is using
canonical type, the matched function will be returned, and
result in SEGV.

This patch fixes this issue by removing the assertion and
add some error diagnostics as the one in static_cast.

llvm-svn: 206133
2014-04-13 16:08:24 +00:00
David Majnemer adc45bb77b MS ABI: Bitfields FielDecls only align if they allocate
Don't consider a __declspec(align) on a bitfield's declaration if it didn't
allocate any underlying storage.

This fixes PR19414.

llvm-svn: 206132
2014-04-13 08:15:50 +00:00
Richard Smith 9e2f0a4f62 PR19339: Disambiguate lambdas with init-captures from designated initializers
properly.

llvm-svn: 206128
2014-04-13 04:31:48 +00:00
David Majnemer 81c55b6255 [-fms-extensions] Add tests for __FUNCDNAME__
__FUNCDNAME__ was introduced way back in r194181 but I forgot to add
these tests.

llvm-svn: 206125
2014-04-13 02:29:55 +00:00
David Majnemer d43388cc04 MS ABI: #pragma vtordisp(0) only disables new vtordisps
Previously, it was believed that #pragma vtordisp(0) would prohibit the
generation of any and all vtordisps.

In actuality, it only disables the generation of additional vtordisps.

This fixes PR19413.

llvm-svn: 206124
2014-04-13 02:27:32 +00:00
Richard Smith c7f9bb1757 Tests for DR501-525.
llvm-svn: 206123
2014-04-13 00:40:32 +00:00
Benjamin Kramer 5c323b833b Replace llvm::array_endof with C++11's std::end.
No functionality change.

llvm-svn: 206111
2014-04-12 15:42:48 +00:00
Hal Finkel 834da75d44 Fix test/Modules/cxx-irgen.cpp for PPC64
Target ABI code might add signext to the return types.

llvm-svn: 206107
2014-04-12 11:50:34 +00:00
Yunzhong Gao a8c45c9f88 Add description about the __is_identifier() macro
llvm-svn: 206099
2014-04-12 02:25:32 +00:00
Justin Bogner b1966291de CodeGen: Test instrumentation based profiling of templates
Make sure that templates are handled correctly by profile
instrumentation.

llvm-svn: 206091
2014-04-12 00:54:06 +00:00
Warren Hunt 4f7efb7a8f [MS-ABI] Fix warning introduced in r206087
No functional change.

llvm-svn: 206090
2014-04-12 00:20:50 +00:00
Adrian Prantl 0ce2b87507 Follow-up to r205999: Emit an artificial location (valid scope, line 0)
for CXXGlobalInit/Dtor helper functions.
This makes _GLOBAL__I_a regain its DW_AT_high/low_pc in the debug info.

Thanks to echristo for catching this!

llvm-svn: 206088
2014-04-11 23:45:01 +00:00
Warren Hunt 0e70d916f2 [MS-ABI] Fixed alias-avoidance padding in the presence of vtordisps
If a vtordisp exists between two bases, then there is no need for 
additional alias avoidance padding.  Test case included.

llvm-svn: 206087
2014-04-11 23:33:35 +00:00
Justin Bogner 191ec63b71 CodeGen: Fix handling of C++11 lambdas in profiling
Until now we were generating duplicate counters for lambdas: one set
in the function where the lambda was declared and another for the
lambda itself. Instead, we should skip over the bodies of lambdas in
their containing contexts.

llvm-svn: 206081
2014-04-11 23:06:35 +00:00
Warren Hunt 73f4398782 [MS-ABI] Update to vtordisp computation
A portion of the vtordisp computation that was previously unguarded by a 
test for the declaration of user defined constructors/destructors was 
erroniously adding vtordisps to things that shouldn't have them.  This 
patch correctly guards that codepath.  In addition, it updates the 
comments to make them more clear.  Test case is included.

llvm-svn: 206077
2014-04-11 22:05:28 +00:00
Yunzhong Gao ef309f4326 Add a test to distinguish between reserved tokens and normal identifiers.
The -fms-extensions option affects a number of subtle front-end C/C++
behaviors, and it would be useful to be able to distinguish MS keywords
from regular identifiers in the ms-extensions mode even if the triple
does not define a Windows target. It should make life easier if anyone
needs to port their Windows codes to elsewhere.

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

llvm-svn: 206069
2014-04-11 20:55:19 +00:00
Bob Wilson d893142595 [PGO] Change MapRegionCounters to be a RecursiveASTVisitor.
This avoids the overhead of specifying all the traversal code when using
ConstStmtVisitor and makes it a lot easier to maintain this.

llvm-svn: 206039
2014-04-11 17:16:13 +00:00
Reid Kleckner cd612aba55 Simplify RecordLayoutBuilder with getAsCXXRecordDecl()
No functionality change.

llvm-svn: 206038
2014-04-11 16:57:42 +00:00
Manuel Klimek 1fcbe675fa Correctly handle escaped newlines when the next token starts without a space.
We will need this to correctly handle conflict markers inside macro
definitions.

llvm-svn: 206029
2014-04-11 12:27:47 +00:00
Daniel Jasper 962b38e4f3 Add -fmodules-strict-decluse to check that all headers are in modules
Review: http://reviews.llvm.org/D3335
llvm-svn: 206027
2014-04-11 11:47:45 +00:00
Justin Bogner 53c55d993f CodeGen: Handle binary conditional operators in PGO instrumentation
This treats binary conditional operators in the same way as ternary
conditional operators for instrumentation based profiling.

llvm-svn: 206021
2014-04-11 06:10:10 +00:00
Adrian Prantl 22e66b434a Cleanup: Add default arguments to CodeGenFunction::StartFunction.
Thanks dblaikie for the suggestion!

llvm-svn: 206012
2014-04-11 01:13:04 +00:00
Richard Smith 83e78f5c3c Fix handling of redeclaration lookup for using declarations, where the prior
declaration is not visible. Previously we didn't find hidden friend names in
this redeclaration lookup, because we forgot to treat it as a redeclaration
lookup. Conversely, we did find some local extern names, but those don't
actually conflict with a namespace-scope using declaration, because the only
conflicts we can get are scope conflicts, not conflicts due to the entities
being members of the same namespace.

llvm-svn: 206011
2014-04-11 01:03:38 +00:00
Warren Hunt 917f97f1a3 [MS-ABI] Update Comments in RecordLayoutBuilder - no functional change
This patch updates the comments in RecordLayoutBuilder about record 
layout in the MS-ABI.  Also, I added a section about known 
incompatibilities.

llvm-svn: 206010
2014-04-11 00:54:15 +00:00
Duncan P. N. Exon Smith 3fefedb24c Switch from constexpr to const char *const
Responding to Richard Smith's review of r205037.

llvm-svn: 206008
2014-04-11 00:43:16 +00:00
Warren Hunt 29a2b955fb [MS-ABI] Update virtual base padding rules to match MSVC 10+
In version 9 (VS2010) (and prior)? versions of msvc, if the last field 
in a record was a bitfield padding equal to the size of the storage 
class of that bitfield was added before each vbase and vtordisp.  This 
patch removes that feature from clang and updates the lit tests to 
reflect it. 

llvm-svn: 206004
2014-04-11 00:14:09 +00:00
Duncan P. N. Exon Smith 4a2f5ae8d5 InstrProf: Rename Decl parameters from S to D
No functionality change.

<rdar://problem/16435801>

llvm-svn: 206002
2014-04-10 23:37:36 +00:00
Duncan P. N. Exon Smith e9624291b1 InstrProf: Read unsigned numbers with strtoul and strtoull
Fixes a bug where unsigned numbers are read using strtol and strtoll.

I don't have a testcase because this bug is effectively unobservable
right now.  To expose the problem in the hash, we would need a function
with greater than INT64_MAX counters, which we don't handle anyway.  To
expose the problem in the function count, we'd need a function with
greater than INT32_MAX counters; this is theoretically observable, but
it isn't a practical testcase to check in.

An upcoming commit changes the hash to be non-trivial, so we'll get some
coverage eventually.

<rdar://problem/16435801>

llvm-svn: 206001
2014-04-10 23:37:34 +00:00
Warren Hunt bb9c3c33e9 [MS-ABI] Fix to vbptr injection site calculation.
The vbptr is injected after the last non-virtual base lexographically 
rather than the last non-virtual base in layout order.  Test case 
included.  Also, some line ending fixes.

llvm-svn: 206000
2014-04-10 23:23:34 +00:00
Adrian Prantl 42d71b9906 Debug info: (Bugfix) Make sure artificial functions like _GLOBAL__I_a
are not associated with any source lines.

Previously, if the Location of a Decl was empty, EmitFunctionStart would
just keep using CurLoc, which would sometimes be correct (e.g., thunks)
but in other cases would just point to a hilariously random location.

This patch fixes this by completely eliminating all uses of CurLoc from
EmitFunctionStart and rather have clients explicitly pass in a
SourceLocation for the function header and the function body.

rdar://problem/14985269

llvm-svn: 205999
2014-04-10 23:21:53 +00:00
Reid Kleckner fb873af67e Update Clang for LLVM split stack API changes in r205997
Patch by Alex Crichton!

llvm-svn: 205998
2014-04-10 22:59:13 +00:00
Warren Hunt 5d9eebfec6 [MS-ABI] Fixed __declspec(align()) on bitfields under #pragma pack.
When __declspec(align()) is applied to a bitfield it affects the 
alignment rather than the required alignment of the struct.  The major 
feature that this patch adds is that the alignment of the structure 
obeys the alignment of __declspec(align()) from the bitfield over the 
value specified in pragma pack.

Test cases are included.
The patch also includes some small cleanups in recordlayoutbuilder and 
some cleanups to some lit tests, including line endings (but no 
functionality change to lit tests)

llvm-svn: 205994
2014-04-10 22:15:18 +00:00
Reid Kleckner d378a71b4e inalloca: Pad the struct *after* inserting each arg
This ensures that the overall struct size will be a multiple of 4, as
required by the ABI.

llvm-svn: 205981
2014-04-10 19:09:43 +00:00
Justin Bogner f2ea775ed9 CodeGen: Move PGO initialization into Release()
Emitting the PGO initialization in EmitGlobalFunctionDefinition is
inefficient, since this only has an effect once per module.  We move
this to Release() with the rest of the once-per-module logic.

llvm-svn: 205977
2014-04-10 18:13:13 +00:00
Aaron Ballman 582e4f74da Some minor improvements to the thread safety intermediate language -- mostly const correctness and reformatting. Fixes the types involved with castOpcode().
llvm-svn: 205976
2014-04-10 18:12:58 +00:00
Ben Langmuir 2c9af44c26 When module umbrellas change, rebuild them
With the VFS, it is easy to hit modified umbrellas by overriding the
umbrella header, and what we want is to rebuild, not to fail.

llvm-svn: 205975
2014-04-10 17:57:43 +00:00
David Majnemer 9832a3d1e0 CodeGen: Clean up CommonLinkage calculation
No functionality change.

llvm-svn: 205972
2014-04-10 16:53:16 +00:00
Christian Pirker ba289f0c64 ARM: Add command line option to select big or little endian
llvm-svn: 205967
2014-04-10 13:59:32 +00:00
Christian Pirker 02c2e25d74 AArch64: Add command line option to select big or little endian
llvm-svn: 205966
2014-04-10 13:55:51 +00:00
Richard Sandiford d03f7b7bd3 [SystemZ] Don't indent SystemZTargetInfo relative to its namespace
Whitespace only.  No functional change intended.

llvm-svn: 205960
2014-04-10 09:56:24 +00:00
Daniel Jasper 220c0d1f5e clang-format: Fix false positive in braced list detection in protos.
llvm-svn: 205954
2014-04-10 07:27:12 +00:00
Eric Christopher cab9fae403 Add global static variables for anonymous union fields. This makes
sure that a debugger can find them when stepping through code,
for example from the included testcase:

   12     int test_it() {
   13       c = 1;
   14       d = 2;
-> 15       a = 4;
   16       return (c == 1);
   17     }
   18
(lldb) p a
(int) $0 = 2
(lldb) p c
(int) $1 = 2
(lldb) p d
(int) $2 = 2

and a, c, d are all part of the file static anonymous union:

static union {
  int c;
  int d;
  union {
    int a;
  };
  struct {
    int b;
  };
};

Fixes PR19221.

llvm-svn: 205952
2014-04-10 05:20:00 +00:00
Reid Kleckner 9df1d975b8 Avoid crashing when failing to emit a thunk
If we crash, we raise a crash handler dialog, and that's really
annoying.  Even though we can't emit correct IR until we have musttail,
don't crash.

llvm-svn: 205948
2014-04-10 01:40:15 +00:00
Reid Kleckner eb2ecff166 Fix the build with LLVM_DELETED_FUNCTION instead of '= delete'
MSVC 2012 doesn't understand '= delete', but 2013 does.

llvm-svn: 205946
2014-04-10 01:05:01 +00:00
David Majnemer 61182a89e8 Remove Unicode introduced in r205943
llvm-svn: 205945
2014-04-10 00:59:44 +00:00
David Majnemer 64e40c56fb AST: Implement proposal for dependent elaborated type specifiers
cxx-abi-dev came up with a way to disambiguate between different
keywords used in elaborated type specifiers.

This resolves certain collisions during mangling.

llvm-svn: 205943
2014-04-10 00:49:24 +00:00
Ben Langmuir 4469138e98 Move search for header in umbrella directories into its own function
No functional change intended.

llvm-svn: 205942
2014-04-10 00:39:10 +00:00
DeLesley Hutchins 7e615c2f65 Thread Safety Analysis: reorganized SExpr header files. No change in
functionality.

llvm-svn: 205936
2014-04-09 22:39:43 +00:00
Reid Kleckner b49fee0b41 Thread safety: move the inline function back into a namespace
Moving it into a struct makes things work because it implicitly marks
the function as inline.  The struct is unnecessary if you explicitly
mark the function inline.

llvm-svn: 205935
2014-04-09 22:17:06 +00:00
Warren Hunt 39a907b1c2 [MS-ABI] Update to alias-avoidance padding
This patch changes how we determine if padding is needed between two 
bases in msvc compatibility mode.  Test cases included.

In addition, a very minor change to the printing of structures to ease 
lit testing.

llvm-svn: 205933
2014-04-09 21:57:24 +00:00
Aaron Ballman 8dbbbcd246 Switching back from a static namespace-scoped function to a static class-scope function. No functional change, but resolves a warning.
llvm-svn: 205931
2014-04-09 21:40:14 +00:00
Aaron Ballman 28347a72c9 Thread Safety Analysis: now with less includes. No functional changes.
llvm-svn: 205929
2014-04-09 21:12:04 +00:00
Reid Kleckner 2a24e3ad86 clang-cl: Disable TBAA by default for MSVC compatibility
MSVC doesn't have an option to enable TBAA, so make -fstrict-aliasing
and -fno-strict-aliasing available in clang-cl.

llvm-svn: 205924
2014-04-09 20:07:39 +00:00
Anders Waldenborg 12da50a8e1 Handle difference in signedness of 'char' in test/Index/print-type.c{,pp}
llvm-svn: 205922
2014-04-09 19:39:07 +00:00
Anders Waldenborg ddce74f6f8 Make c-index-test -test-print-type include pointeekind for pointer types
The idea is to give visibility to more type kinds, especially for getting
a better grasp of what appears as unexposed type kind with libclang.

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

llvm-svn: 205921
2014-04-09 19:16:08 +00:00
Bob Wilson 0e011f201d Add a -triple argument so that this new test passes on Darwin.
The section names used here are not valid for Mach-O.

llvm-svn: 205920
2014-04-09 18:51:19 +00:00
Argyrios Kyrtzidis 9ef53ceb51 [Preprocessor/CodeComplete] Don't add include guard macros to code-completion results.
llvm-svn: 205917
2014-04-09 18:21:23 +00:00
Aaron Ballman 91b079a9fc Cannot have the base class destructor be private (or explicitly deleted); fixing the build bots.
llvm-svn: 205916
2014-04-09 17:55:04 +00:00
Aaron Ballman 3f993c1320 Thread Safety Analysis: some minor cleanups to the latest thread safety changes. No functional changes intended.
* Adds an iterator_range interface to CallExpr to get the arguments
* Modifies SExpr such that it must be allocated in the Arena, and cannot be deleted
* Minor const-correctness and nullptr updates
* Adds some operator!= implementations to complement operator==
* Removes unused functionality

llvm-svn: 205915
2014-04-09 17:45:44 +00:00
Daniel Jasper b55248278f clang-format: Update flag documentation, and generation script.
llvm-svn: 205853
2014-04-09 14:05:49 +00:00
Daniel Jasper f9fc215f82 clang-format: Treat a trailing comment like a trailing comma in braced lists.
Before:
  static StructInitInfo module = {MODULE_BUILTIN, /* type */
                                  "streams" /* name */
  };

After:
  static StructInitInfo module = {
      MODULE_BUILTIN, /* type */
      "streams"       /* name */
  };

This fixes llvm.org/PR19378.

llvm-svn: 205851
2014-04-09 13:18:49 +00:00
Daniel Jasper 21397a3232 clang-format: Fix bug where clang-format would break the code.
Before, it would turn:
  SomeFunction([]() { // Cool function..
    return 43;
  });

Into this:
  SomeFunction([]() { // Cool function.. return 43; });

llvm-svn: 205849
2014-04-09 12:21:48 +00:00
Daniel Jasper 3ae6f5a47b clang-format: Improve format of calls with several lambdas.
Before:
  SomeFunction([]() {
                 int i = 42;
                 return i;
               },
               []() {
    int j = 43;
    return j;
  });

After:
  SomeFunction([]() {
                 int i = 42;
                 return i;
               },
               []() {
                 int j = 43;
                 return j;
               });

llvm-svn: 205848
2014-04-09 12:08:39 +00:00
Daniel Jasper f9a0906b98 clang-format: Allow breaking between trailing annotations in more cases.
Before:
  void aaaaaaaaaaaaaa(aaaaaaaa aaa) override AAAAAAAAAAAAAAAAAAAAAAAA(
      aaaaaaaaaaaaaaa);

After:
  void aaaaaaaaaaaaaa(aaaaaaaa aaa) override
      AAAAAAAAAAAAAAAAAAAAAAAA(aaaaaaaaaaaaaaa);

llvm-svn: 205846
2014-04-09 10:29:11 +00:00
Daniel Jasper b48d3afcd5 clang-format: Keep more trailing annotations on the same line.
More precisely keep all short annotations (<10 characters) on the same
line if possible. Previously, clang-format would only prefer to do so
for "const", "override" and "final". However, it seems to be generally
preferable, especially because some codebases have to wrap those in
macros for backwards compatibility.

Before:
  void someLongFunction(int someLongParameter)
      OVERRIDE {}

After:
  void someLongFunction(
      int someLongParameter) OVERRIDE {}

This fixes llvm.org/PR19363.

llvm-svn: 205845
2014-04-09 10:01:49 +00:00
Daniel Jasper b175d57edc clang-format: Recognize lists ending in trailing commas correctly.
Previously, this did not look through trailing comments leading to a few
formatting oddities.

llvm-svn: 205843
2014-04-09 09:53:23 +00:00
Daniel Jasper dfacecbd31 clang-format: Add proto files and JavaScript to git-clang-format.
llvm-svn: 205842
2014-04-09 09:22:35 +00:00
NAKAMURA Takumi f605f76519 Sema::SectionInfo() should have an empty body. Sorry for the breakage.
llvm-svn: 205841
2014-04-09 08:26:33 +00:00
NAKAMURA Takumi cdb365000d Sema::SectionInfo: Prune "default" for now. Defaulted function is unavailable on msc17.
llvm-svn: 205840
2014-04-09 07:59:55 +00:00
Richard Trieu c65a56901f Add missing include.
llvm-svn: 205828
2014-04-09 03:31:44 +00:00
Jordan Rose 0675c87395 [analyzer] When checking Foundation method calls, match the selectors exactly.
This also includes some infrastructure to make it easier to build multi-argument
selectors, rather than trying to use string matching on each piece. There's a bit
more setup code, but less cost at runtime.

PR18908

llvm-svn: 205827
2014-04-09 01:39:22 +00:00
Warren Hunt 975d58c0f9 [MS-ABI] Lit fix for r205810
On linux strings have different linkage than on windows.  This 
patch makes the lit test more general.

llvm-svn: 205812
2014-04-08 22:49:38 +00:00
Warren Hunt c3b18967ed [MS-ABI] Add support for #pragma section and related pragmas
This patch adds support for the msvc pragmas section, bss_seg, code_seg, 
const_seg and data_seg as well as support for __declspec(allocate()).

Additionally it corrects semantics and adds diagnostics for 
__attribute__((section())) and the interaction between the attribute 
and the msvc pragmas and declspec.  In general conflicts should now be 
well diganosed within and among these features.

In supporting the pragmas new machinery for uniform lexing for 
msvc pragmas was introduced.  The new machinery always lexes the 
entire pragma and stores it on an annotation token.  The parser 
is responsible for parsing the pragma when the handling the 
annotation token.

There is a known outstanding bug in this implementation in C mode.  
Because these attributes and pragmas apply _only_ to definitions, we 
process them at the time we detect a definition.  Due to tentative 
definitions in C, we end up processing the definition late.  This means 
that in C mode, everything that ends up in a BSS section will end up in 
the _last_ BSS section rather than the one that was live at the time of 
tentative definition, even if that turns out to be the point of actual 
definition.  This issue is not known to impact anything as of yet 
because we are not aware of a clear use or use case for #pragma bss_seg 
but should be fixed at some point.

Differential Revision=http://reviews.llvm.org/D3065#inline-16241 

llvm-svn: 205810
2014-04-08 22:30:47 +00:00
DeLesley Hutchins f7813c56b4 Thread Safety Analysis. Misc fixes to SExpr code, responding to code review
by Aaron Ballman.

llvm-svn: 205809
2014-04-08 22:21:22 +00:00
Reid Kleckner 10847c3ed1 Fix the funcsig test with an explicit triple
llvm-svn: 205781
2014-04-08 18:28:09 +00:00
Reid Kleckner 52edddaea5 Add support for MSVC's __FUNCSIG__
It is very similar to GCC's __PRETTY_FUNCTION__, except it prints the
calling convention.

Reviewers: majnemer

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

llvm-svn: 205780
2014-04-08 18:13:24 +00:00
Reid Kleckner 6df5254d6f intrin.h: Fix up bugs in the cr3 and msr intrinsics
Don't include input and output regs in clobbers.  Prefix some
identifiers with __.  Add a memory constraint to __readcr3 to prevent
reordering.  This constraint is heavy handed, but conservatively
correct.

Thanks to PaX Team for the suggestions.

llvm-svn: 205778
2014-04-08 17:49:16 +00:00