]> granicus.if.org Git - clang/log
clang
9 years agoTry to fix non-asserts CodeGenCXX/vararg-non-pod-ms-compat.cpp
Hans Wennborg [Mon, 29 Sep 2014 23:45:00 +0000 (23:45 +0000)]
Try to fix non-asserts CodeGenCXX/vararg-non-pod-ms-compat.cpp

There are two GEP's in the function, and it seems the X64 CHECK
was matching the wrong one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218645 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't trap when passing non-POD arguments to variadic functions in MS-compatibility...
Hans Wennborg [Mon, 29 Sep 2014 23:06:57 +0000 (23:06 +0000)]
Don't trap when passing non-POD arguments to variadic functions in MS-compatibility mode

Clang warns (treated as error by default, but still ignored in system headers)
when passing non-POD arguments to variadic functions, and generates a trap
instruction to crash the program if that code is ever run.

Unfortunately, MSVC happily generates code for such calls without a warning,
and there is code in system headers that use it.

This makes Clang not insert the trap instruction when in -fms-compatibility
mode, while still generating the warning/error message.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218640 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUse ClangToLLVMArgsMapping in CodeGenTypes::GetFunctionType(). NFC.
Alexey Samsonov [Mon, 29 Sep 2014 22:08:00 +0000 (22:08 +0000)]
Use ClangToLLVMArgsMapping in CodeGenTypes::GetFunctionType(). NFC.

This is the last piece of CGCall code that had implicit assumptions about
the order in which Clang arguments are translated to LLVM ones (positions
of inalloca argument, sret, this, padding arguments etc.) Now all of
this data is encapsulated in ClangToLLVMArgsMapping. If this information
would be required somewhere else, this class can be moved to a separate
header or pulled into CGFunctionInfo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218634 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTest commit. Fix a whitespace in ToolChains.cpp.
Rafael Auler [Mon, 29 Sep 2014 21:50:34 +0000 (21:50 +0000)]
Test commit. Fix a whitespace in ToolChains.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218630 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAST: Fix a typo in RecordLayoutBuilder
David Majnemer [Mon, 29 Sep 2014 21:38:08 +0000 (21:38 +0000)]
AST: Fix a typo in RecordLayoutBuilder

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218628 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoIntroduce CGFunctionInfo::getNumRequiredArgs(). NFC.
Alexey Samsonov [Mon, 29 Sep 2014 21:21:48 +0000 (21:21 +0000)]
Introduce CGFunctionInfo::getNumRequiredArgs(). NFC.

Save the callers from necessity to special-case on variadic functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218625 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCUDA: Fix incorrect target inference for implicit members.
Eli Bendersky [Mon, 29 Sep 2014 20:38:29 +0000 (20:38 +0000)]
CUDA: Fix incorrect target inference for implicit members.

As PR20495 demonstrates, Clang currenlty infers the CUDA target (host/device,
etc) for implicit members (constructors, etc.) incorrectly. This causes errors
and even assertions in Clang when compiling code (assertions in C++11 mode where
implicit move constructors are added into the mix).

Fix the problem by inferring the target from the methods the implicit member
should call (depending on its base classes and fields).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218624 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSpeedup ClangToLLVMArgMapping construction. NFC.
Alexey Samsonov [Mon, 29 Sep 2014 20:30:22 +0000 (20:30 +0000)]
Speedup ClangToLLVMArgMapping construction. NFC.

Add a method to calculate the number of arguments given QualType
expnads to. Use this method in ClangToLLVMArgMapping calculation.
This number may be cached in CodeGenTypes for efficiency, if needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218623 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoObjective-C [qoi] - provide group name for
Fariborz Jahanian [Mon, 29 Sep 2014 20:17:04 +0000 (20:17 +0000)]
Objective-C [qoi] - provide group name for
warn_property_types_are_incompatible. rdar://18487506

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218621 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.
Samuel Benzaquen [Mon, 29 Sep 2014 18:43:20 +0000 (18:43 +0000)]
Refactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.

Summary:
This change introduces DynMatcherInterface and changes the internal
representation of DynTypedMatcher and Matcher<T> to use a generic
interface instead.
It removes unnecessary indirections and virtual function calls when
converting matchers by implicit and dynamic casts.
DynTypedMatcher now remembers the stricter type in the chain of casts
and checks it before calling into DynMatcherInterface.
This change improves our clang-tidy related benchmark by ~14%.
Also, it opens the door for more optimizations of this kind that are
coming in future changes.

As a side effect of removing these template instantiations, it also
speeds up compilation of Dynamic/Registry.cpp by ~17% and reduces the number of
symbols generated by ~30%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218616 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor ABIArgInfo::Expand implementation (NFC).
Alexey Samsonov [Mon, 29 Sep 2014 18:41:28 +0000 (18:41 +0000)]
Refactor ABIArgInfo::Expand implementation (NFC).

Hoist the logic which determines the way QualType is expanded
into a separate method. Remove a bunch of copy-paste and simplify
getTypesFromArgs() / ExpandTypeFromArgs() / ExpandTypeToArgs() methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218615 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUpdate modules documentation now that C++ support is working pretty well.
Richard Smith [Mon, 29 Sep 2014 17:46:41 +0000 (17:46 +0000)]
Update modules documentation now that C++ support is working pretty well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218614 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix bug 20116 - http://llvm.org/bugs/show_bug.cgi?id=20116
Alexey Bataev [Mon, 29 Sep 2014 10:32:21 +0000 (10:32 +0000)]
Fix bug 20116 - http://llvm.org/bugs/show_bug.cgi?id=20116

Fixes incorrect codegen when devirtualization is aborted due to covariant return types.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218602 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Fix GCC warning about implicit bool pointer conversion.
Daniel Jasper [Mon, 29 Sep 2014 08:07:46 +0000 (08:07 +0000)]
clang-format: Fix GCC warning about implicit bool pointer conversion.

Introduced in r217880.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218597 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: [JS] Improve formatting of function literals in chains
Daniel Jasper [Mon, 29 Sep 2014 07:54:54 +0000 (07:54 +0000)]
clang-format: [JS] Improve formatting of function literals in chains

Before:
  getSomeLongPromise(.....)
      .then(
           function(value) {
             body();
             body();
           })
      .thenCatch(function(error) {
    body();
    body();
  });

After:
  getSomeLongPromise(.....)
      .then(function(value) {
        body();
        body();
      })
      .thenCatch(function(error) {
        body();
        body();
      });

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218595 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove dead code from DIBuilder
Jyoti Allur [Mon, 29 Sep 2014 06:32:54 +0000 (06:32 +0000)]
Remove dead code from DIBuilder

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218593 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agotesting commit access to clang repo
Jyoti Allur [Mon, 29 Sep 2014 06:23:54 +0000 (06:23 +0000)]
testing commit access to clang repo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218592 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTests for DR600-640.
Richard Smith [Mon, 29 Sep 2014 06:03:56 +0000 (06:03 +0000)]
Tests for DR600-640.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218591 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix "unsupported friend" diagnostic to also appear for friend functions with dependen...
Richard Smith [Mon, 29 Sep 2014 05:57:29 +0000 (05:57 +0000)]
Fix "unsupported friend" diagnostic to also appear for friend functions with dependent scopes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218590 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd the tests for __super that I forgot to commit in as part of r218484.
Nikola Smiljanic [Mon, 29 Sep 2014 01:11:55 +0000 (01:11 +0000)]
Add the tests for __super that I forgot to commit in as part of r218484.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218587 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRun DR tests in C++17 mode too.
Richard Smith [Sun, 28 Sep 2014 21:56:04 +0000 (21:56 +0000)]
Run DR tests in C++17 mode too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218580 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCodeGen: Don't crash when initializing pointer-to-member fields in bases
David Majnemer [Sun, 28 Sep 2014 06:39:30 +0000 (06:39 +0000)]
CodeGen: Don't crash when initializing pointer-to-member fields in bases

Clang uses two types to talk about a C++ class, the
NonVirtualBaseLLVMType and the LLVMType.  Previously, we would allow one
of these to be packed and the other not.

This is problematic.  If both don't agree on a common subset of fields,
then routines like getLLVMFieldNo will point to the wrong field.  Solve
this by copying the 'packed'-ness of the complete type to the
non-virtual subobject.  For this to work, we need to take into account
the non-virtual subobject's size and alignment when we are computing the
layout of the complete object.

This fixes PR21089.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218577 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd back checking for condition of conditional operator for -Wuninitialized
Richard Trieu [Fri, 26 Sep 2014 23:48:30 +0000 (23:48 +0000)]
Add back checking for condition of conditional operator for -Wuninitialized

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218556 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoEnsure that all module build failures get diagnosed
Ben Langmuir [Fri, 26 Sep 2014 22:42:23 +0000 (22:42 +0000)]
Ensure that all module build failures get diagnosed

Otherwise we can end up silently skipping an import.  If we happen to be
building another module at the time, we may build a mysteriously broken
module and not know why it seems to be missing symbols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218552 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't link in sanitizer runtimes if -nostdlib/-nodefaultlibs is provided.
Alexey Samsonov [Fri, 26 Sep 2014 21:22:08 +0000 (21:22 +0000)]
Don't link in sanitizer runtimes if -nostdlib/-nodefaultlibs is provided.

It makes no sense to link in sanitizer runtimes in this case: the user
probably doesn't want to see any system/toolchain libs in his link if he
provides these flags, and the link will most likely fail anyway - as sanitizer
runtimes depend on libpthread, libdl, libc etc.

Also, see discussion in https://code.google.com/p/address-sanitizer/issues/detail?id=344

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218541 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix an assertion failure trying to emit a trivial destructor in ObjC++
Ben Langmuir [Fri, 26 Sep 2014 15:27:29 +0000 (15:27 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218520 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang/test/CodeGen/builtin-assume-aligned.c: Fix for -Asserts.
NAKAMURA Takumi [Fri, 26 Sep 2014 09:37:15 +0000 (09:37 +0000)]
clang/test/CodeGen/builtin-assume-aligned.c: Fix for -Asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218507 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Assert that vftables should have a non-RTTI entry
David Majnemer [Fri, 26 Sep 2014 08:07:55 +0000 (08:07 +0000)]
MS ABI: Assert that vftables should have a non-RTTI entry

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218506 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSmall fix for bug 18635.
Alexander Musman [Fri, 26 Sep 2014 06:28:25 +0000 (06:28 +0000)]
Small fix for bug 18635.
(clang crashed in CodeGen in llvm::Module::getNamedValue on
 thread_local std::unique_ptr<int>).
Differential Revision: http://reviews.llvm.org/D5353

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218503 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSupport the assume_aligned function attribute
Hal Finkel [Fri, 26 Sep 2014 05:04:30 +0000 (05:04 +0000)]
Support the assume_aligned function attribute

In addition to __builtin_assume_aligned, GCC also supports an assume_aligned
attribute which specifies the alignment (and optional offset) of a function's
return value. Here we implement support for the assume_aligned attribute by making
use of the @llvm.assume intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218500 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCGBuiltin: Use frem instruction rather than libcall to implement fmod
Jan Vesely [Fri, 26 Sep 2014 01:19:41 +0000 (01:19 +0000)]
CGBuiltin: Use frem instruction rather than libcall to implement fmod

AFAICT the semantics of frem match libm's fmod.

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <tom@stellard.net>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218488 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago-ms-extensions: Implement __super scope specifier (PR13236).
Nikola Smiljanic [Fri, 26 Sep 2014 00:28:20 +0000 (00:28 +0000)]
-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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218484 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix PR20886 - enforce CUDA target match in method calls
Eli Bendersky [Thu, 25 Sep 2014 23:59:08 +0000 (23:59 +0000)]
Fix PR20886 - enforce CUDA target match in method calls

http://reviews.llvm.org/D5298

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218482 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSuggest fix-it for missing '{' after base-clause
Ismail Pazarbasi [Thu, 25 Sep 2014 21:13:02 +0000 (21:13 +0000)]
Suggest fix-it for missing '{' after base-clause

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218468 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMove calls to ResolveExceptionSpec out of SetDeclDefaulted and into DefineImplicit*
Ben Langmuir [Thu, 25 Sep 2014 20:55:00 +0000 (20:55 +0000)]
Move calls to ResolveExceptionSpec out of SetDeclDefaulted and into DefineImplicit*

This fixes an assertion failure in CodeGen where we were not resolving
an exception specification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218466 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Avoid hashing back reference keys in mangler
David Majnemer [Thu, 25 Sep 2014 19:43:56 +0000 (19:43 +0000)]
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é.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218461 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd increment/decrement operators and compound assignment operators to the
Richard Trieu [Thu, 25 Sep 2014 01:15:40 +0000 (01:15 +0000)]
Add increment/decrement operators and compound assignment operators to the
uninitialized checkers that did not have them before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218435 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix handling of preincrement on bit-fields. This gives a bit-field in C++, but
Richard Smith [Wed, 24 Sep 2014 23:55:00 +0000 (23:55 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218428 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoThread Safety Analysis: Update to documentation.
DeLesley Hutchins [Wed, 24 Sep 2014 22:13:34 +0000 (22:13 +0000)]
Thread Safety Analysis:  Update to documentation.

The attribute documentation now conforms to Aaron Ballman's renaming of the
thread safety attributes, as well as the new paper that is due to be published
in the conference on Source Code Analysis and Manipulation (SCAM 2014) later
this week.  In addition, recent changes to the analysis, such as checking
of references and negative capabilities, are now documented.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218420 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agopass environment when invoking llvm-config and clang from lit.cfg
Scott Douglass [Wed, 24 Sep 2014 18:37:52 +0000 (18:37 +0000)]
pass environment when invoking llvm-config and clang from lit.cfg

Use the same environment when invoking llvm-config from lit.cfg as
will be used when running tests, so that ASAN_OPTIONS, INCLUDE, etc.
are present.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218404 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSimplify tests.
Nico Weber [Wed, 24 Sep 2014 18:25:54 +0000 (18:25 +0000)]
Simplify tests.

This reverts bits of r218166 that are no longer necessary now that r218394 made
-Wmissing-prototype-for-cc a regular warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218400 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDowngrade error about stdcall decls with no prototype to a warning
Reid Kleckner [Wed, 24 Sep 2014 17:49:24 +0000 (17:49 +0000)]
Downgrade error about stdcall decls with no prototype to a warning

Fixes PR21027.  The MIDL compiler produces code that does this.

If we wanted to improve the warning, I think we could do this:
  void __stdcall f(); // Don't warn without -Wstrict-prototypes.
  void g() {
    f(); // Might warn, the user probably meant for f to take no args.
    f(1, 2, 3); // Warn, we have no idea what args f takes.
    f(1); // Error, this is insane, one of these calls is broken.
  }

Reviewers: thakis

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218394 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Don't let -style=Chromium imply c++03 template formatting.
Nico Weber [Wed, 24 Sep 2014 17:17:32 +0000 (17:17 +0000)]
clang-format: Don't let -style=Chromium imply c++03 template formatting.

Chromium's now using some c++11 language features, so it's now fine that
clang-format produces vector<vector<int>>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218392 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInclude debug info for types referenced only via explicit cast expressions.
David Blaikie [Wed, 24 Sep 2014 17:01:27 +0000 (17:01 +0000)]
Include debug info for types referenced only via explicit cast expressions.

Most of the debug info emission is powered essentially from function
definitions - if we emit the definition of a function, we emit the types
of its parameters, the members of those types, and so on and so forth.

For types that aren't referenced even indirectly due to this - because
they only appear in temporary expressions, not in any named variable, we
need to explicitly emit/add them as is done here. This is not the only
case of such code, and we might want to consider handling "void
func(void*); ... func(new T());" (currently debug info for T is not
emitted) at some point, though GCC doesn't. There's a much broader
solution to these issues, but it's a lot of work for possibly marginal
gain (but might help us improve the default -fno-standalone-debug
behavior to be even more aggressive in some places). See the original
review thread for more details.

Patch by jyoti allur (jyoti.yalamanchili@gmail.com)!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218390 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoConstify a functor's function call operator because it can/should be.
David Blaikie [Wed, 24 Sep 2014 16:35:29 +0000 (16:35 +0000)]
Constify a functor's function call operator because it can/should be.

Patch by Graham Lee (graham@iamleeg.com)!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218385 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPatch to allow mangling of microsoft’s __uuidof expression for the Itanium ABI
Fariborz Jahanian [Wed, 24 Sep 2014 16:28:40 +0000 (16:28 +0000)]
Patch to allow mangling of microsoft’s __uuidof expression for the Itanium ABI
when under -fms-extensions. Reviewed by John McCall.
//rdar://17784718

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218384 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoClean up ClangTool's argument adjuster handling a bit with unique_ptr.
Benjamin Kramer [Wed, 24 Sep 2014 11:47:42 +0000 (11:47 +0000)]
Clean up ClangTool's argument adjuster handling a bit with unique_ptr.

Make the dtor non-virtual while there. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218379 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSema: Inherit the flexible array property from struct fields
David Majnemer [Wed, 24 Sep 2014 11:04:09 +0000 (11:04 +0000)]
Sema: Inherit the flexible array property from struct fields

A record which contains a flexible array member is itself a flexible
array member.  A struct which contains such a record should also
consider itself to be a flexible array member.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218378 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] Fixed argument types in intrinsics:
Robert Khasanov [Wed, 24 Sep 2014 06:45:23 +0000 (06:45 +0000)]
[x86] Fixed argument types in intrinsics:
_addcarryx_u64
_addcarry_u64
_subborrow_u64

Thanks Pasi Parviainen for notice.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218376 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix the argument index error of __builtin___memccpy_chk
Steven Wu [Wed, 24 Sep 2014 04:37:33 +0000 (04:37 +0000)]
Fix the argument index error of __builtin___memccpy_chk

memccpy_check should have source and dest size at arg 3 and 4
rdar://18431336

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218367 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix an edge case with BinaryOperator's in -Wuninitialized. Add testcases for
Richard Trieu [Wed, 24 Sep 2014 03:53:56 +0000 (03:53 +0000)]
Fix an edge case with BinaryOperator's in -Wuninitialized.  Add testcases for
the other visitors as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218366 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFollow-up to r218292: Add more REVERTIBLE_TYPE_TRAITs.
Nico Weber [Wed, 24 Sep 2014 03:28:54 +0000 (03:28 +0000)]
Follow-up to r218292: Add more REVERTIBLE_TYPE_TRAITs.

r218292 reverted r197496 because it broke things. In addition to breaking
things, r197496 also made all traits starting with __is_ revertible.
Reinstantiate that part of r197496 because code out there (e.g. libc++) depends
on this behavior. Fixes PR21045.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218365 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Pure virtual functions don't contribute to vtordisps
David Majnemer [Tue, 23 Sep 2014 22:58:15 +0000 (22:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218340 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoImprove -Wuninitialized to take into account field ordering with initializer
Richard Trieu [Tue, 23 Sep 2014 22:52:42 +0000 (22:52 +0000)]
Improve -Wuninitialized to take into account field ordering with initializer
lists.  Since the fields are inititalized one at a time, using a field with
lower index to initialize a higher indexed field should not be warned on.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218339 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPR18793: If we try to EnterTokenStream when our current lexer is a caching
Richard Smith [Tue, 23 Sep 2014 21:05:52 +0000 (21:05 +0000)]
PR18793: If we try to EnterTokenStream when our current lexer is a caching
lexer, add the token buffer underneath the caching lexer where possible and
push the tokens directly into the caching lexer otherwise. We previously
put the lexer into a corrupted state where we could not guarantee to provide
the tokens in the right order and would sometimes assert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218333 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't perform ADL when looking up operator=; there is no non-member form of
Richard Smith [Tue, 23 Sep 2014 20:31:39 +0000 (20:31 +0000)]
Don't perform ADL when looking up operator=; there is no non-member form of
that function, and apart from being slow, this is unnecessary: ADL can trigger
instantiations that are not permitted here. The standard isn't *completely*
clear here, but this seems like the intent, and in any case this approach is
permitted by [temp.inst]p7.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218330 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Don't use comdats for initializers on platforms that don't support it"
Reid Kleckner [Tue, 23 Sep 2014 16:20:01 +0000 (16:20 +0000)]
Revert "Don't use comdats for initializers on platforms that don't support it"

On further investigation, COMDATs should work with .ctors, and the issue
I was hitting probably reproduces with .init_array.

This reverts commit r218287.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218313 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Parsing/Sema of directive omp parallel for simd
Alexander Musman [Tue, 23 Sep 2014 09:33:00 +0000 (09:33 +0000)]
[OPENMP] Parsing/Sema of directive omp parallel for simd

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218299 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Fix r218248's testcase to use -O1 instead of -O3.
Daniel Sanders [Tue, 23 Sep 2014 08:58:04 +0000 (08:58 +0000)]
[mips] Fix r218248's testcase to use -O1 instead of -O3.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218298 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReverting r214064 and r215650 while investigating a pesky performance regression
Artyom Skrobov [Tue, 23 Sep 2014 08:34:41 +0000 (08:34 +0000)]
Reverting r214064 and r215650 while investigating a pesky performance regression

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218296 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix a typo in comment in ASTBitCodes.h
Alexander Musman [Tue, 23 Sep 2014 05:23:29 +0000 (05:23 +0000)]
Fix a typo in comment in ASTBitCodes.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218294 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAST: Mangle cast expression encoding more accurately
David Majnemer [Tue, 23 Sep 2014 04:27:55 +0000 (04:27 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218293 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r197496, as it broke REVERTIBLE_TYPE_TRAITs from PCH files.
Nico Weber [Tue, 23 Sep 2014 04:09:56 +0000 (04:09 +0000)]
Revert r197496, as it broke REVERTIBLE_TYPE_TRAITs from PCH files.

Also add a test to make sure that this doesn't break again. Fixes PR21036.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218292 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAttempt to fix Sema/builtin-object-size.c after r218258
Hans Wennborg [Tue, 23 Sep 2014 00:02:36 +0000 (00:02 +0000)]
Attempt to fix Sema/builtin-object-size.c after r218258

The type of size_t varies between targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218288 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't use comdats for initializers on platforms that don't support it
Reid Kleckner [Tue, 23 Sep 2014 00:00:14 +0000 (00:00 +0000)]
Don't use comdats for initializers on platforms that don't support it

In particular, pre-.init_array ELF uses the .ctors section mechanism.
MinGW COFF also uses .ctors, now that I think about it. Therefore,
restrict this optimization to the two platforms that are currently known
to work: ELF with .init_array and COFF with .CRT$XCU.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218287 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix a vftable mangling bug
Reid Kleckner [Mon, 22 Sep 2014 23:14:46 +0000 (23:14 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218285 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoms-inline-asm: Add a test case for the usage of labels in bracket expressions
Ehsan Akhgari [Mon, 22 Sep 2014 20:41:39 +0000 (20:41 +0000)]
ms-inline-asm: Add a test case for the usage of labels in bracket expressions

Summary: This is a test for this patch: http://reviews.llvm.org/D5445.

Reviewers: rnk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218271 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Remove a FIXME that has been fixed
David Majnemer [Mon, 22 Sep 2014 20:39:37 +0000 (20:39 +0000)]
MS ABI: Remove a FIXME that has been fixed

We've implemented MSVC-style RTTI for quite some time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218269 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReturn true from UnifySection when emitting a diagnostic
Ehsan Akhgari [Mon, 22 Sep 2014 19:46:39 +0000 (19:46 +0000)]
Return true from UnifySection when emitting a diagnostic

Test Plan: I noticed this through code inspection.  The callers use the return value to remove the SectionAttr if a diagnostic is emitted, but I don't think the failure to do so is observable right now.

Reviewers: rnk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218265 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix test/CodeGen/mips-varargs.c to use %clang_cc1
Kaelyn Takata [Mon, 22 Sep 2014 18:06:01 +0000 (18:06 +0000)]
Fix test/CodeGen/mips-varargs.c to use %clang_cc1

Only tests under test/Driver should use %clang, and test/CodeGen in
particular must always use %clang_cc1.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218260 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix evatuated value of __builtin_object_size according to its
Fariborz Jahanian [Mon, 22 Sep 2014 17:11:59 +0000 (17:11 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218258 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang/test/CodeGen/mips-varargs.c: Fixup for -Asserts.
NAKAMURA Takumi [Mon, 22 Sep 2014 16:40:05 +0000 (16:40 +0000)]
clang/test/CodeGen/mips-varargs.c: Fixup for -Asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218256 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Correct alignment of vectors passed in varargs for the O32 ABI.
Daniel Sanders [Mon, 22 Sep 2014 13:27:06 +0000 (13:27 +0000)]
[mips] Correct alignment of vectors passed in varargs for the O32 ABI.

Summary:
Vectors are normally 16-byte aligned, however the O32 ABI enforces a
maximum alignment of 8-bytes since the base of the stack is 8-byte aligned.
Previously, this was enforced on the caller side, but not on the callee side.

This fixes the output of OpenCL's printf when given vectors.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits, pekka.jaaskelainen

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218248 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoremoved unicode symbols from comments.
Alexey Bataev [Mon, 22 Sep 2014 12:32:31 +0000 (12:32 +0000)]
removed unicode symbols from comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218244 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Codegen for 'omp critical' directive.
Alexey Bataev [Mon, 22 Sep 2014 10:01:53 +0000 (10:01 +0000)]
[OPENMP] Codegen for 'omp critical' directive.
This patch adds codegen for constructs:
#pragma omp critical [name]
<body>

It generates global variable ".gomp_critical_user_[name].var" of type int32[8]. Then it generates library call "kmpc_critical(loc, gtid, .gomp_critical_user_[name].var)", code for <body> statement and final call "kmpc_end_critical(loc, gtid, .gomp_critical_user_[name].var)".
Differential Revision: http://reviews.llvm.org/D5202

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218239 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd some documentation stating that the memory allocated by the ASTContext.h placemen...
Ehsan Akhgari [Mon, 22 Sep 2014 02:26:17 +0000 (02:26 +0000)]
Add some documentation stating that the memory allocated by the ASTContext.h placement new does not need to be explicitly freed

Reviewers: rnk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218232 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoms-inline-asm: Scope inline asm labels to functions
Ehsan Akhgari [Mon, 22 Sep 2014 02:21:54 +0000 (02:21 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218230 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix bugs in cpuid.h.
Akira Hatanaka [Sat, 20 Sep 2014 01:31:09 +0000 (01:31 +0000)]
Fix bugs in cpuid.h.

This commit makes two changes:

- Remove the push and pop instructions that were saving and restoring %ebx
  before and after cpuid in 32-bit pic mode. We were doing this to ensure we
  don't lose the GOT address in pic register %ebx, but this isn't necessary
  because the GOT address is kept in a virtual register.

- In 64-bit mode, preserve base register %rbx around cpuid.

This fixes PR20311 and rdar://problem/17686779.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218173 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFollow-up to r214408: Warn on other callee-cleanup functions without prototype too.
Nico Weber [Fri, 19 Sep 2014 23:07:12 +0000 (23:07 +0000)]
Follow-up to r214408: Warn on other callee-cleanup functions without prototype too.

According to lore, we used to verifier-fail on:

  void __thiscall f();
  int main() { f(1); }

So that's fixed now. System headers use prototype-less __stdcall functions,
so make that a warning that's DefaultError -- then it fires on regular code
but is suppressed in system headers.

Since it's used in system headers, we have codegen tests for this; massage
them slightly so that they still compile.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218166 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix ctor/dtor aliases losing 'dllexport' (for Itanium ABI)
Dario Domizioli [Fri, 19 Sep 2014 22:06:24 +0000 (22:06 +0000)]
Fix ctor/dtor aliases losing 'dllexport' (for Itanium ABI)

This patch makes sure that the dllexport attribute is transferred to the alias when such alias is created. It only affects the Itanium ABI because for the MSVC ABI a workaround is in place to not generate aliases of dllexport ctors/dtors.
A new CodeGenModule function is provided, CodeGenModule::setAliasAttributes, to factor the code for transferring attributes to aliases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218159 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoIn the Itanium ABI, move stuff to the comdat of variables with static init.
Rafael Espindola [Fri, 19 Sep 2014 19:43:18 +0000 (19:43 +0000)]
In the Itanium ABI, move stuff to the comdat of variables with static init.

Clang can already handle

-------------------------------------------
struct S {
  static const int x;
};
template<typename T> struct U {
  static const int k;
};
template<typename T> const int U<T>::k = T::x;

const int S::x = 42;
extern const int *f();
const int *g() { return &U<S>::k; }
int main() {
  return *f() + U<S>::k;
}

const int *f() { return &U<S>::k; }
-------------------------------------------

since r217264 which puts the .inint_array section in the same COMDAT
as the variable.

This patch allows the linker to more easily delete some dead code and data by
putting the guard variable and init function in the same COMDAT.

This is a fixed version of r218089.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218141 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilence MSVC warnings from r218127 about not returning a value
Reid Kleckner [Fri, 19 Sep 2014 16:20:24 +0000 (16:20 +0000)]
Silence MSVC warnings from r218127 about not returning a value

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218128 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMake DynTypedNode have the dynamic type of the object, instead of its static type.
Samuel Benzaquen [Fri, 19 Sep 2014 16:10:03 +0000 (16:10 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218127 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilence a signed/unsigned mismatch warning from MSVC; NFC.
Aaron Ballman [Fri, 19 Sep 2014 12:21:56 +0000 (12:21 +0000)]
Silence a signed/unsigned mismatch warning from MSVC; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218121 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: [JS] add space before operator 'in'.
Daniel Jasper [Fri, 19 Sep 2014 10:48:15 +0000 (10:48 +0000)]
clang-format: [JS] add space before operator 'in'.

Before:
  return ('aaa')in bbbb;

After:
  return ('aaa') in bbbb;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218119 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] Add _addcarry_u{32|64} and _subborrow_u{32|64}.
Robert Khasanov [Fri, 19 Sep 2014 10:29:22 +0000 (10:29 +0000)]
[x86] Add _addcarry_u{32|64} and _subborrow_u{32|64}.
They are added to adxintrin.h but outside __ADX__ block.
These intrinics generates adc and sbb correspondingly that were available before ADX

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218118 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] Added _addcarryx_u32, _addcarryx_u64 intrinsics
Robert Khasanov [Fri, 19 Sep 2014 10:17:06 +0000 (10:17 +0000)]
[x86] Added _addcarryx_u32, _addcarryx_u64 intrinsics

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218117 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] Enable broadwell target in clang.
Robert Khasanov [Fri, 19 Sep 2014 09:53:48 +0000 (09:53 +0000)]
[x86] Enable broadwell target in clang.
Added -madx option

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218116 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Prevent column layout if elements aren't uniform enough.
Daniel Jasper [Fri, 19 Sep 2014 08:28:43 +0000 (08:28 +0000)]
clang-format: Prevent column layout if elements aren't uniform enough.

This patch only considers the difference between the length of the
shortest and longest element, but we might want to look at other
features (token count, etc.) in future.

Before:
  std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{
      aaaaaaa,      aaaaaaaaaa,
      aaaaa,        aaaaaaaaaaaaaaa,
      aaa,          aaaaaaaaaa,
      a,            aaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa,
      aaaaaaa,      a};

After:
  std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{
      aaaaaaaaaaaaaaaaa, aaaaa, aaaaaaaaaaaaaaa, aaa, aaaaaaaaaa, a,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaa, a};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218111 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Initial parsing/sema analysis of 'target' directive.
Alexey Bataev [Fri, 19 Sep 2014 08:19:49 +0000 (08:19 +0000)]
[OPENMP] Initial parsing/sema analysis of 'target' directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218110 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Undo r216377.
Daniel Jasper [Fri, 19 Sep 2014 08:01:25 +0000 (08:01 +0000)]
clang-format: Undo r216377.

It has proven to not be a food idea in many case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218107 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't use the third field of llvm.global_ctors for MachO.
Rafael Espindola [Fri, 19 Sep 2014 01:54:22 +0000 (01:54 +0000)]
Don't use the third field of llvm.global_ctors for MachO.

The field is defined as:

If the third field is present, non-null, and points to a global variable or function, the initializer function will only run if the associated data from the current module is not discarded.

And without COMDATs we can't implement that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218097 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Put more stuff in the comdat used for variables with static init."
Rafael Espindola [Fri, 19 Sep 2014 01:28:16 +0000 (01:28 +0000)]
Revert "Put more stuff in the comdat used for variables with static init."

This reverts commit r218089.
It looks like it was causing issues on COFF.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218094 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPut more stuff in the comdat used for variables with static init.
Rafael Espindola [Thu, 18 Sep 2014 23:41:44 +0000 (23:41 +0000)]
Put more stuff in the comdat used for variables with static init.

Clang can already handle

-------------------------------------------
struct S {
  static const int x;
};
template<typename T> struct U {
  static const int k;
};
template<typename T> const int U<T>::k = T::x;

const int S::x = 42;
extern const int *f();
const int *g() { return &U<S>::k; }
int main() {
  return *f() + U<S>::k;
}

const int *f() { return &U<S>::k; }
-------------------------------------------

since r217264 which puts the .inint_array section in the same COMDAT
as the variable.

This patch allows the linker to more easily delete some dead code and data by
putting the guard variable and init function in the same COMDAT.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218089 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoThread Safety Analysis: add new warning flag, -Wthread-safety-reference, which
DeLesley Hutchins [Thu, 18 Sep 2014 23:02:26 +0000 (23:02 +0000)]
Thread Safety Analysis: add new warning flag, -Wthread-safety-reference, which
warns when a guarded variable is passed by reference as a function argument.
This is released as a separate warning flag, because it could potentially
break existing code that uses thread safety analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218087 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Don't ICE for pointers to pointers to members of incomplete classes
David Majnemer [Thu, 18 Sep 2014 22:05:54 +0000 (22:05 +0000)]
MS ABI: Don't ICE for pointers to pointers to members of incomplete classes

CodeGen would try to come up with an LLVM IR type for a pointer to
member type on the way to forming an LLVM IR type for a pointer to
pointer to member type.

However, if the pointer to member representation has not been locked in yet,
we would not be able to come up with a pointer to member IR type.

In these cases, make the pointer to member type an incomplete type.
This will make the pointer to pointer to member type a pointer to an
incomplete type.  If the class eventually obtains an inheritance model,
we will make the pointer to member type represent the actual inheritance
model.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218084 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86, inlineasm] Do not allow using constraint 'x' for a variable larger than
Akira Hatanaka [Thu, 18 Sep 2014 21:58:54 +0000 (21:58 +0000)]
[X86, inlineasm] Do not allow using constraint 'x' for a variable larger than
128-bit unless the target CPU supports AVX.

rdar://problem/11846140

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218082 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86, inline-asm] Allow 256-bit wide operands for the 'x' constraints
Hans Wennborg [Thu, 18 Sep 2014 20:24:04 +0000 (20:24 +0000)]
[X86, inline-asm] Allow 256-bit wide operands for the 'x' constraints

The 'x' constraint is for "any SSE register", and GCC seems to include the
256-bit ymm registers in that concept.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218073 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86, inlineasm] Check that the output size is correct for the given constraint.
Akira Hatanaka [Thu, 18 Sep 2014 18:17:18 +0000 (18:17 +0000)]
[X86, inlineasm] Check that the output size is correct for the given constraint.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218064 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPatch to check at compile time for overflow when
Fariborz Jahanian [Thu, 18 Sep 2014 17:58:27 +0000 (17:58 +0000)]
Patch to check at compile time for overflow when
__builtin___memcpy_chk and similar builtins are
being used. Patch by Jacques Fortier (with added
clang tests).  rdar://11076881

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218063 91177308-0d34-0410-b5e6-96231b3b80d8