]> granicus.if.org Git - clang/log
clang
9 years agoAdd a dump function to Stmt that takes only an output stream. No functionality change.
Faisal Vali [Sun, 22 Mar 2015 13:35:56 +0000 (13:35 +0000)]
Add a dump function to Stmt that takes only an output stream.  No functionality change.

This allows dumping to any given output stream but without requiring a SourceManager, similar to the interface provided by Decl.

It's useful when writing certain generic debug functions, external to the clang code base (for e.g.).

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

9 years agoRemove empty files left behind by r232907.
Benjamin Kramer [Sun, 22 Mar 2015 10:08:31 +0000 (10:08 +0000)]
Remove empty files left behind by r232907.

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

9 years agoReverting 232853 and 232870 because they depend on 232793,
Vince Harron [Sun, 22 Mar 2015 08:47:07 +0000 (08:47 +0000)]
Reverting 232853 and 232870 because they depend on 232793,
which was reverted because it was causing LLDB test failures

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

9 years agoMS ABI: Implement driver-level support for thread-safe statics
David Majnemer [Sun, 22 Mar 2015 08:39:22 +0000 (08:39 +0000)]
MS ABI: Implement driver-level support for thread-safe statics

Decide whether or not to use thread-safe statics depending on whether or
not we have an explicit request from the driver.  If we don't have an
explicit request, infer which behavior to use depending on the
compatibility version we are targeting.

N.B. CodeGen support is still ongoing.

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

9 years agoReverting r232793 until some new LLDB failures are discussed
Vince Harron [Sun, 22 Mar 2015 05:59:59 +0000 (05:59 +0000)]
Reverting r232793 until some new LLDB failures are discussed

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

9 years ago-Wdynamic-class-memaccess: Also warn about array types.
Nico Weber [Sat, 21 Mar 2015 17:56:44 +0000 (17:56 +0000)]
-Wdynamic-class-memaccess: Also warn about array types.

It looks like not warning on this was an oversight in the original
implementation of this warning.

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

9 years agoDedent code for -Wdynamic-class-memaccess warning. No behavior change.
Nico Weber [Sat, 21 Mar 2015 17:37:46 +0000 (17:37 +0000)]
Dedent code for -Wdynamic-class-memaccess warning. No behavior change.

The diff looks intimidating, but this just moves the -Wdynamic-class-memaccess
code out a scope, protected by a

    if (PointeeTy == QualType())
      continue;

check so that it still only runs when it should.

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

9 years agoSmall test fix for r232890
Alexander Musman [Sat, 21 Mar 2015 11:49:27 +0000 (11:49 +0000)]
Small test fix for r232890

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

9 years ago[OPENMP] CodeGen of the 'linear' clause for the 'omp simd' directive.
Alexander Musman [Sat, 21 Mar 2015 10:12:56 +0000 (10:12 +0000)]
[OPENMP] CodeGen of the 'linear' clause for the 'omp simd' directive.
The linear variable is privatized (similar to 'private') and its
value on current iteration is calculated, similar to the loop
counter variables.
Differential revision: http://reviews.llvm.org/D8375

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

9 years agoAdd CodeGen support for adding cpu attributes on functions based on
Eric Christopher [Sat, 21 Mar 2015 06:15:15 +0000 (06:15 +0000)]
Add CodeGen support for adding cpu attributes on functions based on
the target-cpu, if different from the triple's cpu, and
target-features as they're written that are passed down from the
driver.

Together with LLVM r232885 this should allow the LTO'ing of binaries
that contain modules compiled with different code generation options
on a subset of architectures with full backend support (x86, powerpc,
aarch64).

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

9 years ago[modules] When either redecl chain merging or an update record causes us to
Richard Smith [Sat, 21 Mar 2015 00:58:54 +0000 (00:58 +0000)]
[modules] When either redecl chain merging or an update record causes us to
give an exception specification to a declaration that didn't have an exception
specification in any of our imported modules, emit an update record ourselves.
Without this, code importing the current module would not see an exception
specification that we could see and might have relied on.

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

9 years agoOnly add -fno-rtti if KernelOrKext or in C++ mode.
Filipe Cabecinhas [Fri, 20 Mar 2015 23:51:15 +0000 (23:51 +0000)]
Only add -fno-rtti if KernelOrKext or in C++ mode.

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

9 years agoDon't claim exception related arguments when looking at RTTIMode
Filipe Cabecinhas [Fri, 20 Mar 2015 23:33:23 +0000 (23:33 +0000)]
Don't claim exception related arguments when looking at RTTIMode

Summary:
We were claiming the -f*exceptions arguments when looking for the
RTTIMode. This makes us not warn about unused arguments if compiling a C
file with -fcxx-exceptions.

This patch fixes it by not claiming the exception-related arguments at
that point.

Reviewers: rsmith, samsonov

Subscribers: cfe-commits

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

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

9 years agofixed vperm2* intrinsics to check for shuffles
Sanjay Patel [Fri, 20 Mar 2015 22:37:20 +0000 (22:37 +0000)]
fixed vperm2* intrinsics to check for shuffles

This corresponds to llvm r232852:
http://reviews.llvm.org/rL232852

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

9 years ago[modules] Remove temporary IdentifierInfo lookup results when we're done with them.
Richard Smith [Fri, 20 Mar 2015 21:56:50 +0000 (21:56 +0000)]
[modules] Remove temporary IdentifierInfo lookup results when we're done with them.

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

9 years ago[analyzer] RetainCountChecker: Don't assume +0 for ivars backing readonly properties.
Jordan Rose [Fri, 20 Mar 2015 21:12:27 +0000 (21:12 +0000)]
[analyzer] RetainCountChecker: Don't assume +0 for ivars backing readonly properties.

Similarly, don't assume +0 if the property's setter is manually implemented.
In both cases, if the property's ownership is explicitly written, then we /do/
assume the ivar has the same ownership.

rdar://problem/20218183

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

9 years agoUpdate for llvm api change.
Rafael Espindola [Fri, 20 Mar 2015 20:00:30 +0000 (20:00 +0000)]
Update for llvm api change.

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

9 years ago[UBSan] Don't allow to use UBSan with anything except for ASan.
Alexey Samsonov [Fri, 20 Mar 2015 18:45:06 +0000 (18:45 +0000)]
[UBSan] Don't allow to use UBSan with anything except for ASan.

We are not able to make a reliable solution for using UBSan together
with other sanitizers with runtime support (and sanitizer_common).
Instead, we want to follow the path used for LSan: have a "standalone"
UBSan tool, and plug-in UBSan that would be explicitly embedded into
specific sanitizers (in short term, it will be only ASan).

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

9 years agoMS ABI: Accept calls to an unprototyped declaration of _setjmp
David Majnemer [Fri, 20 Mar 2015 17:03:35 +0000 (17:03 +0000)]
MS ABI: Accept calls to an unprototyped declaration of _setjmp

This fixes PR22961.

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

9 years ago[MSVC] Explicit specializations can be declared in any namespace (fix for http:/...
Alexey Bataev [Fri, 20 Mar 2015 07:21:46 +0000 (07:21 +0000)]
[MSVC] Explicit specializations can be declared in any namespace (fix for http://llvm.org/PR13738)

MS compiler emits no errors in case of explicit specializations outside declaration enclosing namespaces, even when language extensions are disabled.
The patch is to suppress errors and emit extension warnings if explicit specializations are not declared in the corresponding namespaces.
This fixes PR13738.

Patch by Alexey Frolov.

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

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

9 years agoInstrProf: Make profile variables private to reduce binary size overhead
Justin Bogner [Fri, 20 Mar 2015 06:34:38 +0000 (06:34 +0000)]
InstrProf: Make profile variables private to reduce binary size overhead

When we instrument a program for profiling, we copy the linkage of an
instrumented function so that our datastructures merge in the same way
as the function. This avoids redundant copies for things like
linkonce, but ends up emitting names we never need to reference for
normal and internal symbols. Promoting internal and external linkage
to private for these variables reduces the size overhead of profiling
drastically.

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

9 years ago[modules] Remove some redundant work when building a lookup table for a DeclContext.
Richard Smith [Fri, 20 Mar 2015 02:17:21 +0000 (02:17 +0000)]
[modules] Remove some redundant work when building a lookup table for a DeclContext.

When we need to build the lookup table for a DeclContext, we used to pull in
all lexical declarations for the context; instead, just build a lookup table
for the local lexical declarations. We previously didn't guarantee that the
imported declarations would be in the returned map, but in some cases we'd
happen to put them all in there regardless. Now we're even lazier about this.

This unnecessary work was papering over some other bugs:

 - LookupVisibleDecls would use the DC for name lookups in the TU in C, and
   this was not guaranteed to find all imported names (generally, the DC for
   the TU in C is not a reliable place to perform lookups). We now use an
   identifier-based lookup mechanism for this.

 - We didn't actually load in the list of eagerly-deserialized declarations
   when importing a module (so external definitions in a module wouldn't be
   emitted by users of those modules unless they happened to be deserialized
   by the user of the module).

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

9 years agoDebugInfo: Check for null before using DIType
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 00:53:40 +0000 (00:53 +0000)]
DebugInfo: Check for null before using DIType

A WIP patch to turn on stricter `DIDescriptor` accessor checks fires
here; it's obvious from the code that `T` can be null, so add an
explicit check.  Caught by dozens of current testcases.

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

9 years agoC++14: Disable sized deallocation by default due to ABI breakage
Reid Kleckner [Fri, 20 Mar 2015 00:31:07 +0000 (00:31 +0000)]
C++14: Disable sized deallocation by default due to ABI breakage

There are no widely deployed standard libraries providing sized
deallocation functions, so we have to punt and ask the user if they want
us to use sized deallocation. In the future, when such libraries are
deployed, we can teach the driver to detect them and enable this
feature.

N3536 claimed that a weak thunk from sized to unsized deallocation could
be emitted to avoid breaking backwards compatibility with standard
libraries not providing sized deallocation. However, this approach and
other variations don't work in practice.

With the weak function approach, the thunk has to have default
visibility in order to ensure that it is overridden by other DSOs
providing sized deallocation. Weak, default visibility symbols are
particularly expensive on MachO, so John McCall was considering
disabling this feature by default on Darwin. It also changes behavior
ELF linking behavior, causing certain otherwise unreferenced object
files from an archive to be pulled into the link.

Our second approach was to use an extern_weak function declaration and
do an inline conditional branch at the deletion call site. This doesn't
work because extern_weak only works on MachO if you have some archive
providing the default value of the extern_weak symbol. Arranging to
provide such an archive has the same challenges as providing the symbol
in the standard library. Not to mention that extern_weak doesn't really
work on COFF.

Reviewers: rsmith, rjmccall

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

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

9 years agoAllow -fsanitize-coverage with -fsanitize=dataflow
Kostya Serebryany [Fri, 20 Mar 2015 00:06:52 +0000 (00:06 +0000)]
Allow -fsanitize-coverage with -fsanitize=dataflow

Summary: Allow -fsanitize-coverage with -fsanitize=dataflow

Test Plan: check-clang

Reviewers: pcc

Reviewed By: pcc

Subscribers: cfe-commits

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

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

9 years agoDon't crash-on-valid when an inline function is friend of class template
David Majnemer [Fri, 20 Mar 2015 00:02:27 +0000 (00:02 +0000)]
Don't crash-on-valid when an inline function is friend of class template

We assumed that the most recent declaration of an inline function would
also be inline.  However, a more recent declaration can come from a
friend declaration in a class template that is instantiated at the
definition of the function.

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

9 years agoClang follow-up to LLVM r232772
Duncan P. N. Exon Smith [Thu, 19 Mar 2015 22:43:38 +0000 (22:43 +0000)]
Clang follow-up to LLVM r232772

-verify-di is dead! Long live -verify!

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

9 years ago[Modules] Implement __builtin_isinf_sign in Clang.
Chandler Carruth [Thu, 19 Mar 2015 22:39:51 +0000 (22:39 +0000)]
[Modules] Implement __builtin_isinf_sign in Clang.

Somehow, we never managed to implement this fully. We could constant
fold it like crazy, including constant folding complex arguments, etc.
But if you actually needed to generate code for it, error.

I've implemented it using the somewhat obvious lowering. Happy for
suggestions on a more clever way to lower this.

Now, what you might ask does this have to do with modules? Fun story. So
it turns out that libstdc++ actually uses __builtin_isinf_sign to
implement std::isinf when in C++98 mode, but only inside of a template.
So if we're lucky, and we never instantiate that, everything is good.
But once we try to instantiate that template function, we need this
builtin. All of my customers at least are using C++11 and so they never
hit this code path.

But what does that have to do with modules? Fun story. So it turns out
that with modules we actually observe a bunch of bugs in libstdc++ where
their <cmath> header clobbers things exposed by <math.h>. To fix these,
we have to provide global function definitions to replace the macros
that C99 would have used. And it turns out that ::isinf needs to be
implemented using the exact semantics used by the C++98 variant of
std::isinf. And so I started to fix this bug in libstdc++ and ceased to
be able to compile libstdc++ with Clang.

The yaks are legion.

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

9 years agoMS ABI: Implement the MSVC 2015 scheme for scope disambiguation
David Majnemer [Thu, 19 Mar 2015 21:54:30 +0000 (21:54 +0000)]
MS ABI: Implement the MSVC 2015 scheme for scope disambiguation

consider C++ that looks like:
  inline int &f(bool b) {
    if (b) {
      static int i;
      return i;
    }
    static int i;
    return i;
  }

Both 'i' variables must have distinct (and stable) names for linkage
purposes.  The MSVC 2013 ABI would number the variables using a count of
the number of scopes that have been created.  However, the final 'i'
returns to a scope that has already been created leading to a mangling
collision.

MSVC 2015 fixes this by giving the second 'i' the name it would have if
it were declared before the 'if'.  However, this results in ABI breakage
because the mangled name, in cases where there was no ambiguity, would
now be different.

We implement the new behavior and only enable it if we are targeting the
MSVC 2015 ABI, otherwise the old behavior will be used.

This fixes PR18131.

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

9 years agoCorrect typos in C11 generic-selection expressions.
Kaelyn Takata [Thu, 19 Mar 2015 20:56:07 +0000 (20:56 +0000)]
Correct typos in C11 generic-selection expressions.

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

9 years agoRemove unused diagnostic.
Benjamin Kramer [Thu, 19 Mar 2015 19:44:37 +0000 (19:44 +0000)]
Remove unused diagnostic.

Unused since r231851.

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

9 years agoAdd -Wpartial-availability.
Nico Weber [Thu, 19 Mar 2015 19:18:22 +0000 (19:18 +0000)]
Add -Wpartial-availability.

This warns when using decls that are not available on all deployment targets.
For example, a call to

  - (void)ppartialMethod __attribute__((availability(macosx,introduced=10.8)));

will warn if -mmacosx-version-min is set to less than 10.8.

To silence the warning, one has to explicitly redeclare the method like so:

  @interface Whatever(MountainLionAPI)
  - (void)ppartialMethod;
  @end

This way, one cannot accidentally call a function that isn't available
everywhere.  Having to add the redeclaration will hopefully remind the user
to add an explicit respondsToSelector: call as well.

Some projects build against old SDKs to get this effect, but building against
old SDKs suppresses some bug fixes -- see http://crbug.com/463171 for examples.
The hope is that SDK headers are annotated well enough with availability
attributes that new SDK + this warning offers the same amount of protection
as using an old SDK.

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

9 years agoRemove .CUDAIsDevice flags from CodeGenOpts as it's already
Artem Belevich [Thu, 19 Mar 2015 18:58:18 +0000 (18:58 +0000)]
Remove .CUDAIsDevice flags from CodeGenOpts as it's already
available in LangOpts.

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

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

9 years agoFix -ast-dump of dependent new and delete exprs
Reid Kleckner [Thu, 19 Mar 2015 18:47:47 +0000 (18:47 +0000)]
Fix -ast-dump of dependent new and delete exprs

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

9 years agoIgnore device-side asm constraint errors while compiling CUDA code for host and vice...
Artem Belevich [Thu, 19 Mar 2015 18:40:25 +0000 (18:40 +0000)]
Ignore device-side asm constraint errors while compiling CUDA code for host and vice versa.

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

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

9 years agoAdd -ast-dump support for new and delete expressions to help figure out which operato...
Reid Kleckner [Thu, 19 Mar 2015 18:09:25 +0000 (18:09 +0000)]
Add -ast-dump support for new and delete expressions to help figure out which operator got selected

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

9 years agoFix incremental linking with ninja and CMake 3.2+, see LLVM r232662 for details
Reid Kleckner [Thu, 19 Mar 2015 17:45:12 +0000 (17:45 +0000)]
Fix incremental linking with ninja and CMake 3.2+, see LLVM r232662 for details

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

9 years agoEnsure that we still parse preprocessed CUDA files as CUDA when we use
Artem Belevich [Thu, 19 Mar 2015 17:32:06 +0000 (17:32 +0000)]
Ensure that we still parse preprocessed CUDA files as CUDA when we use
-save-temps option.

Summary: Fixes PR22926.

Review: http://reviews.llvm.org/D8383

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

9 years agoRevert "Improvement on sized deallocation from r230160"
Reid Kleckner [Thu, 19 Mar 2015 17:03:58 +0000 (17:03 +0000)]
Revert "Improvement on sized deallocation from r230160"

This reverts commit r230580.

extern_weak functions don't appear to work on Darwin (PR22951), so we'll
need to come up with a new approach.

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

9 years agoDevirtualize Attr and all subclasses.
Benjamin Kramer [Thu, 19 Mar 2015 16:06:49 +0000 (16:06 +0000)]
Devirtualize Attr and all subclasses.

We know all subclasses in tblgen so just generate a giant switch for
the few virtual methods or turn them into a member variable using spare
bits. The giant jump tables aren't pretty but still much smaller than
a vtable for every attribute, shrinking Release+Asserts clang by ~400k.

Also halves the size of the Attr base class. No functional change
intended.

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

9 years agoMove ThreadSafetyReporter into an anonymous namespace. NFC.
Benjamin Kramer [Thu, 19 Mar 2015 14:23:45 +0000 (14:23 +0000)]
Move ThreadSafetyReporter into an anonymous namespace. NFC.

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

9 years agoAdd option to switch off putting header modules into the dependency file.
Manuel Klimek [Thu, 19 Mar 2015 12:00:22 +0000 (12:00 +0000)]
Add option to switch off putting header modules into the dependency file.

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

9 years agoclang-format: Fix another bug in wrapping around "*".
Daniel Jasper [Thu, 19 Mar 2015 09:40:16 +0000 (09:40 +0000)]
clang-format: Fix another bug in wrapping around "*".

Before:
  void aaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaaa) {} // even violation the column limit

After:
  void aaaaa(aaaaaaaaaaaa*
                 aaaaaaaaaaaaaa) {}

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

9 years ago[OPENMP] Fixed bug in codegen of 'atomic write'.
Alexey Bataev [Thu, 19 Mar 2015 08:44:10 +0000 (08:44 +0000)]
[OPENMP] Fixed bug in codegen of 'atomic write'.

Fixed codegen for exit/continue order after success/failed atomic cmpxchg instruction for 'atomic write' construct.

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

9 years agoParse: Don't assume tokens have a length
David Majnemer [Thu, 19 Mar 2015 00:10:23 +0000 (00:10 +0000)]
Parse: Don't assume tokens have a length

Don't crash if the last token in a bad inline method body is an
annotation token.

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

9 years agoMS ABI: Don't try to emit VF/VB-Tables for extern class templates
David Majnemer [Wed, 18 Mar 2015 22:04:43 +0000 (22:04 +0000)]
MS ABI: Don't try to emit VF/VB-Tables for extern class templates

There will be an explicit template instantiation in another translation
unit which will provide the definition of the VF/VB-Tables.

This fixes PR22932.

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

9 years agoWhen cloning LocalInstantiationScope's, don't update the current scope in Sema.
Richard Trieu [Wed, 18 Mar 2015 21:52:47 +0000 (21:52 +0000)]
When cloning LocalInstantiationScope's, don't update the current scope in Sema.

Construction of LocalInstantiationScope automatically updates the current scope
inside Sema.  However, when cloning a scope, the current scope does not change.
Change the cloning function to preserve the current scope.

Review: http://reviews.llvm.org/D8407
BUG: https://llvm.org/bugs/show_bug.cgi?id=22931

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

9 years agoAppease clang/test/Parser/opencl-atomics-cl20.cl for 32-bit targets with explicit...
NAKAMURA Takumi [Wed, 18 Mar 2015 15:07:54 +0000 (15:07 +0000)]
Appease clang/test/Parser/opencl-atomics-cl20.cl for 32-bit targets with explicit triple.

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

9 years agoclang-format: Fix bad wrapping after "*" introduced in r232044.
Daniel Jasper [Wed, 18 Mar 2015 14:20:13 +0000 (14:20 +0000)]
clang-format: Fix bad wrapping after "*" introduced in r232044.

Before:
  void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa*
                                              const aaaaaaaaaaaa) {}

After:
  void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaa* const aaaaaaaaaaaa) {}

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

9 years ago[clang-format] Add missing test for std::function<void( int, int )>
Daniel Jasper [Wed, 18 Mar 2015 12:59:19 +0000 (12:59 +0000)]
[clang-format] Add missing test for std::function<void( int, int )>
spacing also fixed by r230473.

The fix in r230473 was done to enable fixing the spacing for
  std::function<void( int, int )>.
I did not realized that it also fixed this
issue.  Since it is fairly different from
  Deleted &operator=(const Deleted &)& = default;
fixed in r230473, it seems sensible to add the regression test for it.

Also cleaned up the test by removing duplicated code and comment, and kept
repeated test set consistent.

Result of running the new tests with r230473 backed out:
  [ RUN      ] FormatTest.ConfigurableSpacesInParentheses
  Actual: "std::function<void(int, int)> callback;"
  Expected: "std::function<void( int, int )> callback;"
  Actual: "std::function<void( int, int )> callback;"
  Expected: "std::function<void(int, int)> callback;"
  Actual: "std::function<void( int, int ) > callback;"
  Expected: "std::function<void(int, int)> callback;"
  [  FAILED  ] FormatTest.ConfigurableSpacesInParentheses (402 ms)

Result of new tests with r230473:
  [ RUN      ] FormatTest.ConfigurableSpacesInParentheses
  [       OK ] FormatTest.ConfigurableSpacesInParentheses (209 ms)

Review: http://reviews.llvm.org/D7922

Patch by Jean-Philippe Dufraigne. Thanks!

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

9 years agoOpenCL: CL2.0 atomic types
Anastasia Stulova [Wed, 18 Mar 2015 12:55:29 +0000 (12:55 +0000)]
OpenCL: CL2.0 atomic types

OpenCL C Spec v2.0 Section 6.13.11

- Made c11 _Atomic being not accepted for OpenCL

- Implemented CL2.0 atomics by aliasing them to the corresponding c11 atomic types using implicit typedef

- Added diagnostics for atomics Khronos extension enabling

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

9 years agoFix another ternary Visual C++ is OK wiht but gcc not.
Yaron Keren [Wed, 18 Mar 2015 10:30:57 +0000 (10:30 +0000)]
Fix another ternary Visual C++ is OK wiht but gcc not.

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

9 years agoFix gcc ambiguity error (Visual C++ was OK with these).
Yaron Keren [Wed, 18 Mar 2015 10:26:22 +0000 (10:26 +0000)]
Fix gcc ambiguity error (Visual C++ was OK with these).

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

9 years agoRemove many superfluous SmallString::str() calls.
Yaron Keren [Wed, 18 Mar 2015 10:17:07 +0000 (10:17 +0000)]
Remove many superfluous SmallString::str() calls.

Now that SmallString is a first-class citizen, most SmallString::str()
calls are not required. This patch removes a whole bunch of them, yet
there are lots more.

There are two use cases where str() is really needed:
1) To use one of StringRef member functions which is not available in
SmallString.
2) To convert to std::string, as StringRef implicitly converts while
SmallString do not. We may wish to change this, but it may introduce
ambiguity.

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

9 years agoLex: Don't call getIdentifierInfo on annotation tokens
David Majnemer [Wed, 18 Mar 2015 07:53:20 +0000 (07:53 +0000)]
Lex: Don't call getIdentifierInfo on annotation tokens

These calls are usually guarded by checks for isAnnotation() but it
looks like we missed a spot.  This would cause the included test to
crash clang.

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

9 years agoMS ABI: Define _HAS_CHAR16_T_LANGUAGE_SUPPORT when appropriate
David Majnemer [Wed, 18 Mar 2015 07:53:18 +0000 (07:53 +0000)]
MS ABI: Define _HAS_CHAR16_T_LANGUAGE_SUPPORT when appropriate

If we are in MSVC 2015 compatibility mode and C++11 language conformance
is enabled, define _HAS_CHAR16_T_LANGUAGE_SUPPORT to 1.

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

9 years agoMSVC Compat: Permit char16_t, char32_t and _Atomic when targeting > 2013
David Majnemer [Wed, 18 Mar 2015 04:15:23 +0000 (04:15 +0000)]
MSVC Compat: Permit char16_t, char32_t and _Atomic when targeting > 2013

We disabled support for _Atomic because the STL had name conflicts,
they've been resolved in 2015.  Similarly, reenable char16_t and
char32_t.

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

9 years ago[OPENMP] Fix crash on code emitting if errors are found.
Alexey Bataev [Wed, 18 Mar 2015 04:13:55 +0000 (04:13 +0000)]
[OPENMP] Fix crash on code emitting if errors are found.

Codegen for threadprivate variables (and in some other cases) may cause crash of the compiler if some diagnostic is produced later. This happens because some of the autogenerated globals are not removed from InternalVars StringMap when llvm::Module is reset.
Differential Revision: http://reviews.llvm.org/D8360

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

9 years agoMS ABI: Empty pack expansions had their mangling changed in 2013->2015
David Majnemer [Wed, 18 Mar 2015 03:56:27 +0000 (03:56 +0000)]
MS ABI: Empty pack expansions had their mangling changed in 2013->2015

We used to support the 2013 mangling and changed it to the more
reasonable 2015 mangling.  Let's make the mangling conditional on what
version of MSVC is targeted.

This fixes PR21888.

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

9 years agoMake module files passed to a module build via -fmodule-file= available to
Richard Smith [Wed, 18 Mar 2015 01:42:29 +0000 (01:42 +0000)]
Make module files passed to a module build via -fmodule-file= available to
consumers of that module.

Previously, such a file would only be available if the module happened to
actually import something from that module.

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

9 years agoFix test in release mode. This reapplies r232456, corresponding to r232579.
NAKAMURA Takumi [Wed, 18 Mar 2015 01:41:58 +0000 (01:41 +0000)]
Fix test in release mode. This reapplies r232456, corresponding to r232579.

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

9 years agoFix the LLVM type used when lowering initializer list reference temporaries to global...
Nick Lewycky [Wed, 18 Mar 2015 01:06:24 +0000 (01:06 +0000)]
Fix the LLVM type used when lowering initializer list reference temporaries to global variables. Reapplies r232454 with fix for PR22940.

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

9 years agoBasic: Update clang to reflect changes made to LLVM datalayout
David Majnemer [Tue, 17 Mar 2015 23:55:00 +0000 (23:55 +0000)]
Basic: Update clang to reflect changes made to LLVM datalayout

We now give x86-64 COFF targets a different mangling code, update clang
to use it.

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

9 years agoFix a crash when the size of an 'auto' is needed and its initalizer
Kaelyn Takata [Tue, 17 Mar 2015 23:50:12 +0000 (23:50 +0000)]
Fix a crash when the size of an 'auto' is needed and its initalizer
contained a typo correction (the auto decl was being marked as dependent
unnecessarily, which triggered an assertion in cases where the size of
the type is needed).

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

9 years agoMS ABI: Fix a couple of -Winconsistent-missing-override warnings
Justin Bogner [Tue, 17 Mar 2015 22:31:34 +0000 (22:31 +0000)]
MS ABI: Fix a couple of -Winconsistent-missing-override warnings

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

9 years agoImply linker arguments from '-fveclib' option.
Michael Zolotukhin [Tue, 17 Mar 2015 22:13:05 +0000 (22:13 +0000)]
Imply linker arguments from '-fveclib' option.

Summary: As discussed in D8097, we should provide corresponding linking flags when 'fveclib' is specified.

Reviewers: hfinkel

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

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

9 years agoMS ABI: Build C++ default argument exprs for exported template classes
Reid Kleckner [Tue, 17 Mar 2015 21:51:43 +0000 (21:51 +0000)]
MS ABI: Build C++ default argument exprs for exported template classes

This was an omission from r232229.

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

9 years agoMS ABI: Emit HandlerMap entries for C++ catch
David Majnemer [Tue, 17 Mar 2015 20:35:05 +0000 (20:35 +0000)]
MS ABI: Emit HandlerMap entries for C++ catch

The HandlerMap describes, to the runtime, what sort of catches surround
the try.  In principle, this structure has to be emitted by the backend
because only it knows the layout of the stack (the runtime needs to know
where on the stack the destination of a copy lives, etc.) but there is
some C++ specific information that the backend can't reason about.

Stick this information in special LLVM globals with the relevant
"const", "volatile", "reference" info mangled into the name.

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

9 years agoWIP
David Majnemer [Tue, 17 Mar 2015 20:35:00 +0000 (20:35 +0000)]
WIP

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

9 years agoAdd fveclib option.
Michael Zolotukhin [Tue, 17 Mar 2015 20:03:11 +0000 (20:03 +0000)]
Add fveclib option.

Review: http://reviews.llvm.org/D8097

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

9 years agoMS ABI: Delay default constructor closure checking until the outermost class scope...
Reid Kleckner [Tue, 17 Mar 2015 19:00:50 +0000 (19:00 +0000)]
MS ABI: Delay default constructor closure checking until the outermost class scope ends

Previously, we would error out on this code because the default argument
wasn't parsed until the end of Outer:

  struct __declspec(dllexport) Outer {
    struct __declspec(dllexport) Inner {
      Inner(void *p = 0);
    };
  };

Now we do the checking on the closing brace of Outer instead of Inner.

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

9 years agoComment parsing: move a diagnostic to the correct group.
Dmitri Gribenko [Tue, 17 Mar 2015 18:03:42 +0000 (18:03 +0000)]
Comment parsing: move a diagnostic to the correct group.

Based on a patch by LE GARREC Vincent.

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

9 years agoRevert r232454 and r232456: "Fix the LLVM type used when lowering initializer list...
Hans Wennborg [Tue, 17 Mar 2015 16:38:58 +0000 (16:38 +0000)]
Revert r232454 and r232456: "Fix the LLVM type used when lowering initializer list reference temporaries to global variables."

This caused PR22940.

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

9 years ago[ARM] Add support for ARMV6K subtarget (Clang)
Renato Golin [Tue, 17 Mar 2015 11:55:43 +0000 (11:55 +0000)]
[ARM] Add support for ARMV6K subtarget (Clang)

ARMv6K is another layer between ARMV6 and ARMV6T2. This is the Clang
side of the changes.

ARMV6 family LLVM implementation.

+-------------------------------------+
| ARMV6                               |
+----------------+--------------------+
| ARMV6M (thumb) | ARMV6K (arm,thumb) | <- From ARMV6K and ARMV6M processors
+----------------+--------------------+    have support for hint instructions
| ARMV6T2 (arm,thumb,thumb2)          |    (SEV/WFE/WFI/NOP/YIELD). They can
+-------------------------------------+    be either real or default to NOP.
| ARMV7 (arm,thumb,thumb2)            |    The two processors also use
+-------------------------------------+    different encoding for them.

Patch by Vinicius Tinti.

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

9 years agoTeach Twine to support SmallString.
Yaron Keren [Tue, 17 Mar 2015 09:51:17 +0000 (09:51 +0000)]
Teach Twine to support SmallString.

Enable removing .str() member calls for these frequent cases.

 http://reviews.llvm.org/D6372

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

9 years agoFix test in release mode.
Nick Lewycky [Tue, 17 Mar 2015 02:31:46 +0000 (02:31 +0000)]
Fix test in release mode.

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

9 years ago[modules] Fix bug where an anonymous namespace could cause the containing
Richard Smith [Tue, 17 Mar 2015 02:23:11 +0000 (02:23 +0000)]
[modules] Fix bug where an anonymous namespace could cause the containing
namespace to not merge properly.

We have an invariant here: after a declaration reads its canonical declaration,
it can assume the canonical declaration is fully merged. This invariant can be
violated if deserializing some declaration triggers the deserialization of a
later declaration, because that later declaration can in turn deserialize a
redeclaration of that first declaration before it is fully merged.

The anonymous namespace for a namespace gets stored with the first declaration
of that namespace, which may be before its parent namespace, so defer loading
it until after we've finished merging the surrounding namespace.

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

9 years agoFix the LLVM type used when lowering initializer list reference temporaries to global...
Nick Lewycky [Tue, 17 Mar 2015 02:21:31 +0000 (02:21 +0000)]
Fix the LLVM type used when lowering initializer list reference temporaries to global variables.

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

9 years agoCodeGenCXX: Test that linetables work with variadic virtual thunks
Duncan P. N. Exon Smith [Tue, 17 Mar 2015 01:19:01 +0000 (01:19 +0000)]
CodeGenCXX: Test that linetables work with variadic virtual thunks

Add a frontend test for PR22929, which was fixed by LLVM r232449.
Besides the crash test, check that the `!dbg` attachment is sane since
its presence was the trigger.

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

9 years agoFix typo in previous commit
Justin Bogner [Tue, 17 Mar 2015 00:04:57 +0000 (00:04 +0000)]
Fix typo in previous commit

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

9 years agoGCOV: Expose the -coverage-exit-block-before-body flag in clang -cc1
Justin Bogner [Mon, 16 Mar 2015 23:52:21 +0000 (23:52 +0000)]
GCOV: Expose the -coverage-exit-block-before-body flag in clang -cc1

This exposes the optional exit block placement logic from r232438 as a
clang -cc1 option. There is a test on the llvm side, but there isn't
really a way to inspect the gcov options from clang to test it here as
well.

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

9 years agoUpdate for llvm API change.
Rafael Espindola [Mon, 16 Mar 2015 22:30:13 +0000 (22:30 +0000)]
Update for llvm API change.

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

9 years agoTake the non-reference type when constructing a dummy expression.
Richard Trieu [Mon, 16 Mar 2015 21:49:43 +0000 (21:49 +0000)]
Take the non-reference type when constructing a dummy expression.

Otherwise, Expr will assert during construction with a reference type.

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

9 years ago[modules] If we find more formerly-canonical declarations of an entity while
Richard Smith [Mon, 16 Mar 2015 20:54:07 +0000 (20:54 +0000)]
[modules] If we find more formerly-canonical declarations of an entity while
building its redecl chains, make sure we pull in the redeclarations of those
canonical declarations.

It's pretty difficult to reach a situation where we can find more canonical
declarations of an entity while building its redecl chains; I think the
provided testcase (4 modules and 7 declarations) cannot be reduced further.

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

9 years agoLambdaify some helper functions. No functionality change.
Richard Smith [Mon, 16 Mar 2015 20:11:03 +0000 (20:11 +0000)]
Lambdaify some helper functions. No functionality change.

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

9 years agoGlobal inline assembler blocks are merged before parsing, so no specific
Joerg Sonnenberger [Mon, 16 Mar 2015 17:54:54 +0000 (17:54 +0000)]
Global inline assembler blocks are merged before parsing, so no specific
location data is available. If pragma handling wants to look up the
position, it finds the LLVM buffer and wants to compare it with the
special built-in buffer, failing badly. Extend to the special handling
of the built-in buffer to also check for the inline asm buffer. Expect
only a single asm buffer. Sort it between the built-in buffers and the
normal file buffers.

Fixes the assert part of PR 22576.

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

9 years ago[clang] Replacing asserts with static_asserts where appropriate
Gabor Horvath [Mon, 16 Mar 2015 09:59:54 +0000 (09:59 +0000)]
[clang] Replacing asserts with static_asserts where appropriate

Summary: This patch consists of the suggestions of clang-tidy/misc-static-assert check.

Reviewers: alexfh

Subscribers: dblaikie, xazax.hun, cfe-commits

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

Patch by Szabolcs Sipos!

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

9 years ago[OPENMP] Enable codegen of the ‘private’ clause for ‘omp simd’ directive
Alexander Musman [Mon, 16 Mar 2015 07:14:41 +0000 (07:14 +0000)]
[OPENMP] Enable codegen of the ‘private’ clause for ‘omp simd’ directive

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

9 years agoSimpleArray: Provide reverse iteration via std::reverse_iterator.
Benjamin Kramer [Sun, 15 Mar 2015 18:47:26 +0000 (18:47 +0000)]
SimpleArray: Provide reverse iteration via std::reverse_iterator.

NFC intended.

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

9 years agoImplement PreprocessingRecord's and LazyVector's iterators on top of iterator_adaptor...
Benjamin Kramer [Sun, 15 Mar 2015 15:27:19 +0000 (15:27 +0000)]
Implement PreprocessingRecord's and LazyVector's iterators on top of iterator_adaptor_base

This basically creates a wrapper around an 'int' that poses as an iterator.
While that looks a bit counter-intuitive it works just fine because iterator
operations and basic integer arithmetic works in exactly the same way.

Remove the manual integer wrapping code and reduce the reliance on iterator
internals in the implementation. No functionality change intended.

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

9 years agoclang-format: [JS] support cast syntax and type arguments.
Daniel Jasper [Sun, 15 Mar 2015 13:59:51 +0000 (13:59 +0000)]
clang-format: [JS] support cast syntax and type arguments.

Casts in TS syntax (foo = <type>bar;) should not be followed by
whitespace.

Patch by Martin Probst. Thank you.

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

9 years agoclang-format: [JS] more precisely detect enums.
Daniel Jasper [Sun, 15 Mar 2015 13:55:54 +0000 (13:55 +0000)]
clang-format: [JS] more precisely detect enums.

The current enum detection is overly aggressive. As NestingLevel only
applies per line (?) it classifies many if not most object literals as
enum declarations and adds superfluous line breaks into them. This
change narrows the heuristic by requiring an assignment just before the
open brace and requiring the line to start with an identifier.

Patch by Martin Probst. Thank you.

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

9 years agoMS ABI: Don't use qualified pointee types for 'catch' EH TypeDescriptors
David Majnemer [Sun, 15 Mar 2015 07:10:01 +0000 (07:10 +0000)]
MS ABI: Don't use qualified pointee types for 'catch' EH TypeDescriptors

Qualifiers are located next to the TypeDescriptor in order to properly
ensure that a pointer type can only be caught by a more qualified catch
handler.  This means that a catch handler of type 'const int *' requires
an RTTI object for 'int *'.  We got this correct for 'throw' but not for
'catch'.

N.B.  We don't currently have the means to store the qualifiers because
LLVM's EH strategy is tailored to the Itanium scheme.  The Itanium ABI
stores qualifiers inside the type descriptor in such a way that the
manner of qualification is stored in addition to the pointee type's
descriptor.  Perhaps the best way of modeling this for the MS ABI is
using an aggregate type to bundle the qualifiers with the descriptor?
This is tricky because we want to make it clear to the optimization
passes which catch handlers invalidate other handlers.

My current thoughts on a design for this is along the lines of:
  { { TypeDescriptor* TD, i32 QualifierFlags }, i32 MiscFlags }

The idea is that the inner most aggregate is all that is needed to
communicate that one catch handler might supercede another.  The
'MiscFlags' field would be used to hold the bitpattern for the notion
that the 'catch' handler does not need to invoke a copy-constructor
because we are catching by reference.

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

9 years ago-Wempty-body: fix false negative triggered by macros
Dmitri Gribenko [Sun, 15 Mar 2015 01:08:23 +0000 (01:08 +0000)]
-Wempty-body: fix false negative triggered by macros

When if statement condition ended in a macro:

    if (ptr == NULL);

the check used to consider the definition location of NULL, instead of the
current line.

Patch by Manasij Mukherjee.

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

9 years agoMS ABI: Tidy up references to the ASTContext
David Majnemer [Sat, 14 Mar 2015 23:44:48 +0000 (23:44 +0000)]
MS ABI: Tidy up references to the ASTContext

CGCXXABI has a handy getContext() method.  Use that instead of
explicitly going through the CodeGenModule.

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

9 years agoCodeGen: Correctly initialize bitfields with non-constant initializers
David Majnemer [Sat, 14 Mar 2015 22:24:38 +0000 (22:24 +0000)]
CodeGen: Correctly initialize bitfields with non-constant initializers

It is possible to construct an initializer for a bitfield which is not
constant.  Instead of emitting code to initialize the field before the
execution of main, clang would crash.

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

9 years agoSort ObjCProtocolDecls with array_pod_sort.
Benjamin Kramer [Sat, 14 Mar 2015 13:32:49 +0000 (13:32 +0000)]
Sort ObjCProtocolDecls with array_pod_sort.

The predicate is essentially a string comparison. NFC.

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

9 years ago[analyzer] Sort path diagnostics with array_pod_sort.
Benjamin Kramer [Sat, 14 Mar 2015 12:39:22 +0000 (12:39 +0000)]
[analyzer] Sort path diagnostics with array_pod_sort.

They're expensive to compare and we won't sort many of them so std::sort
doesn't give any benefits and causes code bloat. Func fact: clang -O3 didn't
even bother to inline libc++'s std::sort here.

While there validate the predicate a bit harder, the sort is unstable and we
don't want to introduce any non-determinism. I had to spell out the function
pointer type because GCC 4.7 still fails to convert the lambda to a function
pointer :(

No intended functionality change.

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

9 years agoMS ABI: Mangle virtual member pointer thunks with the correct CC
David Majnemer [Sat, 14 Mar 2015 06:34:41 +0000 (06:34 +0000)]
MS ABI: Mangle virtual member pointer thunks with the correct CC

Virtual member pointers are implemented using a thunk.  We assumed that
the calling convention for this thunk was always __thiscall for 32-bit
targets and __cdecl for 64-bit targets.  However, this is not the case.
Mangle in whichever calling convention is appropriate for this member
function thunk.

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

9 years ago[modules] Teach the AST reader to handle the case of importing a module
Chandler Carruth [Sat, 14 Mar 2015 04:47:43 +0000 (04:47 +0000)]
[modules] Teach the AST reader to handle the case of importing a module
with a subset of the existing target CPU features or mismatched CPU
names.

While we can't check that the CPU name used to build the module will end
up being able to codegen correctly for the translation unit, we actually
check that the imported features are a subset of the existing features.

While here, rewrite the code to use std::set_difference and have it
diagnose all of the differences found.

Test case added which walks the set relationships and ensures we
diagnose all the right cases and accept the others.

No functional change for implicit modules here, just better diagnostics.

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