]> granicus.if.org Git - clang/log
clang
9 years ago[multilib] Teach Clang's code about multilib by threading
Chandler Carruth [Mon, 29 Dec 2014 12:09:08 +0000 (12:09 +0000)]
[multilib] Teach Clang's code about multilib by threading
a CLANG_LIBDIR_SUFFIX down from the build system and using that as part
of the default resource dir computation.

Without this, essentially nothing that uses the clang driver works when
building clang with a libdir suffix. This is probably the single biggest
missing piece of support for multilib as without this people could hack
clang to end up installed in the correct location, but it would then
fail to find its own basic resources. I know of at least one distro that
has some variation on this patch to hack around this; hopefully they'll
be able to use the libdir suffix functionality directly as the rest of
these bits land.

This required fixing a copy of the code to compute Clang's resource
directory that is buried inside of the frontend (!!!). It had bitrotted
significantly relative to the driver code. I've made it essentially
a clone of the driver code in order to keep tests (which use cc1
heavily) passing. This copy should probably just be removed and the
frontend taught to always rely on an explicit resource directory from
the driver, but that is a much more invasive change for another day.

I've also updated one test which actually encoded the resource directory
in its checked output to tolerate multilib suffixes.

Note that this relies on a prior LLVM commit to add a stub to the
autoconf build system for this variable.

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

9 years ago[cmake] Teach the Clang CMake build to use LLVM_LIBDIR_SUFFIX for its
Chandler Carruth [Mon, 29 Dec 2014 12:09:03 +0000 (12:09 +0000)]
[cmake] Teach the Clang CMake build to use LLVM_LIBDIR_SUFFIX for its
'lib' directories in the build. This variable is available now both as
part of the normal LLVM build an as part of a standalone build as I've
added it to the LLVMConfig.cmake output.

With this change we should at least put libraries into the multilib
directory correctly. It is the first step in getting Clang to be
reasonably multilib aware.

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

9 years agoSema: Permit array l-values in asm output operands
David Majnemer [Mon, 29 Dec 2014 10:29:53 +0000 (10:29 +0000)]
Sema: Permit array l-values in asm output operands

GCC permits array l-values in asm output operands even though they
aren't modifiable l-values.  We used to permit it but this behavior
regressed in r224916.

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

9 years agoSema: Only permit permit modifiable l-values as asm output params
David Majnemer [Mon, 29 Dec 2014 09:30:33 +0000 (09:30 +0000)]
Sema: Only permit permit modifiable l-values as asm output params

Functions are l-values in C++ but shouldn't be available as output
parameters in inline assembly.  Neither should overloaded function
l-values.

This fixes PR21949.

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

9 years agoDon't crash on malformed attributes in an incorrect location.
Nico Weber [Mon, 29 Dec 2014 06:56:50 +0000 (06:56 +0000)]
Don't crash on malformed attributes in an incorrect location.

r168626 added nicer diagnostics for attributes in the wrong places, such as
after the `final` on a class.  To do this, it added code that did high-level
pattern matching for e.g. 'final' 'alignas' '(' and then skipped until the
closing ')'.  If it saw that, it then went down the regular class parsing
path and then called MaybeParseCXX11Attributes() to parse the attribute after
the 'final' using real attribute parsing code.  On invalid attributes, the
real attribute parsing code could eat more tokens than the pattern matching
code and for example skip past the '{' starting the class, which would then
lead to an assert.  To prevent this, check for a good state after calling
MaybeParseCXX11Attributes() (which morphed into CheckMisplacedCXX11Attribute()
in r175575) and bail out if things look bleak.

Found by SLi's afl bot.

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

9 years ago[x86] Fix an accidental commit of a change from Ii to iC on __builtin_ia32_cmpps512_mask.
Craig Topper [Mon, 29 Dec 2014 06:55:01 +0000 (06:55 +0000)]
[x86] Fix an accidental commit of a change from Ii to iC on __builtin_ia32_cmpps512_mask.

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

9 years ago[x86] Put 'C' after 'i' on all the AVX-512 intrisics that take const ints. 'C' is...
Craig Topper [Mon, 29 Dec 2014 06:41:12 +0000 (06:41 +0000)]
[x86] Put 'C' after 'i' on all the AVX-512 intrisics that take const ints. 'C' is a suffix modifier not a prefix modififier. Also put 'C' on the pointers in all of the gather instrinsics. I think they previously had one due to the misordering. I'm still thinking the 'iC' actually need to be a 'Ii' since they really require an ICE.

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

9 years agoSema: Don't crash when solitary :: token appears before { in struct def
David Majnemer [Mon, 29 Dec 2014 05:17:46 +0000 (05:17 +0000)]
Sema: Don't crash when solitary :: token appears before { in struct def

hasDeclaratorForAnonDecl, getDeclaratorForAnonDecl and
getTypedefNameForAnonDecl are expected to handle the case where
NamedDeclOrQualifier holds the wrong type or nothing at all.

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

9 years agoSema: Forbid inconsistent constraint alternatives
David Majnemer [Mon, 29 Dec 2014 04:09:59 +0000 (04:09 +0000)]
Sema: Forbid inconsistent constraint alternatives

Verify that asm constraints have the same number of alternatives

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

9 years agoSemaCXX: Don't crash when annotation tokens show up before the tag name
David Majnemer [Mon, 29 Dec 2014 02:14:26 +0000 (02:14 +0000)]
SemaCXX: Don't crash when annotation tokens show up before the tag name

Clang has a hack to accept definitions of structs with tag names which
have the same name as intrinsics.  However, this hack didn't guard
against annotation tokens showing up in the token stream.

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

9 years agoCodeGen: Optimize emssion of zeroinitialzied arrays
David Majnemer [Sun, 28 Dec 2014 23:46:59 +0000 (23:46 +0000)]
CodeGen: Optimize emssion of zeroinitialzied arrays

Create an ConstantAggregateZero upfront if we see that it is viable.
This saves us from having to manually push_back each and every
initializer and then looping back over them to determine if they are
'null'.

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

9 years agoDon't crash on surprising tokens in default parameter template lists.
Nico Weber [Sun, 28 Dec 2014 23:24:02 +0000 (23:24 +0000)]
Don't crash on surprising tokens in default parameter template lists.

Fixes this snippet from SLi's afl fuzzer output:

  class {
      i (x = <, enum

This parsed i as a function, x as a paramter, and the stuff after < as a
template list.  This then called TryConsumeDeclarationSpecifier() which
called TryAnnotateCXXScopeToken() without checking the preconditions of
this function.  Check them before calling, like all other callers of
TryAnnotateCXXScopeToken() do.

A more readable reproducer that causes the same crash is

  class {
      void i(int x = MyTemplateClass<int, union int>::foo());
  };

The reduced version used an eof token as surprising token, but kw_int works
just as well to repro and is easier to insert into a test file.

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

9 years agoSema: Variable templates cannot be static bitfield members
David Majnemer [Sun, 28 Dec 2014 22:51:45 +0000 (22:51 +0000)]
Sema: Variable templates cannot be static bitfield members

We correctly forbid variables but not variable templates.  Diagnose this
case instead of crashing.

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

9 years agoParse: Don't crash when 'typename' shows up in an attribute
David Majnemer [Sun, 28 Dec 2014 22:28:32 +0000 (22:28 +0000)]
Parse: Don't crash when 'typename' shows up in an attribute

isDeclarationSpecifier performs error recovers which jostles the token
stream.  Specifically, TryAnnotateTypeOrScopeToken will end up consuming
a typename token which will confuse the attribute parsing machinery as
we no-longer have something identifier-like.

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

9 years agoSema: Permit an atomic type to be initialized by the same atomic type
David Majnemer [Sun, 28 Dec 2014 21:47:31 +0000 (21:47 +0000)]
Sema: Permit an atomic type to be initialized by the same atomic type

We forgot a conversion step when initializing an atomic type with an
rvalue of the same type.

This fixes PR22043.

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

9 years agoSema: Don't crash when an inject class name has a nested redefinition
David Majnemer [Sun, 28 Dec 2014 09:18:54 +0000 (09:18 +0000)]
Sema: Don't crash when an inject class name has a nested redefinition

We expected the type of a TagDecl to be a TagType, not an
InjectedClassNameType.  Introduced a helper method, Type::getAsTagDecl,
to abstract away the difference; redefine Type::getAsCXXRecordDecl to be
in terms of it.

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

9 years agoLex: Don't let annotation tokens get into macro expansion
David Majnemer [Sun, 28 Dec 2014 07:42:49 +0000 (07:42 +0000)]
Lex: Don't let annotation tokens get into macro expansion

We'd let annotation tokens from '#pragma pack' and the like get inside a
function-like macro.  This would lead to terror and mayhem; stop the
madness early.

This fixes PR22037.

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

9 years agoFix markup from r224894.
Nico Weber [Sun, 28 Dec 2014 02:12:59 +0000 (02:12 +0000)]
Fix markup from r224894.

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

9 years agoAdd stub sections about Parse, Sema, CodeGen to the internals manual.
Nico Weber [Sun, 28 Dec 2014 02:07:26 +0000 (02:07 +0000)]
Add stub sections about Parse, Sema, CodeGen to the internals manual.

I'd be interested if the paragraph on Parse not knowing much about AST is
something folks agree with.  I think this used to be true after rjmccall removed
the Action interface in r112244 and I believe it's still true, but I'm not sure.
(For example, ParseOpenMP.cpp does include AST/StmtOpenMP.h.  Other than that,
Parse not using AST nodes much seems to be still true, though.)

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

9 years agoRemove unneeded include of DeclCXX.h from libParse.
Nico Weber [Sun, 28 Dec 2014 01:52:28 +0000 (01:52 +0000)]
Remove unneeded include of DeclCXX.h from libParse.

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

9 years agoObjective-C: Serialize "more than one decl" state of ObjCMethodList.
Nico Weber [Sat, 27 Dec 2014 22:14:15 +0000 (22:14 +0000)]
Objective-C: Serialize "more than one decl" state of ObjCMethodList.

This fixes PR21587, what r221933 fixed for regular programs is now also
fixed for decls coming from PCH files.

Use another bit from the count/bits uint16_t for storing the "more than one
decl" bit.  This reduces the number of bits for the count from 14 to 13.
The selector with the most overloads in Cocoa.h has ~55 overloads, so 13 bits
should still be plenty.  Since this changes the meaning of a serialized bit
pattern, also increase clang::serialization::VERSION_MAJOR.

Storing the "more than one decl" state of only the first overload isn't quite
correct, but Sema::AreMultipleMethodsInGlobalPool() currently only looks at
the state of the first overload so it's good enough for now.

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

9 years ago[x86] Also add the missing type casts on the returns in the sha
Chandler Carruth [Sat, 27 Dec 2014 11:50:51 +0000 (11:50 +0000)]
[x86] Also add the missing type casts on the returns in the sha
intrinsic header file. Along with r224822, this should restore the build
bots to passing.

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

9 years ago[x86] Add missing typecast to __v4si to sha intrinsic header file.
Craig Topper [Sat, 27 Dec 2014 07:19:25 +0000 (07:19 +0000)]
[x86] Add missing typecast to __v4si to sha intrinsic header file.

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

9 years agoObjective-C: Tweak unavailability warning.
Nico Weber [Sat, 27 Dec 2014 07:09:37 +0000 (07:09 +0000)]
Objective-C: Tweak unavailability warning.

Don't warn when a selector has an unavailable and an available variant,
and the first also has an implementation.

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

9 years ago[x86] Add range checking to the constant argument of cmpps/pd/ss/sd builtinas.
Craig Topper [Sat, 27 Dec 2014 07:00:08 +0000 (07:00 +0000)]
[x86] Add range checking to the constant argument of cmpps/pd/ss/sd builtinas.

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

9 years ago[x86] Add the (v)cmpps/pd/ss/sd builtins to match gcc. Use them in the sse intrinsic...
Craig Topper [Sat, 27 Dec 2014 06:59:57 +0000 (06:59 +0000)]
[x86] Add the (v)cmpps/pd/ss/sd builtins to match gcc. Use them in the sse intrinsic files.

This still lower to the same intrinsics as before.

This is preparation for bounds checking the immediate on the avx version of the builtin so we don't pass illegal immediates into the backend. Since SSE uses a smaller size immediate its not possible to bounds check when using a shared builtin. Rather than creating a clang specific builtin for the different immediate, I decided (after consulting with Chandler) that it was better to match gcc.

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

9 years agoAdd more feature flags to the x86 instrinsic test.
Craig Topper [Sat, 27 Dec 2014 06:59:44 +0000 (06:59 +0000)]
Add more feature flags to the x86 instrinsic test.

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

9 years agoFix formatting. NFC.
Craig Topper [Sat, 27 Dec 2014 06:59:37 +0000 (06:59 +0000)]
Fix formatting. NFC.

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

9 years agoAddress review feedback on r221933.
Nico Weber [Sat, 27 Dec 2014 03:58:08 +0000 (03:58 +0000)]
Address review feedback on r221933.

Remove ObjCMethodList::Count, instead store a "has more than one decl" bit in
the low bit of the ObjCMethodDecl pointer, using a PointerIntPair.

Most of this patch is replacing ".Method" with ".getMethod()".

No intended behavior change.

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

9 years agoMake the test from r224873 actually pass.
Nico Weber [Sat, 27 Dec 2014 03:38:18 +0000 (03:38 +0000)]
Make the test from r224873 actually pass.

The behavior looks incorrect to me, but the test is supposed to document
current behavior for now.

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

9 years agoMark __builtin_ia32_cmppd256 and __builtin_ia32_cmpps256 as taking an ICE for the...
Craig Topper [Sat, 27 Dec 2014 01:20:16 +0000 (01:20 +0000)]
Mark __builtin_ia32_cmppd256 and __builtin_ia32_cmpps256 as taking an ICE for the constant parameter.

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

9 years agoAdd more test coverage for the Objective-C deprected selector warning.
Nico Weber [Sat, 27 Dec 2014 01:05:55 +0000 (01:05 +0000)]
Add more test coverage for the Objective-C deprected selector warning.

I broke this case in a local patch I'm writing, and there was no test to stop
me.  Now there is.

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

9 years agoAdjust the rest of the tests due to r224849.
David Majnemer [Fri, 26 Dec 2014 18:45:57 +0000 (18:45 +0000)]
Adjust the rest of the tests due to r224849.

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

9 years agoUpdate tests due to r224849
David Majnemer [Fri, 26 Dec 2014 10:29:40 +0000 (10:29 +0000)]
Update tests due to r224849

Inferring nuw caused some clang tests to change their output.

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

9 years agoSema: Qualify getPrintable's Expr argument
David Majnemer [Fri, 26 Dec 2014 06:06:56 +0000 (06:06 +0000)]
Sema: Qualify getPrintable's Expr argument

getPrintable has an overload which takes a bool.  This means that const
qualified Exprs would get forwarded to the bool overload instead of the
Expr overload.

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

9 years agoWIP
David Majnemer [Fri, 26 Dec 2014 06:06:53 +0000 (06:06 +0000)]
WIP

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

9 years agoInitialize BackendConsumer::Context in constructor.
Yaron Keren [Thu, 25 Dec 2014 12:21:56 +0000 (12:21 +0000)]
Initialize BackendConsumer::Context in constructor.

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

9 years agoInitialize CodeGeneratorImpl::Ctx in constructor.
Yaron Keren [Thu, 25 Dec 2014 11:38:15 +0000 (11:38 +0000)]
Initialize CodeGeneratorImpl::Ctx in constructor.

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

9 years ago[analyzer] Updated progress for memory.ZeroAlloc
Anton Yartsev [Wed, 24 Dec 2014 01:04:38 +0000 (01:04 +0000)]
[analyzer] Updated progress for memory.ZeroAlloc

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

9 years ago[analyzer] +memory.ZeroAlloc
Anton Yartsev [Wed, 24 Dec 2014 00:46:56 +0000 (00:46 +0000)]
[analyzer] +memory.ZeroAlloc

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

9 years agoclang-cl: Various changes to /Zc: handling.
Nico Weber [Tue, 23 Dec 2014 22:55:34 +0000 (22:55 +0000)]
clang-cl: Various changes to /Zc: handling.

* /Zc:trigraphs and /Zc:trigraphs- are now honored
* /Zc:strictStrings is now honored
* /Zc:auto is now honored/ignored (clang does the Right Thing for this already)

Also add a dedicated test for the various /Zc: flags.
clang-cl doesn't always agree with cl.exe on the default values for /Zc flags.
For example, I think clang always behaves as if /Zc:inline is passed, and
warns if the user explicitly passes /Zc:inline-

Fixes PR21974.

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

9 years agoAdd driver flags -ftrigraphs, -fno-trigraphs.
Nico Weber [Tue, 23 Dec 2014 22:32:37 +0000 (22:32 +0000)]
Add driver flags -ftrigraphs, -fno-trigraphs.

-trigraphs is now an alias for -ftrigraphs.  -fno-trigraphs makes it possible
to explicitly disable trigraphs, which couldn't be done before.

  clang -std=c++11 -fno-trigraphs

now builds without GNU extensions, but with trigraphs disabled.  Previously,
trigraphs were only disabled in GNU modes or with -std=c++1z.

Make the new -f flags the cc1 interface too.  This requires changing -trigraphs
to -ftrigraphs in a few cc1 tests.

Related to PR21974.

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

9 years agoRemove unused test input.
Nico Weber [Tue, 23 Dec 2014 19:30:13 +0000 (19:30 +0000)]
Remove unused test input.

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

9 years agoDebug Info: Pass the pointer size into createMemberPointerType().
Adrian Prantl [Tue, 23 Dec 2014 19:11:54 +0000 (19:11 +0000)]
Debug Info: Pass the pointer size into createMemberPointerType().
Paired commit with LLVM.

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

9 years agoThis reverts commit r224668 and r224667.
Rafael Espindola [Tue, 23 Dec 2014 15:57:12 +0000 (15:57 +0000)]
This reverts commit r224668 and r224667.

r224667 broke bootstrap on Fedora 20 X86_64 (at least).

See pr22006 for the details.

r224668 depends on r224667.

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

9 years agoAdd a triple to try and get this test passing on the ARM bots.
Nico Weber [Tue, 23 Dec 2014 01:07:10 +0000 (01:07 +0000)]
Add a triple to try and get this test passing on the ARM bots.

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

9 years agoDisable trigraphs in microsoft mode by default. Matches cl.exe.
Nico Weber [Mon, 22 Dec 2014 18:35:03 +0000 (18:35 +0000)]
Disable trigraphs in microsoft mode by default. Matches cl.exe.

The default value of Opts.Trigraphs now no longer depends solely on the
language input kind, so move the code out of setLangDefaults().  Also make
sure that Opts.MSVCCompat is set before the Trigraph code runs.

Related to PR21974.

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

9 years agoRename test.cc files to test.cpp.
Nico Weber [Mon, 22 Dec 2014 18:13:07 +0000 (18:13 +0000)]
Rename test.cc files to test.cpp.

The lit.cfg files only add .cpp to suffixes, so these tests used to never run,
oops.  (Also tweak to of these tests in minor ways to make the actually pass.)

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

9 years agoAdd test coverage for cc1's trigraph option handling.
Nico Weber [Mon, 22 Dec 2014 17:56:50 +0000 (17:56 +0000)]
Add test coverage for cc1's trigraph option handling.

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

9 years agoSimplify test for rdar://19256338
Fariborz Jahanian [Mon, 22 Dec 2014 17:54:25 +0000 (17:54 +0000)]
Simplify test for rdar://19256338
(from patch r224549).

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

9 years agoMS ABI: Make the string mangling code more concise
David Majnemer [Mon, 22 Dec 2014 06:24:49 +0000 (06:24 +0000)]
MS ABI: Make the string mangling code more concise

No functional change intended.

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

9 years agoWrap to 80 columns. NfC.
Nico Weber [Mon, 22 Dec 2014 05:21:03 +0000 (05:21 +0000)]
Wrap to 80 columns. NfC.

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

9 years agoReapply "Change -save-temps to emit unoptimized bitcode files."
Bob Wilson [Sun, 21 Dec 2014 07:00:00 +0000 (07:00 +0000)]
Reapply "Change -save-temps to emit unoptimized bitcode files."

This reapplies r224503 along with a fix for compiling Fortran by having the
clang driver invoke gcc (see r224546, where it was reverted). I have added
a testcase for that as well.

Original commit message:
It is often convenient to use -save-temps to collect the intermediate
results of a compilation, e.g., when triaging a bug report. Besides the
temporary files for preprocessed source and assembly code, this adds the
unoptimized bitcode files as well.

This adds a new BackendJobAction, which is mostly mechanical, to run after
the CompileJobAction. When not using -save-temps, the BackendJobAction is
combined into one job with the CompileJobAction, similar to the way the
integrated assembler is handled. I've implemented this entirely as a
driver change, so under the hood, it is just using -disable-llvm-optzns
to get the unoptimized bitcode.

Based in part on a patch by Steven Wu.
rdar://problem/18909437

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

9 years agoFrontend: Fix typo in comments.
Logan Chien [Sat, 20 Dec 2014 08:51:22 +0000 (08:51 +0000)]
Frontend: Fix typo in comments.

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

9 years agoFix a bunch of integer template argument problems in template type diffing.
Richard Trieu [Sat, 20 Dec 2014 03:03:32 +0000 (03:03 +0000)]
Fix a bunch of integer template argument problems in template type diffing.

Reverts most of the changes from r168005.  Since template arguments have proper
conversions now, no extending of integers is needed.  Further, since the
integers are the correct size now, use APSInt::operator== instead of
APSInt::hasSameValue since operator== will check the size and signness match.

Prior to one comparison of APSInt's, check that both are valid.  Previous, one
could be uninitialized.  Also changed APInt to APSInt in GetInt.  This
occassionally produced a sign flip, which will now be caught by operator==.

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

9 years agoFix for PR21758
Richard Trieu [Sat, 20 Dec 2014 02:42:08 +0000 (02:42 +0000)]
Fix for PR21758

When a non-type template argument expression needs a conversion to change it
into the argument type, preserve that information by remaking the
TemplateArgument with an expression that has those conversions.  Also a small
fix to template type diffing to handle the extra conversions in some cases.

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

9 years agoRemoving an outdated FIXME; try block attributes are parsed with the rest of the...
Aaron Ballman [Sat, 20 Dec 2014 01:54:07 +0000 (01:54 +0000)]
Removing an outdated FIXME; try block attributes are parsed with the rest of the statement attributes (as per the standard), and function-try-blocks may not have attributes. NFC.

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

9 years agoDriver: hoist an assertion
Saleem Abdulrasool [Fri, 19 Dec 2014 23:56:31 +0000 (23:56 +0000)]
Driver: hoist an assertion

Remove an unnecessary conditional, hoisting the assertion.  Minor style
tweaks/reflowing.  NFC.

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

9 years agoDriver: refactor a local variable
Saleem Abdulrasool [Fri, 19 Dec 2014 23:56:28 +0000 (23:56 +0000)]
Driver: refactor a local variable

Pull out a getToolChain() into a local variable to share the call across to all
the uses.  NFC.

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

9 years agoDon't drop attributes when checking explicit specializations.
Nico Weber [Fri, 19 Dec 2014 23:52:45 +0000 (23:52 +0000)]
Don't drop attributes when checking explicit specializations.

Consider a template class with attributes on a method, and an explicit
specialization of that method:

    template <int>
    struct A {
      void foo() final;
    };

    template <>
    void A<0>::foo() {}

In this example, the attribute is `final`, but it might also be an
__attribute__((visibility("foo"))), noreturn, inline, etc. clang's current
behavior is to strip all attributes, which for some attributes is wrong
(the snippet above allows a subclass of A<0> to override the final method, for
example) and for others disagrees with gcc.

So stop dropping attributes. r95845 added this code without a test case, and
r176728 added the code for dropping attributes on parameters (with tests, but
they still pass).

As an additional wrinkle, do drop dllimport and dllexport, since that's how
these two attributes work. (This is covered by existing tests.)

Fixes PR21942.

The approach is by Richard Smith, initial analysis and typing was done by me.

With this, clang also matches GCC and EDG on all attributes Richard tested.

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

9 years agoTweak the assert in ModuleBuilder from r224533 (PR21989)
Hans Wennborg [Fri, 19 Dec 2014 23:35:11 +0000 (23:35 +0000)]
Tweak the assert in ModuleBuilder from r224533 (PR21989)

Turns out there will be left-over deferred inline methods if there have
been errors, because in that case HandleTopLevelDecl bails out early.

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

9 years agoDR1048: drop top-level cv-qualifiers when deducing the return type of a
Richard Smith [Fri, 19 Dec 2014 22:10:51 +0000 (22:10 +0000)]
DR1048: drop top-level cv-qualifiers when deducing the return type of a
lambda-expression in C++11, to match the C++14 rules.

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

9 years agoAllow to disable all sanitizers with "-fno-sanitize=all" option.
Alexey Samsonov [Fri, 19 Dec 2014 18:41:43 +0000 (18:41 +0000)]
Allow to disable all sanitizers with "-fno-sanitize=all" option.

Summary:
This patch adds "all" sanitizer group. A shortcut "-fno-sanitize=all"
can be used to disable all sanitizers for a given source file.

"-fsanitize=all" option makes no sense, and will produce an error.

This group can also be useful when we add "-fsanitize-recover=<list>"
options (patch in http://reviews.llvm.org/D6302), as it would allow
to conveniently enable/disable recovery for all specified sanitizers.

Test Plan: regression test suite

Reviewers: kcc, rsmith

Subscribers: cfe-commits

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

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

9 years agoAdded a fixit to remove empty parens from a C++11 attribute argument list when we...
Aaron Ballman [Fri, 19 Dec 2014 18:37:22 +0000 (18:37 +0000)]
Added a fixit to remove empty parens from a C++11 attribute argument list when we diagnose this as an error.

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

9 years agoFix an address space id reset with array decay's
Pekka Jaaskelainen [Fri, 19 Dec 2014 18:04:27 +0000 (18:04 +0000)]
Fix an address space id reset with array decay's
implicit conversion.

The issue was produced with OpenCL C code that
called a function with a constant string literal
argument.

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

9 years agoUse ObjCMultipleMethodNames to match the option.
Fariborz Jahanian [Fri, 19 Dec 2014 16:55:51 +0000 (16:55 +0000)]
Use ObjCMultipleMethodNames to match the option.

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

9 years agoAttributes accepting an EnumArgument are allowed to pass a string literal, or an...
Aaron Ballman [Fri, 19 Dec 2014 16:42:04 +0000 (16:42 +0000)]
Attributes accepting an EnumArgument are allowed to pass a string literal, or an identifier. VariadicEnumArguments now behave consistently instead of only accepting a string literal.

This change affects the only attribute accepting a variadic enumeration: callable_when.

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

9 years agoPutting unevaluated expression warnings, and evaluated typeid warnings, under their...
Aaron Ballman [Fri, 19 Dec 2014 14:56:49 +0000 (14:56 +0000)]
Putting unevaluated expression warnings, and evaluated typeid warnings, under their own warning flags. Amends r224465.

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

9 years ago[Sanitizer] Get rid of parseArgument helper function. NFC.
Alexey Samsonov [Fri, 19 Dec 2014 02:35:16 +0000 (02:35 +0000)]
[Sanitizer] Get rid of parseArgument helper function. NFC.

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

9 years agoFix layering violation, Lex shouldn't know about Decl
David Majnemer [Fri, 19 Dec 2014 02:13:56 +0000 (02:13 +0000)]
Fix layering violation, Lex shouldn't know about Decl

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

9 years agoPR21969: Improve diagnostics for a conversion function that has any pieces of a
Richard Smith [Fri, 19 Dec 2014 02:07:47 +0000 (02:07 +0000)]
PR21969: Improve diagnostics for a conversion function that has any pieces of a
declared return type (including a trailing-return-type in C++14).

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

9 years agoCorrect delayed typos in the operand to typeof expressions.
Kaelyn Takata [Fri, 19 Dec 2014 01:28:40 +0000 (01:28 +0000)]
Correct delayed typos in the operand to typeof expressions.

Fixes PR21947.

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

9 years agoFix a typo.
Adrian Prantl [Fri, 19 Dec 2014 01:02:11 +0000 (01:02 +0000)]
Fix a typo.

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

9 years ago[c Sema]. Patch fixes pointer-bool-conversion warning on C code
Fariborz Jahanian [Thu, 18 Dec 2014 23:14:51 +0000 (23:14 +0000)]
[c Sema]. Patch fixes pointer-bool-conversion warning on C code
when source range is incorrect causing the warning to be
issued when it should not because expression is in a macro.
rdar://19256338

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

9 years agoRevert "Change -save-temps to emit unoptimized bitcode files."
Reid Kleckner [Thu, 18 Dec 2014 23:07:04 +0000 (23:07 +0000)]
Revert "Change -save-temps to emit unoptimized bitcode files."

This reverts commit r224503.

It broke compilation of fortran through the Clang driver. Previously
`clang -c t.f` would invoke `gcc t.f` and `clang -cc1as`, but now it
tries to call `clang -cc1 t.f` which fails for obvious reasons.

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

9 years ago[CMake] Add check-asan-dynamic command to external compiler-rt setup.
Alexey Samsonov [Thu, 18 Dec 2014 21:40:39 +0000 (21:40 +0000)]
[CMake] Add check-asan-dynamic command to external compiler-rt setup.

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

9 years agoObjective-C. Provide group name for warning
Fariborz Jahanian [Thu, 18 Dec 2014 19:41:11 +0000 (19:41 +0000)]
Objective-C. Provide group name for warning
on multiple selector names found during lookup.
rdar://19265296

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

9 years agoModuleBuilder: assert that all deferred inline method defs get handled
Hans Wennborg [Thu, 18 Dec 2014 19:19:00 +0000 (19:19 +0000)]
ModuleBuilder: assert that all deferred inline method defs get handled

While we're here, also move the declaration of DeferredInlineMethodDefinitions
closer to the other member vars and make it a SmallVector. NFC.

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

9 years agoRevert "Don't build invalid AST nodes during recovery"
Reid Kleckner [Thu, 18 Dec 2014 18:17:42 +0000 (18:17 +0000)]
Revert "Don't build invalid AST nodes during recovery"

This reverts commit r224451. It caused us to reject some valid existing
code.

This code appears to run in non-error cases as well as error cases. If
the scope of a DependentScopeDeclRefExpr is still incomplete it probably
means we still have more instantiation to do.

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

9 years ago[Objective-C]. Patch to unify code generation for ObjCMsgSend and ObjCBoxedExpr.
Fariborz Jahanian [Thu, 18 Dec 2014 17:13:56 +0000 (17:13 +0000)]
[Objective-C]. Patch to unify code generation for ObjCMsgSend and ObjCBoxedExpr.
Patch by Alex Denisov. NFC.

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

9 years agoCorrection to -mfu=neon-vfpv4 to pass the correct backend feature name
Richard Barton [Thu, 18 Dec 2014 16:31:18 +0000 (16:31 +0000)]
Correction to -mfu=neon-vfpv4 to pass the correct backend feature name

Change-Id: I4dbfe1d97670fc4e626368ef1f91fc008778dfca

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

9 years agoEnabling this test again on mingw. The problem seems to happen when
Yaron Keren [Thu, 18 Dec 2014 12:13:14 +0000 (12:13 +0000)]
Enabling this test again on mingw. The problem seems to happen when
two identical module.modulemap are available on the include path and
so should be fixed in the mingw driver include dies, when we'll have it.

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

9 years agoclang-format: Fix incorrect detection of ObjC "in" keyword.
Daniel Jasper [Thu, 18 Dec 2014 12:11:01 +0000 (12:11 +0000)]
clang-format: Fix incorrect detection of ObjC "in" keyword.

Before:
  for (auto v : in [1]) { ..

After:
  for (auto v : in[1]) { ..

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

9 years agoFixed warnings on redefine keywords and reserved ids.
Serge Pavlov [Thu, 18 Dec 2014 11:14:21 +0000 (11:14 +0000)]
Fixed warnings on redefine keywords and reserved ids.

Repared support for warnings -Wkeyword-macro and -Wreserved-id-macro.
The warning -Wkeyword-macro now is not issued in patterns that are used
in configuration scripts:

    #define inline

also for 'const', 'extern' and 'static'. If macro repalcement is identical
to macro name, the warning also is not issued:

    #define volatile volatile

And finally if macro replacement is also a keyword identical to the replaced
one but decorated with leading/trailing underscores:

    #define inline __inline
    #define inline __inline__
    #define inline _inline // in MSVC compatibility mode

Warning -Wreserved-id-macro is off by default, it could help catching
things like:

    #undef __cplusplus

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

9 years agoParse: Don't parse after the eof has been consumed
David Majnemer [Thu, 18 Dec 2014 09:57:31 +0000 (09:57 +0000)]
Parse: Don't parse after the eof has been consumed

ParseCXXNonStaticMemberInitializer stashes away all the tokens for the
initializer and an additional EOF token to denote where the initializer
ends.  However, it is possible for ParseLexedMemberInitializer to get
its hands on the "real" EOF token; since the two tokens are
indistinguishable, we end up consuming the EOF and descend into madness.

Instead, make it possible to tell which EOF token we are looking at.

This fixes PR21872.

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

9 years agoFix for PR21915: assert on multidimensional VLA in function arguments.
Alexey Bataev [Thu, 18 Dec 2014 06:54:53 +0000 (06:54 +0000)]
Fix for PR21915: assert on multidimensional VLA in function arguments.
Fixed assertion on type checking for arguments and parameters on function call if arguments are pointers to VLA
Differential Revision: http://reviews.llvm.org/D6655

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

9 years agoChange -save-temps to emit unoptimized bitcode files.
Bob Wilson [Thu, 18 Dec 2014 06:08:26 +0000 (06:08 +0000)]
Change -save-temps to emit unoptimized bitcode files.

It is often convenient to use -save-temps to collect the intermediate
results of a compilation, e.g., when triaging a bug report. Besides the
temporary files for preprocessed source and assembly code, this adds the
unoptimized bitcode files as well.

This adds a new BackendJobAction, which is mostly mechanical, to run after
the CompileJobAction. When not using -save-temps, the BackendJobAction is
combined into one job with the CompileJobAction, similar to the way the
integrated assembler is handled. I've implemented this entirely as a
driver change, so under the hood, it is just using -disable-llvm-optzns
to get the unoptimized bitcode.

Based in part on a patch by Steven Wu.
rdar://problem/18909437

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

9 years agoUpdate for llvm front end change and use the TargetOptions struct
Eric Christopher [Thu, 18 Dec 2014 02:23:27 +0000 (02:23 +0000)]
Update for llvm front end change and use the TargetOptions struct
for ABI.

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

9 years agoMake sure that arm-linux-gnu is still the apcs-gnu ABI when we
Eric Christopher [Thu, 18 Dec 2014 02:08:55 +0000 (02:08 +0000)]
Make sure that arm-linux-gnu is still the apcs-gnu ABI when we
use clang -cc1 matching the front end and backend. Fix up a couple
of tests that were testing aapcs for arm-linux-gnu.

The test that removes the aapcs abi calling convention removes
them because the default triple matches what the backend uses
for the calling convention there and so it doesn't need to be
explicitly stated - see the code in TargetInfo.cpp.

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

9 years agoReinstate aapcs as the default arm abi.
Eric Christopher [Thu, 18 Dec 2014 02:08:51 +0000 (02:08 +0000)]
Reinstate aapcs as the default arm abi.

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

9 years agoCGDebugInfo: Use DIBuilder API for self-referencing DICompositeTypes
Duncan P. N. Exon Smith [Thu, 18 Dec 2014 00:48:56 +0000 (00:48 +0000)]
CGDebugInfo: Use DIBuilder API for self-referencing DICompositeTypes

Use new `DIBuilder` API from LLVM r224482 to mutate `DICompositeType`s,
rather than changing them directly.  This allows `DIBuilder` to track
otherwise orphaned cycles when `CollectContainingType()` creates a
self-reference.

Fixes PR21941.

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

9 years agoFix diagnostic for static methods referencing fields from using decls
Reid Kleckner [Thu, 18 Dec 2014 00:42:51 +0000 (00:42 +0000)]
Fix diagnostic for static methods referencing fields from using decls

Previously we thought the instance member was a function, not a field,
and we'd say something silly like:
  t.cpp:4:27: error: call to non-static member function without an object argument
    static int f() { return n; }
                            ^

Noticed in PR21923.

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

9 years ago[Objective-C]. Modern property getters have side-effects.
Fariborz Jahanian [Thu, 18 Dec 2014 00:30:54 +0000 (00:30 +0000)]
[Objective-C]. Modern property getters have side-effects.
So, place warning about property getter should not be used for side-effect
under its own group so warning can be turned off.
rdar://19137815

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

9 years agoFix a function that only calls itself. The const_cast needs to remove the
Richard Trieu [Thu, 18 Dec 2014 00:06:45 +0000 (00:06 +0000)]
Fix a function that only calls itself.  The const_cast needs to remove the
const so that the other overloaded function will be called.

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

9 years agoInstrProf: Simplify/reduce state in CoverageMapping (NFC)
Justin Bogner [Wed, 17 Dec 2014 23:55:04 +0000 (23:55 +0000)]
InstrProf: Simplify/reduce state in CoverageMapping (NFC)

This state object makes things harder to reason about and isn't really
useful, since we can just emit the mappings before the state changes
rather than holding on to it.

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

9 years agoRevert "Put static local variables of inline functions in the function comdat."
Rafael Espindola [Wed, 17 Dec 2014 23:49:22 +0000 (23:49 +0000)]
Revert "Put static local variables of inline functions in the function comdat."

This reverts commit r224369.

Thanks to Reid Kleckner for pointing out that we need a bigger gun to fix this
case.

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

9 years agoDon't assume friended C++ method decls have qualifiers
Reid Kleckner [Wed, 17 Dec 2014 23:40:46 +0000 (23:40 +0000)]
Don't assume friended C++ method decls have qualifiers

There are a few cases where unqualified lookup can find C++ methods.
Unfortunately, none of them seem to have illegal access paths, so I
can't excercise the diagnostic source range code that I am changing
here.

Fixes PR21851, which was a crash on valid.

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

9 years agoAdding a -Wunused-value warning for expressions with side effects used in an unevalua...
Aaron Ballman [Wed, 17 Dec 2014 21:57:17 +0000 (21:57 +0000)]
Adding a -Wunused-value warning for expressions with side effects used in an unevaluated expression context, such as sizeof(), or decltype(). Also adds a similar warning when the expression passed to typeid() *is* evaluated, since it is equally likely that the user would expect the expression operand to be unevaluated in that case.

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

9 years ago[sanitizer] allow -fsanitize-coverage=N w/ -fsanitize=leak, clang part
Kostya Serebryany [Wed, 17 Dec 2014 21:46:33 +0000 (21:46 +0000)]
[sanitizer] allow -fsanitize-coverage=N w/ -fsanitize=leak, clang part

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

9 years ago[c++1z] Fixes for generalized non-type template argument support: check for
Richard Smith [Wed, 17 Dec 2014 20:42:37 +0000 (20:42 +0000)]
[c++1z] Fixes for generalized non-type template argument support: check for
exact type match for deduced template arguments, and be sure to produce correct
canonical TemplateArgument representations to enable correct redeclaration
matching.

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