Commit Graph

5884 Commits

Author SHA1 Message Date
Olivier Goffart df6d7b1564 Fix initializing TypeOfTypeLoc
This fixes a crash in the RecursiveASTVisitor on such code
 __typeof__(struct F*) var[invalid];

The UnderlyingTInfo of a TypeOfTypeLoc was left uninitialized when
created from ASTContext::getTrivialTypeSourceInfo
This lead to a crash in RecursiveASTVisitor when trying to access it.

llvm-svn: 220562
2014-10-24 13:52:55 +00:00
Aaron Ballman ce6c67e040 Removing the setLBracLoc and setRBracLoc functions from CompoundStmt -- their only use was with the AST reader, and friendship can be used to handle that. Drive-by rename of "Brac" to "Brace" for the private data members. NFC.
llvm-svn: 220428
2014-10-22 21:06:18 +00:00
David Blaikie 3c7dd6be20 Correct importing of the type of a TemplateArgument
It's not clear how this would be tested - I imagine we should have an
ASTImporter test that RAVs the new AST and checks that all the elements
in it are from this ASTContext and not the foreign one... but I know
little about the ASTImporter and how/where that testing might be done.

(post-commit review feedback from Richard Smith on r219900)

llvm-svn: 220411
2014-10-22 19:54:16 +00:00
Richard Smith d20f1e6dd3 PR21327 / C++ DR1652 / C++ DR73: comparing a past-the-end pointer for one
complete object to a pointer to the start of another complete object does
not evaluate to the constant 'false'. All other comparisons between the
addresses of subobjects of distinct complete objects still do.

llvm-svn: 220343
2014-10-21 23:01:04 +00:00
Alexey Bataev 03b340a3a5 [OPENMP] Codegen for 'private' clause in 'parallel' directive.
This patch generates some helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by default (with the default constructor, if any). In outlined function references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables and implicit barier is set by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D4752

llvm-svn: 220262
2014-10-21 03:16:40 +00:00
Richard Smith bc2e971803 Fix the rest of PR21289: a pack expansion that we can't expand yet makes a
template specialization type dependent, even if it has no dependent template
arguments. I've filed a corresponding bug against the C++ standard.

llvm-svn: 220088
2014-10-17 20:56:14 +00:00
David Blaikie 952a9b1743 Rename TemplateArgument::getTypeForDecl to getParamTypeForDecl for clarity
Code review feedback from Richard Smith on r219900.

llvm-svn: 220060
2014-10-17 18:00:12 +00:00
NAKAMURA Takumi 23224155e1 Revert r219977, "Re-commit r217995 and follow-up patches (r217997, r218011, r218053). These were"
It broke some builders. I guess it'd be reproducible with --vg.

  Failing Tests (3):
      Clang :: CXX/except/except.spec/p1.cpp
      Clang :: SemaTemplate/instantiate-exception-spec-cxx11.cpp
      Clang :: SemaTemplate/instantiate-exception-spec.cpp

llvm-svn: 220038
2014-10-17 12:48:37 +00:00
Yaron Keren 218dad8568 Optimize Type::isStructureOrClassType() by reusing RT->getDecl().
RecordType->getDecl() which maps to TagType::getDecl() is not a simple
accessor but a loop on redecls in getInterestingTagDecl.

isStructureOrClassType() was calling getDecl() three times performing
three times the work actually required. It is optimized by calling 
RT->getDecl() once and reusing the result three times.

llvm-svn: 220033
2014-10-17 11:44:44 +00:00
Artyom Skrobov 5e63acc448 D5775: Fix of assertion failure in case of non-POD unions with bitfields. Patch by Evgeny Astigeevich!
llvm-svn: 220031
2014-10-17 10:22:03 +00:00
Richard Smith cfaa5a3244 Towards PR21289: don't lose track of unexpanded parameter packs with
non-dependent types, in CXXScalarValueInitExprs and in the
nested-name-specifier or template arguments of a DeclRefExpr in particular.

llvm-svn: 220028
2014-10-17 02:46:42 +00:00
David Majnemer f707f0f6bb AST: Remove dead code from RecordLayoutBuilder
No functionality change intended.

llvm-svn: 220005
2014-10-17 01:00:41 +00:00
Alexey Samsonov 33e00e22da Teach SanitizerBlacklist to blacklist by SourceLocation. NFC.
llvm-svn: 219993
2014-10-16 23:50:26 +00:00
Richard Smith 9c04bce1f1 Re-commit r217995 and follow-up patches (r217997, r218011, r218053). These were
reverted in r218058 because they triggered a rejects-valid bug in MSVC.

Original commit message from r217995:

Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate
these at all! This also covers the pathological case where the only mention of
a parameter pack is within the exception specification; this gives us a second
way (other than alias templates) to reach the horrible state where a type
contains an unexpanded pack, but its canonical type does not.

llvm-svn: 219977
2014-10-16 23:00:46 +00:00
Kostya Serebryany 293dc9be6e Insert poisoned paddings between fields in C++ classes so that AddressSanitizer can find intra-object-overflow bugs
Summary:
The general approach is to add extra paddings after every field
in AST/RecordLayoutBuilder.cpp, then add code to CTORs/DTORs that poisons the paddings
(CodeGen/CGClass.cpp).

Everything is done under the flag -fsanitize-address-field-padding. 
The blacklist file (-fsanitize-blacklist) allows to avoid the transformation 
for given classes or source files. 

See also https://code.google.com/p/address-sanitizer/wiki/IntraObjectOverflow

Test Plan: run SPEC2006 and some of the Chromium tests with  -fsanitize-address-field-padding

Reviewers: samsonov, rnk, rsmith

Reviewed By: rsmith

Subscribers: majnemer, cfe-commits

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

llvm-svn: 219961
2014-10-16 20:54:52 +00:00
Tom Stellard ade13b2a4e OpenCL: Emit global variables in the constant addr space as constant globals
llvm-svn: 219929
2014-10-16 15:29:19 +00:00
David Blaikie 0f62c8d8f8 PR21246: DebugInfo: Emit the appropriate type (cv qualifiers, reference-ness, etc) for non-type template parameters
Plumb through the full QualType of the TemplateArgument::Declaration, as
it's insufficient to only know whether the type is a reference or
pointer (that was necessary for mangling, but insufficient for debug
info). This shouldn't increase the size of TemplateArgument as
TemplateArgument::Integer is still longer by another 32 bits.

Several bits of code were testing that the reference-ness of the
parameters matched, but this seemed to be insufficient (various other
features of the type could've mismatched and wouldn't've been caught)
and unnecessary, at least insofar as removing those tests didn't cause
anything to fail.

(Richard - perchaps you can hypothesize why any of these checks might
need to test reference-ness of the parameters (& explain why
reference-ness is part of the mangling - I would've figured that for the
reference-ness to be different, a prior template argument would have to
be different). I'd be happy to add them in/beef them up and add test
cases if there's a reason for them)

llvm-svn: 219900
2014-10-16 04:21:25 +00:00
Alexey Samsonov 0b15e34bd1 Move SanitizerBlacklist object from CodeGenModule to ASTContext.
Soon we'll need to have access to blacklist before the CodeGen
phase (see http://reviews.llvm.org/D5687), so parse and construct
the blacklist earlier.

llvm-svn: 219857
2014-10-15 22:17:27 +00:00
Aaron Ballman 260995b86b Adding attributes to the IndirectFieldDecl that we generate for anonymous struct/union fields. This fixes PR20930.
llvm-svn: 219807
2014-10-15 16:58:18 +00:00
Dario Domizioli a60f532a91 Fix for PR21254 - Assertion in comment parser
The size of the ID field in CommandInfo was narrow, leading to potential 
wrap-around of command IDs, causing misinterpretation later on.
The patch does the following:
- It extends the ID bitfield from 8 to 20 bits.
- It provides a DRY definition of the number of bits for the field to 
  avoid using literal numbers in different files.
- It introduces a new assertion that checks for the wrap-around.
- It adds the testcase from PR21254.

llvm-svn: 219802
2014-10-15 16:18:20 +00:00
Reid Kleckner e7367d6bcb Factor code into CXXRecordDecl::getTemplateInstantiationPattern() helper
This moves some code from SemaType.cpp's hasVisibleDefinition() into
DeclCXX.cpp so that it can be used elsewhere. I found one other instance
of code trying to do the same thing, there are probably more. Search for
getInstantiatedFrom() to try to find more.

No functionality change.

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 219714
2014-10-14 20:28:40 +00:00
Saleem Abdulrasool 3b43447619 CodeGen: correct block mangling in ObjC
Mangling for blocks defined within blocks in an ObjectiveC context were also
broken by SVN r219393.  Because the code in mangleName assumed that the code was
either C or C++, we would trigger assertions when trying to mangle the inner
blocks in an ObjectiveC context.

Add a test and use the ObjectiveC specific mangling when dealing with an
ObjectiveC method declaration.

llvm-svn: 219697
2014-10-14 17:20:18 +00:00
Saleem Abdulrasool 64ab4de443 CodeGen: correct mangling for blocks
This addresses a regression introduced with SVN r219393.  A block may be
contained within another block.  In such a scenario, we would end up within a
BlockDecl, which is not a NamedDecl (as the names are synthesised).  The cast to
a NamedDecl of the DeclContext would then assert as the types are unrelated.

Restore the mangling behaviour to that prior to SVN r219393.  If the current
block is contained within a BlockDecl, walk up to the parent DeclContext,
recursively, until we have a non-BlockDecl.  This is expected to be a NamedDecl.
Add in a couple of asserts to ensure that the assumption that we only encounter
a block within a NamedDecl or a BlockDecl.

llvm-svn: 219696
2014-10-14 17:20:14 +00:00
Fariborz Jahanian 12f7ef39ce Objective-C [Sema]. Fixes a bug in comparing qualified
Objective-C pointer types. In this case, checker incorrectly
claims incompatible pointer types if redundant protocol conformance 
is specified. rdar://18491222

llvm-svn: 219630
2014-10-13 21:07:45 +00:00
Alexey Bataev d74d060d6d [OPENMP] Codegen for 'if' clause in 'parallel' directive.
Adds codegen for 'if' clause. Currently only for 'if' clause used with the 'parallel' directive.
If condition evaluates to true, the code executes parallel version of the code by calling __kmpc_fork_call(loc, 1, microtask, captured_struct/*context*/), where loc - debug location, 1 - number of additional parameters after "microtask" argument, microtask - is outlined finction for the code associated with the 'parallel' directive, captured_struct - list of variables captured in this outlined function.
If condition evaluates to false, the code executes serial version of the code by executing the following code:

global_thread_id.addr = alloca i32
store i32 global_thread_id, global_thread_id.addr
zero.addr = alloca i32
store i32 0, zero.addr
kmpc_serialized_parallel(loc, global_thread_id);
microtask(global_thread_id.addr, zero.addr, captured_struct/*context*/);
kmpc_end_serialized_parallel(loc, global_thread_id);

Where loc - debug location, global_thread_id - global thread id, returned by __kmpc_global_thread_num() call or passed as a first parameter in microtask() call, global_thread_id.addr - address of the variable, where stored global_thread_id value, zero.addr - implicit bound thread id (should be set to 0 for serial call), microtask() and captured_struct are the same as in parallel call.

Also this patch checks if the condition is constant and if it is constant it evaluates its value and then generates either parallel version of the code (if the condition evaluates to true), or the serial version of the code (if the condition evaluates to false).
Differential Revision: http://reviews.llvm.org/D4716

llvm-svn: 219597
2014-10-13 06:02:40 +00:00
Chandler Carruth b29a743891 [complex] Teach the other two binary operators on complex numbers (==
and !=) to support mixed complex and real operand types.

This requires removing an assert from SemaChecking, and adding support
both to the constant evaluator and the code generator to synthesize the
imaginary part when needed. This seemed somewhat cleaner than having
just the comparison operators force real-to-complex conversions.

I've added test cases for these operations. I'm really terrified that
there were *no* tests in-tree which exercised this.

This turned up when trying to build R after my change to the complex
type lowering.

llvm-svn: 219570
2014-10-11 11:03:30 +00:00
Chandler Carruth a216cad0fc [complex] Teach Clang to preserve different-type operands to arithmetic
operators where one type is a C complex type, and to emit both the
efficient and correct implementation for complex arithmetic according to
C11 Annex G using this extra information.

For both multiply and divide the old code was writing a long-hand
reduced version of the math without any of the special handling of inf
and NaN recommended by the standard here. Instead of putting more
complexity here, this change does what GCC does which is to emit
a libcall for the fully general case.

However, the old code also failed to do the proper minimization of the
set of operations when there was a mixed complex and real operation. In
those cases, C provides a spec for much more minimal operations that are
valid. Clang now emits the exact suggested operations. This change isn't
*just* about performance though, without minimizing these operations, we
again lose the correct handling of infinities and NaNs. It is critical
that this happen in the frontend based on assymetric type operands to
complex math operations.

The performance implications of this change aren't trivial either. I've
run a set of benchmarks in Eigen, an open source mathematics library
that makes heavy use of complex. While a few have slowed down due to the
libcall being introduce, most sped up and some by a huge amount: up to
100% and 140%.

In order to make all of this work, also match the algorithm in the
constant evaluator to the one in the runtime library. Currently it is
a broken port of the simplifications from C's Annex G to the long-hand
formulation of the algorithm.

Splitting this patch up is very hard because none of this works without
the AST change to preserve non-complex operands. Sorry for the enormous
change.

Follow-up changes will include support for sinking the libcalls onto
cold paths in common cases and fastmath improvements to allow more
aggressive backend folding.

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

llvm-svn: 219557
2014-10-11 00:57:18 +00:00
Alexey Bataev 769562a382 Bugfix for predefined expressions in dependent context.
This bug break compilation with precompiled headers and predefined expressions in dependent context.

llvm-svn: 219525
2014-10-10 18:58:13 +00:00
John McCall c90c1498f0 Change how we distinguish bitfield widths, in-class
initializers, and captured VLA types so that we can
answer questions like "is this a bit-field" without
looking at the enclosing DeclContext.  NFC.

llvm-svn: 219522
2014-10-10 18:44:34 +00:00
Benjamin Kramer ad8e079c61 Reduce double set lookups. NFC.
llvm-svn: 219504
2014-10-10 15:32:48 +00:00
Alexey Bataev ec4747802a Fix for bug http://llvm.org/PR17427.
Assertion failed: "Computed __func__ length differs from type!"
Reworked PredefinedExpr representation with internal StringLiteral field for function declaration.
Differential Revision: http://reviews.llvm.org/D5365

llvm-svn: 219393
2014-10-09 08:45:04 +00:00
Alexey Bataev 13314bf526 [OPENMP] 'omp teams' directive basic support.
Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive.  

llvm-svn: 219385
2014-10-09 04:18:56 +00:00
Alexey Bataev 4a5bb772c3 [OPENMP] Codegen for 'firstprivate' clause.
This patch generates some helper variables that used as private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables (with the copy constructor, if any). For arrays, initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy.
In outlined function, references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D5140

llvm-svn: 219306
2014-10-08 14:01:46 +00:00
Alexey Bataev 8068b643c4 Revert commit r219297.
Still troubles with OpenMP/parallel_firstprivate_codegen.cpp (now in ARM buildbots).

llvm-svn: 219298
2014-10-08 12:00:22 +00:00
Alexey Bataev 3854f63aaf [OPENMP] Codegen for 'firstprivate' clause.
This patch generates some helper variables that used as private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables (with the copy constructor, if any). For arrays, initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy.
In outlined function, references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D5140

llvm-svn: 219297
2014-10-08 11:35:04 +00:00
Alexey Bataev bdef50e1ad Revert back r219295.
To fix issues with test OpenMP/parallel_firstprivate_codegen.cpp

llvm-svn: 219296
2014-10-08 11:12:35 +00:00
Alexey Bataev e7a5517a58 [OPENMP] Codegen for 'firstprivate' clause.
This patch generates some helper variables that used as private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables (with the copy constructor, if any). For arrays, initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy.
In outlined function, references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D5140

llvm-svn: 219295
2014-10-08 10:42:55 +00:00
Renato Golin 9804fa5d48 Revert "[OPENMP] 'omp teams' directive basic support. Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive."
This reverts commit r219197 because it broke ARM self-hosting buildbots with
segmentation fault errors in many tests.

llvm-svn: 219289
2014-10-08 09:06:45 +00:00
Justin Bogner 2ca9a4a7ef AST: Fix a typo (NFC)
llvm-svn: 219279
2014-10-08 05:45:39 +00:00
Alexey Bataev 941bbec6f4 [OPENMP] 'omp teams' directive basic support.
Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive.

llvm-svn: 219197
2014-10-07 10:13:33 +00:00
Fariborz Jahanian 35ee87debe Objective-C SDK modernizer. Patch to support modernization
to NS_ENUM/NS_OPTION macros when typedef names are other
than NSInteger/NSUInteger (int8_t, etc.).
rdar://18532199

llvm-svn: 219173
2014-10-06 23:50:37 +00:00
Fariborz Jahanian 2618dbaf5f Patch to wrap up '_' as separator in version numbers
in availability attribute by preserving this info.
in VersionTuple and using it in pretty printing of attributes
and yet using '.' as separator when diagnosing unavailable 
message calls. rdar://18490958

llvm-svn: 219124
2014-10-06 16:46:02 +00:00
Samuel Benzaquen a117002d93 Fix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
Summary:
DynTypedMatcher::constructVariadic() where the restrict kind of the
different matchers are not related causes the matcher to have a "None"
restrict kind. This causes false negatives for anyOf and eachOf.
Change the logic to get a common ancestor if there is one.
Also added regression tests that fail without the fix.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 219118
2014-10-06 13:14:30 +00:00
David Majnemer a00381fb73 MS ABI: Make comment more accurate
The ABI for function-scope statics changed in VS "14", not MSVC 2013.

llvm-svn: 219076
2014-10-05 06:44:55 +00:00
David Majnemer 040fa34bec MS ABI: Use '1' (instead of '0') relative scope discriminators
This changes the scope discriminator's behavior to start at '1' instead
of '0'.  Symbol table diffing, for ABI compatibility testing, kept
finding these as false positives.

llvm-svn: 219075
2014-10-05 06:44:53 +00:00
Benjamin Kramer 07935294be Return a reference instead of vector copy for parentmap queries.
The map is immutable until the whole ASTContext dies. While there
movify a couple of copies in ASTMatchFinder away. NFC.

llvm-svn: 219062
2014-10-04 17:01:26 +00:00
Fariborz Jahanian aae7fefce8 Objective-C. Assortment of improvements pretty printing
objective-C declarations, including printing of availability
attributes on methods.

llvm-svn: 219013
2014-10-03 20:05:33 +00:00
Hal Finkel 0dd05d4b59 constexpr evaluation for __builtin_assume_aligned
Richard noted in the review of r217349 that extra handling of
__builtin_assume_aligned inside of the expression evaluator was needed. He was
right, and this should address the concerns raised, namely:

 1. The offset argument to __builtin_assume_aligned can have side effects, and
    we need to make sure that all arguments are properly evaluated.

 2. If the alignment assumption does not hold, that introduces undefined
    behavior, and undefined behavior cannot appear inside a constexpr.

and hopefully the diagnostics produced are detailed enough to explain what is
going on.

llvm-svn: 218992
2014-10-03 17:18:37 +00:00
Hal Finkel 92b9b49f61 Revert useless part of r217349
Adding handling of __builtin_assume_aligned to IntExprEvaluator does not make
sense because __builtin_assume_aligned returns a pointer (not an integer).
Thanks to Richard for figuring out why this was not doing anything.

I'll add this back in a better place (PointerExprEvaluator perhaps).

llvm-svn: 218958
2014-10-03 04:46:46 +00:00
Fariborz Jahanian 5afc869f96 Adds 'override' to overriding methods. NFC.
These were uncoveredby my yet undelivered patch.

llvm-svn: 218774
2014-10-01 16:56:40 +00:00
Alexander Musman a5f070aec0 [OPENMP] Loop collapsing and codegen for 'omp simd' directive.
This patch implements collapsing of the loops (in particular, in
presense of clause 'collapse'). It calculates number of iterations N
and expressions nesessary to calculate the nested loops counters
values based on new iteration variable (that goes from 0 to N-1)
in Sema. It also adds Codegen for 'omp simd', which uses
(and tests) this feature.

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

llvm-svn: 218743
2014-10-01 06:03:56 +00:00
David Majnemer 00a061dccc MS ABI: Correct layout for empty records
Empty records do not always have size equivalent to their alignment.
They only do so when their alignment is at least as large as the minimum
empty struct size: 1 byte in C++ and 4 bytes in C.

llvm-svn: 218661
2014-09-30 06:45:43 +00:00
David Majnemer 4ce469b7ea AST: Fix a typo in RecordLayoutBuilder
No functional change intended.

llvm-svn: 218628
2014-09-29 21:38:08 +00:00
Ben Langmuir 11eab6120d Fix an assertion failure trying to emit a trivial destructor in ObjC++
If a base class declares a destructor, we will add the implicit
destructor for the subclass in
ActOnFields -> AddImplicitlyDeclaredMembersToClass

But in Objective C++, we did not compute whether we have a trivial
destructor until after that in
CXXRecordDecl::completeDefinition()

This was leading to a mismatch between the class, which thought it had
no trivial destructor, and the CXXDestructorDecl, which considered
itself trivial. It turns out the reason we delayed setting this until
completeDefinition() was for a warning that has since been removed as
part of -Warc-abi, so we just do it eagerly now.

llvm-svn: 218520
2014-09-26 15:27:29 +00:00
David Majnemer a9b7e661c8 MS ABI: Assert that vftables should have a non-RTTI entry
No functional change intended.

llvm-svn: 218506
2014-09-26 08:07:55 +00:00
Nikola Smiljanic 67860249e0 -ms-extensions: Implement __super scope specifier (PR13236).
We build a NestedNameSpecifier that records the CXXRecordDecl in which
__super appeared. Name lookup is performed in all base classes of the
recorded CXXRecordDecl. Use of __super is allowed only inside class and
member function scope.

llvm-svn: 218484
2014-09-26 00:28:20 +00:00
David Majnemer 0d0560c37a MS ABI: Avoid hashing back reference keys in mangler
This patch replaces the back reference StringMap from the MS mangler
with a SmallVector of strings. My previous patches reduced the number of
hashes involved in back reference lookups, this one removes them
completely. The back reference map contains at most 10 entries, which
are likely to be of varying sizes and different initial subsequences,
and which can easily became huge (due to templates and namespaces).

The solution presented is the simplest possible one. Nevertheless, it's
enough to reduce compilation times for a particular test case from 11.1s
to 9s, versus 8.58s for the Itanium ABI. Possible further improvements
include using a sorted vector (carefully to not introduce an extra
comparison), storing the string contents in a common arena, and/or keep
the string storage in the context for reuse.

Patch by Agustín Bergé.

llvm-svn: 218461
2014-09-25 19:43:56 +00:00
Richard Smith 5b57167285 Fix handling of preincrement on bit-fields. This gives a bit-field in C++, but
we were failing to find that bit-field when performing integer promotions. This
brings us closer to following the standard, and closer to GCC.

In C, this change is technically a regression: we get bit-field promotions
completely wrong in C, promoting cases that are categorically not bit-field
designators. This change makes us do so slightly more consistently, though.

llvm-svn: 218428
2014-09-24 23:55:00 +00:00
Fariborz Jahanian 945a08d7cd Patch to allow mangling of microsoft’s __uuidof expression for the Itanium ABI
when under -fms-extensions. Reviewed by John McCall.
//rdar://17784718

llvm-svn: 218384
2014-09-24 16:28:40 +00:00
David Majnemer c2e6753958 MS ABI: Pure virtual functions don't contribute to vtordisps
Usually, overriding a virtual function defined in a virtual base
required emission of a vtordisp slot in the record.  However no vtordisp
is needed if the overriding function is pure; it should be impossible to
observe the pure virtual method.

This fixes PR21046.

llvm-svn: 218340
2014-09-23 22:58:15 +00:00
Alexander Musman e4e893bb36 [OPENMP] Parsing/Sema of directive omp parallel for simd
llvm-svn: 218299
2014-09-23 09:33:00 +00:00
David Majnemer 9c775c7fe3 AST: Mangle cast expression encoding more accurately
Don't mangle all casts in expressions as "cv", use the appropriate
encoding which corresponds to a specific cast.

This fixes PR21034.

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

llvm-svn: 218293
2014-09-23 04:27:55 +00:00
Reid Kleckner 15fdcf19ba Fix a vftable mangling bug
We need to walk the class hierarchy twice: once in depth-first base
specifier order for mangling and again in depth-first layout order for
vftable layout.

Vftable layout seems to depend on the full path from the most derived
class to the base containing the vfptr.

Fixes PR21031.

llvm-svn: 218285
2014-09-22 23:14:46 +00:00
David Majnemer 6e9ae7804b MS ABI: Remove a FIXME that has been fixed
We've implemented MSVC-style RTTI for quite some time.

llvm-svn: 218269
2014-09-22 20:39:37 +00:00
Fariborz Jahanian a3d8879be7 Fix evatuated value of __builtin_object_size according to its
'type'  argument when it cannot be determined which objects ptr 
points to at compile time. rdar://18334276

llvm-svn: 218258
2014-09-22 17:11:59 +00:00
Ehsan Akhgari 31097581aa ms-inline-asm: Scope inline asm labels to functions
Summary:
This fixes PR20023.  In order to implement this scoping rule, we piggy
back on the existing LabelDecl machinery, by creating LabelDecl's that
will carry the "internal" name of the inline assembly label, which we
will rewrite the asm label to.

Reviewers: rnk

Subscribers: cfe-commits

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

llvm-svn: 218230
2014-09-22 02:21:54 +00:00
Reid Kleckner 6ad58095c7 Silence MSVC warnings from r218127 about not returning a value
llvm-svn: 218128
2014-09-19 16:20:24 +00:00
Samuel Benzaquen 622e8d75e4 Make DynTypedNode have the dynamic type of the object, instead of its static type.
Summary:
Make DynTypedNode have the dynamic type of the object, instead of its static type.
Some optimizations that are in the works require that the nodes have the right type.

Reviewers: klimek

Subscribers: cfe-commits

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

llvm-svn: 218127
2014-09-19 16:10:03 +00:00
Alexey Bataev 0bd520b767 [OPENMP] Initial parsing/sema analysis of 'target' directive.
llvm-svn: 218110
2014-09-19 08:19:49 +00:00
Hans Wennborg e113c20c1d Revert r217995 and follow-ups:
r218053: Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
r218011: Work around MSVC parser bug by putting redundant braces around the body of
r217997: Skip parens when detecting whether we're instantiating a function declaration.
r217995: Instantiate exception specifications when instantiating function types (other

The Windows build was broken for 16 hours and no one had any good ideas of how to
fix it. Reverting for now to make the builders green. See the cfe-commits thread [1] for
more info.

This was the build error (from [2]):

C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1590) : error C2668: '`anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType' : ambiguous call to overloaded function
        C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1313): could be 'clang::QualType `anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)'
        with
        [
            Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>
        ]
        c:\bb-win7\ninja-clang-i686-msc17-r\llvm-project\clang\lib\sema\TreeTransform.h(4532): or       'clang::QualType clang::TreeTransform<Derived>::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)'
        with
        [
            Derived=`anonymous-namespace'::TemplateInstantiator,
            Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>
        ]
        while trying to match the argument list '(clang::TypeLocBuilder, clang::FunctionProtoTypeLoc, clang::CXXRecordDecl *, unsigned int, clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>)'

 1. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140915/115011.html
 2. http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/10515/steps/build_clang_tools_1/logs/stdio

llvm-svn: 218058
2014-09-18 16:01:32 +00:00
Alexander Kornienko 1aa0af2aca Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
accesses to incorrect exception types when getExceptionSpecType() != EST_Dynamic

This fixes a crash in test/CXX/except/except.spec/template.cpp that happens in
certain build configurations.

llvm-svn: 218053
2014-09-18 15:19:53 +00:00
Alexander Musman f82886e502 Parsing/Sema of directive omp for simd
llvm-svn: 218029
2014-09-18 05:12:34 +00:00
Richard Smith 4ff123860b Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate
these at all! This also covers the pathological case where the only mention of
a parameter pack is within the exception specification; this gives us a second
way (other than alias templates) to reach the horrible state where a type
contains an unexpanded pack, but its canonical type does not.

llvm-svn: 217995
2014-09-17 23:57:05 +00:00
Rafael Espindola 1e4df92f49 Add support for putting constructors and destructos in explicit comdats.
There are situations when clang knows that the C1 and C2 constructors
or the D1 and D2 destructors are identical. We already optimize some
of these cases, but cannot optimize it when the GlobalValue is
weak_odr.

The problem with weak_odr is that an old TU seeing the same code will
have a C1 and a C2 comdat with the corresponding symbols. We cannot
suddenly start putting the C2 symbol in the C1 comdat as we cannot
guarantee that the linker will not pick a .o with only C1 in it.

The solution implemented by GCC is to expand the ABI to have a comdat
whose name uses a C5/D5 suffix and always has both symbols. That is
what this patch implements.

llvm-svn: 217874
2014-09-16 15:18:21 +00:00
Richard Smith b01fe40c07 Reject a slightly-sneaky way to perform a read of mutable state from within a
constexpr function. Part of this fix is a tentative fix for an as-yet-unfiled
core issue (we're missing a prohibition against reading mutable members from
unions via a trivial constructor/assignment, since that doesn't perform an
lvalue-to-rvalue conversion on the members).

llvm-svn: 217852
2014-09-16 01:24:02 +00:00
Aaron Ballman 5388538e87 Pretty print attributes associated with record declarations.
llvm-svn: 217784
2014-09-15 16:45:30 +00:00
Richard Trieu 40bcd9f664 Don't print 'NULL TYPE' when dumping a delegating constructor.
llvm-svn: 217707
2014-09-12 21:20:53 +00:00
Fariborz Jahanian ab4fe98b4a patch to add missing warning on sizeof wrong parameter
for __builtin___strlcpy_chk/__builtin___strlcat_chk.
Patch by Jacques Fortier with monir change by me and
addition of test. rdar://18259539

llvm-svn: 217700
2014-09-12 18:44:36 +00:00
David Majnemer d59becbc07 MS ABI: The latest VC "14" CTP implements deleted virtual functions
Deleted virtual functions get _purecall inserted into the vftable.
Earlier CTPs would simply stick nullptr in there.

N.B.  MSVC can't handle deleted virtual functions which require return
adjusting thunks, they give an error that a deleted function couldn't be
called inside of a compiler generated function.  We get this correct by
making the thunk have a __purecall entry as well.

llvm-svn: 217654
2014-09-12 04:38:08 +00:00
Fariborz Jahanian 6485fe4b07 Objective-C. Under a special flag, -Wcstring-format-directive,
off by default, issue a warning if %s directive is used in
certain CF/NS formatting APIs, to assist user in deprecating
use of such %s in these APIs. rdar://18182443

llvm-svn: 217467
2014-09-09 23:10:54 +00:00
Hal Finkel bcc06085a8 Add __builtin_assume and __builtin_assume_aligned using @llvm.assume.
This makes use of the recently-added @llvm.assume intrinsic to implement a
__builtin_assume(bool) intrinsic (to provide additional information to the
optimizer). This hooks up __assume in MS-compatibility mode to mirror
__builtin_assume (the semantics have been intentionally kept compatible), and
implements GCC's __builtin_assume_aligned as assume((p - o) & mask == 0). LLVM
now contains special logic to deal with assumptions of this form.

llvm-svn: 217349
2014-09-07 22:58:14 +00:00
Richard Smith f463436d9c [modules] Make NamespaceAliasDecl redeclarable, as it should be. This fixes
merging of namespace aliases across modules and improves source fidelity.
Incidentally also fixes PR20816.

llvm-svn: 217103
2014-09-03 23:11:22 +00:00
Richard Smith 73b21d8fa1 [modules] Use DeclContext::equals rather than == on DeclContext* when
determining whether a declaration is out of line, instead of assuming
that the semantic and lexical DeclContext will be the same declaration
whenever they're the same entity.

This fixes behavior of declarations within merged classes and enums.

llvm-svn: 217008
2014-09-03 02:33:22 +00:00
Craig Topper bf3e32705a Fix some cases where StringRef was being passed by const reference. Remove const from some other StringRefs since its implicitly const already.
llvm-svn: 216825
2014-08-30 16:55:52 +00:00
Craig Topper 8c2a2a0f82 Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>.
llvm-svn: 216824
2014-08-30 16:55:39 +00:00
David Blaikie 50a5f97e82 unique_ptrify SourceManager::createFileID
llvm-svn: 216715
2014-08-29 07:59:55 +00:00
Alexey Bataev 39c81e2816 [C++11] Support for capturing of variable length arrays in lambda expression.
Differential Revision: http://reviews.llvm.org/D4368

llvm-svn: 216649
2014-08-28 04:28:19 +00:00
Fariborz Jahanian 7e3e291b33 Objective-C. Change to method lookup rules to look
into primary class's named categories before looking 
into their protocols. This is because categories are
part of the public interface and , just as primary class,
preference should be given to them before class 
(and category) protocols.  // rdar://18013929

llvm-svn: 216610
2014-08-27 20:34:29 +00:00
Rafael Espindola d87f8d76e0 Update for LLVM api change.
llvm-svn: 216585
2014-08-27 20:03:29 +00:00
Craig Topper 5fc8fc2d31 Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
llvm-svn: 216528
2014-08-27 06:28:36 +00:00
Craig Topper 3cb91b2ad1 Fix some cases were ArrayRefs were being passed by reference.
llvm-svn: 216527
2014-08-27 06:28:16 +00:00
Richard Trieu 9fee0b7c0b Refactor one of the larger functions for Type Diffing into smaller functions.
No functionality change.

llvm-svn: 216526
2014-08-27 06:24:47 +00:00
Richard Trieu 88d786eab8 Change a few methods to static methods. No functionality change.
llvm-svn: 216519
2014-08-27 04:45:30 +00:00
Richard Trieu 3af6c10afb Refactor the diagnostic DeclContext printing. No functionality change.
llvm-svn: 216517
2014-08-27 03:05:19 +00:00
Fariborz Jahanian be7bf7285b Objective-C modernization. Convert -initWithUTF8String messaging
with auto-boxing syntax for literals. rdar://18080352

llvm-svn: 216405
2014-08-25 20:22:25 +00:00
Craig Topper c6914d068f Use range based for loops to avoid needing to re-mention SmallPtrSet size.
llvm-svn: 216370
2014-08-25 04:15:02 +00:00
Fariborz Jahanian 4bf437ecd8 Objective-C. Warn when @encode'ing provides an incomplete
type encoding because in certain cases, such as for vector
types, because we still haven't designed encoding for them.
rdar://9255564

llvm-svn: 216301
2014-08-22 23:17:52 +00:00
Fariborz Jahanian 78e9debf68 Objective-C. Warn if user has made explicit call
to +initilize as this results in an extra call
to this method. rdar://16628028

llvm-svn: 216271
2014-08-22 16:57:26 +00:00
Akira Hatanaka 987f1864ca [AArch64, inline-asm] Improve diagnostic that is printed when the size of a
variable that has regiser constraint "r" is not 64-bit.

General register operands are output using 64-bit "x" register names, regardless
of the size of the variable, unless the asm operand is prefixed with the "%w"
modifier. This surprises and confuses many users who aren't familiar with
aarch64 inline assembly rules.

With this commit, a note and fixit hint are printed which tell the users that
they need modifier "%w" in order to output a "w" register instead of an "x"
register.

<rdar://problem/12764785>

llvm-svn: 216260
2014-08-22 06:05:21 +00:00
David Majnemer 118da50a2a MS ABI: Don't use the Itanium scheme for numbering lambdas
The Itanium ABI will give out the same mangling number for two different
lambdas if their call operators have different types.  The MS ABI cannot
do the same because it does not mangle the return type into it's
lambdas.

This fixes PR20719.

llvm-svn: 216259
2014-08-22 04:22:50 +00:00
Hans Wennborg a302cd9a5e Range'ify some for loops over RecordDecl::fields()
No functionality change.

llvm-svn: 216183
2014-08-21 16:06:57 +00:00
Aaron Ballman dd69ef38db C++1y is now C++14!
Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording.

llvm-svn: 215982
2014-08-19 15:55:55 +00:00
Alexander Musman 3aaab669c8 [OPENMP] Extract common superclass from all the loop directives. No functional changes (having common superclass is convenient for future loop directives CodeGen implementation)
llvm-svn: 215975
2014-08-19 11:27:13 +00:00
David Majnemer 9a3bc59407 MS ABI: Update alias template mangling for VC "14" CTP 3
MSVC "14" CTP 3 has fixed it's mangling for alias templates when used as
template-template arguments; update clang to be compatible with this
mangling.

llvm-svn: 215972
2014-08-19 07:29:03 +00:00
Keno Fischer 070db177bd Make sure CallExpr::getLocStart doesn't segfault
Summary:
When the CallExpr passed to Sema::ConvertArgumentsForCall has all default parameters, and the number of actual arguments passed is zero, this function will segfault in the call to Call->getLocStart() if the Callee has an invalid getLocStart(), the reason being that since ConvertArgumentsForCall has set the correct number of arguments, but has not filled them in yet, getLocStart() will try to access the first (not yet existent) argument and thus segfaults.

This fixes that by making getLocStart return an invalid source location if the queried argument is NULL rather than segfaulting.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 215686
2014-08-15 01:39:12 +00:00
Benjamin Kramer 2f5db8b3db Header guard canonicalization, clang part.
Modifications made by clang-tidy with minor tweaks.

llvm-svn: 215557
2014-08-13 16:25:19 +00:00
Richard Smith bb853c79c0 [modules] When performing a lookup into a namespace, ensure that any later
redefinitions of that namespace have already been loaded. When writing out the
names in a namespace, if we see a name that is locally declared and had
imported declarations merged on top of it, export the local declaration as the
lookup result, because it will be the most recent declaration of that entity in
the redeclaration chain of an importer of the module.

llvm-svn: 215518
2014-08-13 01:23:33 +00:00
David Majnemer 2f6a96e1b6 MS ABI: Mangle this qualifiers on function types
C++11 allows this qualifiers to exist on function types when used in
template arguments.  Previously, I believed it wasn't possible because
MSVC rejected declarations like: S<int () const &> s;

However, it turns out MSVC properly allows them in using declarations;
updated clang to be compatible with this mangling.

llvm-svn: 215464
2014-08-12 17:53:10 +00:00
Richard Smith 35f986d3cd Modify behavior of -ast-dump-lookups: if -ast-dump is not also provided, dump
anyway. If -ast-dump *is* also provided, then dump the AST declarations as well
as the lookup results. This is invaluable for cross-correlating the lookup
information with the declarations actually found.

llvm-svn: 215393
2014-08-11 22:11:07 +00:00
Richard Smith 2516ba27b1 Add some FIXMEs.
llvm-svn: 215375
2014-08-11 18:35:44 +00:00
Timur Iskhodzhanov 16055e77b9 Fix PR20444 -- wrong number of vftable slots created when return adjustment thunks are needed
Reviewed at http://reviews.llvm.org/D4822

llvm-svn: 215312
2014-08-10 11:40:51 +00:00
Timur Iskhodzhanov f97c973c2e Fix PR20479 -- missing vftable slots in case of virtual inheritance vs return adjusting thunks
Reviewed at http://reviews.llvm.org/D4829

llvm-svn: 215285
2014-08-09 17:08:06 +00:00
Fariborz Jahanian 501e71c86b Objective-C ARC. Adding declarations for Objective-C's
new APIs for literals. nfc. wip. rdar://17554063

llvm-svn: 214993
2014-08-06 20:56:21 +00:00
Fariborz Jahanian 413297c53d Objective-C ARC. First patch toward generating new APIs
for Objective-C's array and dictionary literals.
rdar://17554063. This is wip.

llvm-svn: 214983
2014-08-06 18:13:46 +00:00
David Majnemer ff9075f054 MS ABI: Mangle lambdas which are given the same mangling number
It is possible for lambdas to get the same mangling number because they
may exist in different mangling contexts.  To handle this correctly,
mangle the context into the name as well.

llvm-svn: 214947
2014-08-06 03:12:47 +00:00
David Majnemer 57fbc0c35f MS ABI: Mangle empty type parameter packs compatibly
The MS mangling scheme apparently has separate manglings for type and
non-type parameter packs when they are empty.  Match template arguments
with parameters during mangling; check the parameter to see if it was
destined to hold type-ish things or nontype-ish things.

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

llvm-svn: 214932
2014-08-05 22:43:45 +00:00
David Majnemer bbe649c250 MS ABI: Make the alias template mangling more correct
llvm-svn: 214847
2014-08-05 06:42:40 +00:00
David Majnemer 11d2427b21 AST: Fix the mangling for unqualified-blocks
CXXNameMangler::mangleUnqualifiedBlock believed that
MangleContext::getBlockId returned something that used Itanium-style
discriminator numbers.

Discriminator numbers start their numberign from 1 and the first
mangling that actually gets any sort of number mangled in is the second
discriminator.

However, Block IDs start from zero.  The logic for omitting the mangling
number did a ' > 1' instead of a ' > 0' comparison; this could
potentially cause mangling conflicts.

llvm-svn: 214699
2014-08-04 06:16:50 +00:00
David Majnemer 37bffb6f3a AST: Propagate 'AlignIsRequired' though many levels of typedefs
A typedef of a typedef should have AlignIsRequired if *either* typedef
has an AlignAttr attached to it.

llvm-svn: 214698
2014-08-04 05:11:01 +00:00
Aaron Ballman 4bfa0de5b0 Improving diagnostic source ranges for the nonnull attribute. Now it highlights the attribute and the faulty nonpointer type when possible.
llvm-svn: 214507
2014-08-01 12:58:11 +00:00
Richard Smith 8acb4280c5 Factor out exception specification information from
FunctionProtoType::ExtProtoInfo. Most of the users of these fields don't care
about the other ExtProtoInfo bits and just want to talk about the exception
specification.

llvm-svn: 214450
2014-07-31 21:57:55 +00:00
Richard Smith 77be48ac47 PR18097: Support initializing an _Atomic(T) from an object of C++ class type T
or a class derived from T. We already supported this when initializing
_Atomic(T) from T for most (and maybe all) other reasonable values of T.

llvm-svn: 214390
2014-07-31 06:31:19 +00:00
David Majnemer f8d3864dbe AST: Simplify some code
Iterator invalidation issues already force us to do one lookup and one
insert.
Don't use the particular bit-pattern of the 'Align' field to determine
whether or not we have already inserted into the TypeInfo DenseMap;
instead ask for an iterator to the TypeInfo entry.

llvm-svn: 214293
2014-07-30 08:42:33 +00:00
David Majnemer 8d5f9ab2cc MS ABI: Mangle alias templates used as template-template arguments
A templated using declaration may be used as a template-template
argument.

Unfortunately, the VS "14" chooses '?' as the sole marker for the
argument.  This is problematic because it presupposes the possibility of
using more than one template-aliases as arguments to the same template.

This fixes PR20047.

llvm-svn: 214290
2014-07-30 08:20:03 +00:00
Rafael Espindola eaa88c1eee Simplify the code.
Thanks to David Balkie for the suggestion.

llvm-svn: 214286
2014-07-30 04:40:23 +00:00
Rafael Espindola e122ee1fab Fix a use after free bug.
llvm-svn: 214281
2014-07-30 02:37:26 +00:00
David Majnemer 34b5749989 MS ABI: Consider alignment attributes on typedefs for layout
The MS ABI has a notion of 'required alignment' for fields; this
alignment supercedes pragma pack directives.

MSVC takes into account alignment attributes on typedefs when
determining whether or not a field has a certain required alignment.

Do the same in clang by tracking whether or not we saw such an attribute
when calculating the type's bitwidth and alignment.

This fixes PR20418.

Reviewers: rnk

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

llvm-svn: 214274
2014-07-30 01:30:47 +00:00
Richard Trieu 97bacec221 If a template argument is non-evaluable expression, use the profile ID to see
if the two arguments are equal.

llvm-svn: 214008
2014-07-26 02:10:52 +00:00
Richard Smith a0cbfc9d75 Improve -UNDEBUG binary size. We don't need a different assert fail message for
each different enum value here.

llvm-svn: 213996
2014-07-26 00:47:13 +00:00
Warren Hunt f6be4cb4cb Revert r213437
We no longer plan to use __except_hander3 and rather use custom 
personality functions per __try block.

llvm-svn: 213971
2014-07-25 20:52:51 +00:00
Richard Trieu d86c901f29 Pass the PrintingPolicy when converting types to strings in template type
diffing.  This removes extra "struct"/"class" in the type names and gives
"bool" instead of "_Bool" for booleans.

llvm-svn: 213912
2014-07-25 00:24:02 +00:00
Richard Trieu 116083159c Print "(default)" for default template template arguments to match the
printing of other types.

llvm-svn: 213902
2014-07-24 23:14:16 +00:00
Alexey Bataev 82bad8b026 [OPENMP] Initial parsing and sema analysis for clause 'seq_cst' of 'atomic' directive.
llvm-svn: 213846
2014-07-24 08:55:34 +00:00
Alexey Bataev 459dec0ca2 [OPENMP] Initial parsing and sema analysis for clause 'capture' in 'atomic' directive.
llvm-svn: 213842
2014-07-24 06:46:57 +00:00
Richard Trieu 3880089fc7 Add support for nullptr template arguments to template type diffing.
llvm-svn: 213840
2014-07-24 04:24:50 +00:00
Richard Smith 33b44ab2b7 Replace r213816's fix with a different one. It's not meaningful to call
isOnePastTheEnd on an invalid designator, so assert and push the check into the
one caller that wasn't already checking.

llvm-svn: 213820
2014-07-23 23:50:25 +00:00
Reid Kleckner 142dd46c2a Add a missing Invalid check to SubobjectDesignator::isOnePastEnd()
The class seems to have an invariant that Entries is non-empty if
Invalid is false.  It appears this method was previously private, and
all internal uses checked Invalid.  Now there is an external caller, so
check Invalid to avoid array OOB underflow.

Fixes PR20420.

llvm-svn: 213816
2014-07-23 23:24:25 +00:00
Tim Northover 40956e64f2 AArch64: update Clang for merged arm64/aarch64 triples.
The main subtlety here is that the Darwin tools still need to be given "-arch
arm64" rather than "-arch aarch64". Fortunately this already goes via a custom
function to handle weird edge-cases in other architectures, and it tested.

I removed a few arm64_be tests because that really isn't an interesting thing
to worry about. No-one using big-endian is also referring to the target as
arm64 (at least as far as toolchains go). Mostly they date from when arm64 was
a separate target and we *did* need a parallel name simply to test it at all.
Now aarch64_be is sufficient.

llvm-svn: 213744
2014-07-23 12:32:58 +00:00
Alexey Bataev 67a4f22f12 [OPENMP] Initial parsing and sema analysis for 'update' clause of 'atomic' directive.
llvm-svn: 213735
2014-07-23 10:25:33 +00:00
Alexey Bataev dea4761c06 [OPENMP] Initial parsing an sema analysis for 'write' clause of 'atomic' directive.
llvm-svn: 213728
2014-07-23 07:46:59 +00:00
Richard Smith a593419593 AST printer: fix double space before base class with no access specifier.
llvm-svn: 213719
2014-07-23 03:22:10 +00:00
Richard Smith a4bb292095 When pretty-printing a declaration of a pack, put the ellipsis before the name
being declared, not at the end. When pretty-printing a non-type template
parameter, put the name of the parameter in the middle of the type, not at the
end.

llvm-svn: 213718
2014-07-23 03:17:06 +00:00
Alexey Bataev f98b00c33e [OPENMP] Initial parsing and sema analysis for 'read' clause in 'atomic' directive.
llvm-svn: 213717
2014-07-23 02:27:21 +00:00
Alexey Bataev 0162e459ef [OPENMP] Initial parsing and sema analysis for 'atomic' directive.
llvm-svn: 213639
2014-07-22 10:10:35 +00:00
Alexey Bataev 9fb6e647e7 [OPENMP] Initial parsing and sema analysis for 'ordered' directive.
llvm-svn: 213616
2014-07-22 06:45:04 +00:00
Richard Trieu d53def22ef Fix '&' printing for template arguments in parentheses in template diffing.
llvm-svn: 213613
2014-07-22 04:42:15 +00:00
Richard Trieu 63056c3918 More gracefully handle parentheses in templare arguments in template diffing.
llvm-svn: 213611
2014-07-22 04:06:54 +00:00
Richard Trieu 965cfa1d5b Fix a template diffing problem were an '&' is unexpectedly printed in
a template argument.

llvm-svn: 213609
2014-07-22 03:33:01 +00:00
Alexey Bataev 6125da9258 [OPENMP] Initial parsing and sema analysis for 'flush' directive.
llvm-svn: 213512
2014-07-21 11:26:11 +00:00
Alexander Musman d9ed09f7a5 [OPENMP] Parsing/Sema of the OpenMP directive 'critical'.
llvm-svn: 213510
2014-07-21 09:42:05 +00:00