]> granicus.if.org Git - clang/log
clang
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

9 years agoDestroy the diagnostic client first in ~DiagnosticEngine
Reid Kleckner [Wed, 17 Dec 2014 20:23:11 +0000 (20:23 +0000)]
Destroy the diagnostic client first in ~DiagnosticEngine

Add a comment and a test to ~DiagnosticEngine about the ordering
requirements on the teardown of DiagnosticConsumer. This could also be
accomplished by rearranging the fields of ~DiagnosticEngine, but I felt
that this was a better, more explicit solution.

This fixes PR21911, an issue that occurred after the unique_ptr
migration in r222193.

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

9 years agoThis test does not pass for -target i686-pc-windows-gnu (-mingw32)
Yaron Keren [Wed, 17 Dec 2014 20:12:29 +0000 (20:12 +0000)]
This test does not pass for -target i686-pc-windows-gnu (-mingw32)
when clang is built with mingw-w64 4.9.1 or according to
http://llvm.org/PR20995  , mingw-w64 4.7.2 as well.

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

9 years agoDon't build invalid AST nodes during recovery
Reid Kleckner [Wed, 17 Dec 2014 19:34:15 +0000 (19:34 +0000)]
Don't build invalid AST nodes during recovery

A DependentScopeDeclRefExpr should always have a nested name specifier.
During template instantiation, if we found that the named context was
incomplete, we would previously build a DependentScopeDeclRefExpr with
an empty qualifier.

This error recovery path has been asserting for some time. The other
error codepaths use ExprError, so we can do the same.

Fixes PR21864.

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

9 years agoSupport constant evaluation for member calls on std::initializer_list
Richard Smith [Wed, 17 Dec 2014 19:24:30 +0000 (19:24 +0000)]
Support constant evaluation for member calls on std::initializer_list
temporaries.

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

9 years agoRevert "DebugInfo: Generalize debug info location handling"
David Blaikie [Wed, 17 Dec 2014 18:02:04 +0000 (18:02 +0000)]
Revert "DebugInfo: Generalize debug info location handling"

Fails an ASan bootstrap - I'll try to reproduce locally & sort that out
before recommitting.

This reverts commit r224385.

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

9 years agoBasic: clean up bleeding whitespace
Saleem Abdulrasool [Wed, 17 Dec 2014 17:52:33 +0000 (17:52 +0000)]
Basic: clean up bleeding whitespace

Whitespace cleanup.  NFC.

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

9 years agoCodeGen: implement __emit intrinsic
Saleem Abdulrasool [Wed, 17 Dec 2014 17:52:30 +0000 (17:52 +0000)]
CodeGen: implement __emit intrinsic

For MSVC compatibility, add the `__emit' builtin. This is used in the Windows
SDK headers, and must therefore be implemented as a builtin rather than an
intrinsic.

The `__emit' builtin provides a mechanism to emit a 16-bit opcode instruction
into the stream. The value must be a compile time constant expression. No
guarantees are made about the CPU and memory states after the execution of the
instruction.

Due to the unchecked nature of the builtin, only support this on Windows on ARM.

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

9 years agoRevert r224433, r224371 is good enough for now.
Joerg Sonnenberger [Wed, 17 Dec 2014 17:14:11 +0000 (17:14 +0000)]
Revert r224433, r224371 is good enough for now.

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

9 years agoRangify for loop, NFC.
Yaron Keren [Wed, 17 Dec 2014 16:56:54 +0000 (16:56 +0000)]
Rangify for loop, NFC.

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

9 years agoDisable the keyword-as-macro warning for now until the noise level is
Joerg Sonnenberger [Wed, 17 Dec 2014 16:25:45 +0000 (16:25 +0000)]
Disable the keyword-as-macro warning for now until the noise level is
reduced.

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

9 years agos/ScheduleKind/SchedKind/ in \param. [-Wdocumentation]
NAKAMURA Takumi [Wed, 17 Dec 2014 14:47:06 +0000 (14:47 +0000)]
s/ScheduleKind/SchedKind/ in \param. [-Wdocumentation]

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

9 years agoExclude printLineState() in -Asserts. [-Wunused-function]
NAKAMURA Takumi [Wed, 17 Dec 2014 14:46:56 +0000 (14:46 +0000)]
Exclude printLineState() in -Asserts. [-Wunused-function]

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

9 years ago[mips] Always clobber $1 for MIPS inline asm.
Toma Tabacu [Wed, 17 Dec 2014 12:02:58 +0000 (12:02 +0000)]
[mips] Always clobber $1 for MIPS inline asm.

Summary:
Because GCC doesn't use $1 for code generation, inline assembly code can use $1 without having to add it to the clobbers list.

LLVM, on the other hand, does not shy away from using $1, and this can cause conflicts with inline assembly which assumes GCC-like code generation.

A solution to this problem is to make Clang automatically clobber $1 for all MIPS inline assembly.
This is not the optimal solution, but it seems like a necessary compromise, for now.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: cfe-commits

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

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

9 years agoTeach compile_commands.json test that windows-gnu is the new name for mingw32.
Yaron Keren [Wed, 17 Dec 2014 11:04:07 +0000 (11:04 +0000)]
Teach compile_commands.json test that windows-gnu is the new name for mingw32.

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

9 years agoTeach lit.cfg to recognize -windows-gnu in addition to -mingw32.
Yaron Keren [Wed, 17 Dec 2014 09:55:15 +0000 (09:55 +0000)]
Teach lit.cfg to recognize -windows-gnu in addition to -mingw32.

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

9 years agoclang-format: Fix incorrect calculation of token lenghts.
Daniel Jasper [Wed, 17 Dec 2014 09:11:08 +0000 (09:11 +0000)]
clang-format: Fix incorrect calculation of token lenghts.

This led, e.g. to break JavaScript regex literals too early.

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

9 years agoSema: Don't dyn_cast a null pointer in CheckUsingDeclQualifier
David Majnemer [Wed, 17 Dec 2014 02:41:36 +0000 (02:41 +0000)]
Sema: Don't dyn_cast a null pointer in CheckUsingDeclQualifier

This code was written with the intent that a pointer could be null but
we dyn_cast'd it anyway.  Change the dyn_cast to a dyn_cast_or_null.

This fixes PR21933.

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

9 years agoParse: Consume tokens more carefully in CheckForLParenAfterColonColon
David Majnemer [Wed, 17 Dec 2014 01:39:22 +0000 (01:39 +0000)]
Parse: Consume tokens more carefully in CheckForLParenAfterColonColon

We would consume the lparen even if it wasn't followed by an identifier
or a star-identifier pair.

This fixes PR21815.

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

9 years agoAdd missing testcase from r224388.
Richard Smith [Wed, 17 Dec 2014 01:08:39 +0000 (01:08 +0000)]
Add missing testcase from r224388.

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

9 years ago[CallGraph] Make sure the edges are not missed due to re-declarations
Anna Zaks [Wed, 17 Dec 2014 00:34:07 +0000 (00:34 +0000)]
[CallGraph] Make sure the edges are not missed due to re-declarations

A patch by Daniel DeFreez!

We were previously dropping edges on re-declarations. Store the
canonical declarations in the graph to ensure that different
references to the same function end up reflected with the same call graph
node.

(Note, this might lead to performance fluctuation because call graph
is used to determine the function analysis order.)

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

9 years agoPR21909: Don't try (and crash) to generate debug info for explicit instantiations...
David Blaikie [Tue, 16 Dec 2014 23:49:18 +0000 (23:49 +0000)]
PR21909: Don't try (and crash) to generate debug info for explicit instantiations of explicit specializations.

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

9 years agoDR1684: a constexpr member function need not be a member of a literal class type.
Richard Smith [Tue, 16 Dec 2014 23:12:52 +0000 (23:12 +0000)]
DR1684: a constexpr member function need not be a member of a literal class type.

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

9 years agoTry typo correction on all initialization arguments and be less
Kaelyn Takata [Tue, 16 Dec 2014 23:07:00 +0000 (23:07 +0000)]
Try typo correction on all initialization arguments and be less
pessimistic about when to do so.

This also fixes PR21905 as the initialization argument was no longer
viewed as being type dependent due to the TypoExpr being type-cast.

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

9 years agoDebugInfo: Generalize debug info location handling
David Blaikie [Tue, 16 Dec 2014 22:49:17 +0000 (22:49 +0000)]
DebugInfo: Generalize debug info location handling

This is a more scalable (fixed in mostly one place, rather than many
places that will need constant improvement/maintenance) solution to
several commits I've made recently to increase source fidelity for
subexpressions.

This resetting had to be done at the DebugLoc level (not the
SourceLocation level) to preserve scoping information (if the resetting
was done with CGDebugInfo::EmitLocation, it would've caused the tail end
of an expression's codegen to end up in a potentially different scope
than the start, even though it was at the same source location). The
drawback to this is that it might leave CGDebugInfo out of sync. Ideally
CGDebugInfo shouldn't have a duplicate sense of the current
SourceLocation, but for now it seems it does... - I don't think I'm
going to tackle removing that just now.

I expect this'll probably cause some more buildbot fallout & I'll
investigate that as it comes up.

Also these sort of improvements might be starting to show a weakness/bug
in LLVM's line table handling: we don't correctly emit is_stmt for
statements, we just put it on every line table entry. This means one
statement split over multiple lines appears as multiple 'statements' and
two statements on one line (without column info) are treated as one
statement.

I don't think we have any IR representation of statements that would
help us distinguish these cases and identify the beginning of each
statement - so that might be something we need to add (possibly to the
lexical scope chain - a scope for each statement). This does cause some
problems for GDB and possibly other DWARF consumers.

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

9 years agoLook at whether TransformTypos returned a different Expr instead of looking at the...
Nick Lewycky [Tue, 16 Dec 2014 22:02:06 +0000 (22:02 +0000)]
Look at whether TransformTypos returned a different Expr instead of looking at the number of uncorrected typos before and after. Correcting one typo may produce an expression with another TypoExpr in it, leading to matching counts even though a typo was corrected.

Fixes PR21925!

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

9 years agoFix handling of invalid -O options.
Rafael Espindola [Tue, 16 Dec 2014 21:57:03 +0000 (21:57 +0000)]
Fix handling of invalid -O options.

We were checking the value after truncating it to a bitfield.

Thanks to Yunzhong Gao for noticing it.

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

9 years agoFix typo in comment. NFC.
Nick Lewycky [Tue, 16 Dec 2014 21:48:39 +0000 (21:48 +0000)]
Fix typo in comment. NFC.

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

9 years agoAdd a new flag, -fspell-checking-limit=<number> to control how many times we'll do...
Nick Lewycky [Tue, 16 Dec 2014 21:39:02 +0000 (21:39 +0000)]
Add a new flag, -fspell-checking-limit=<number> to control how many times we'll do spell checking. Note that spell checking will change the produced AST, so we don't automatically change this value when someone sets -ferror-limit=. With this, merge test typo-correction-pt2.cpp into typo-correction.cpp.

Remove Sema::UnqualifiedTyposCorrected, a cache of corrected typos. It would only cache typo corrections that didn't provide ValidateCandidate of which there were few left, and it had a bug when we had the same identifier spelled wrong twice. See the last two tests in typo-correction.cpp for cases this fires.

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

9 years agoMove -Wkeyword-macro into -pedantic, remove -Wreserved-id-macro.
Nico Weber [Tue, 16 Dec 2014 21:16:10 +0000 (21:16 +0000)]
Move -Wkeyword-macro into -pedantic, remove -Wreserved-id-macro.

As discussed on the post-commit review thread for r224012, -Wkeyword-macro fires
mostly on headers trying to set up portable defines and doesn't find much bad
stuff in practice.  But [macro.names]p2 does disallow defining or undefining
keywords, override and final, and alignas, so keep the warning but move it
into -pedantic.

-Wreserved-id-macro warns on

    #define __need_size_t

which is more or less public api for glibc headers. Since this warning isn't
motivated by a standard, remove it.

(See also r223114 for a previous follow-up to r224012.)

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

9 years agoPut static local variables of inline functions in the function comdat.
Rafael Espindola [Tue, 16 Dec 2014 21:00:30 +0000 (21:00 +0000)]
Put static local variables of inline functions in the function comdat.

The variable (and the GV) is only ever used if the function is. Putting it
in the function's comdat make it easier for the linker to discard them.

The motivating example is

struct S {
  static const int x;
};
// const int S::x = 42;
inline const int *f() {
  static const int y = S::x;
  return &y;
}
const int *g() { return f(); }

With S::x commented out, _ZZ1fvE1y is a variable with a guard variable
that is initialized by f.

With S::x present, _ZZ1fvE1y is a constant.

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

9 years agoConsider calls from implict host device functions as valid in SemaCUDA.
Jacques Pienaar [Tue, 16 Dec 2014 20:12:38 +0000 (20:12 +0000)]
Consider calls from implict host device functions as valid in SemaCUDA.

In SemaCUDA all implicit functions were considered host device, this led to
errors such as the following code snippet failing to compile:

struct Copyable {
  const Copyable& operator=(const Copyable& x) { return *this; }
};

struct Simple {
  Copyable b;
};

void foo() {
  Simple a, b;

  a = b;
}

Above the implicit copy assignment operator was inferred as host device but
there was only a host assignment copy defined which is an error in device
compilation mode.

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

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

9 years agoRenamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.
Alexey Bataev [Tue, 16 Dec 2014 08:01:48 +0000 (08:01 +0000)]
Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.
Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments.
No functional changes.

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

9 years ago[OPENMP] Bugfix for processing of global variables in OpenMP regions.
Alexey Bataev [Tue, 16 Dec 2014 07:00:22 +0000 (07:00 +0000)]
[OPENMP] Bugfix for processing of global variables in OpenMP regions.
Currently, if global variable is marked as a private OpenMP variable, the compiler crashes in debug version or generates incorrect code in release version. It happens because in the OpenMP region the original global variable is used instead of the generated private copy. It happens because currently globals variables are not captured in the OpenMP region.
This patch adds capturing of global variables iff private copy of the global variable must be used in the OpenMP region.
Differential Revision: http://reviews.llvm.org/D6259

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

9 years agoSema: Don't crash converting to bool from _Atomic
David Majnemer [Tue, 16 Dec 2014 06:31:17 +0000 (06:31 +0000)]
Sema: Don't crash converting to bool from _Atomic

Turning our _Atomic L-value into an R-value removes its _Atomic-ness.
However, we didn't update our 'FromType' which made
ScalarTypeToBooleanCastKind think we were trying to pass it a
non-scalar.

This fixes PR21836.

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

9 years agoImprove handling of value dependent expressions in __attribute__((enable_if)), both...
Nick Lewycky [Tue, 16 Dec 2014 06:12:01 +0000 (06:12 +0000)]
Improve handling of value dependent expressions in __attribute__((enable_if)), both in the condition expression and at the call site. Fixes PR20988!

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

9 years agoAST: Fix the linkage of static vars in fn template specializations
David Majnemer [Tue, 16 Dec 2014 04:52:14 +0000 (04:52 +0000)]
AST: Fix the linkage of static vars in fn template specializations

We that static variables in function template specializations were
externally visible.  The manglers assumed that externally visible static
variables were numbered in Sema.  We would end up mangling static
variables in the same specialization with the same mangling number which
would give all of them the same name.

This fixes PR21904.

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

9 years agoClarify the code in checkDLLAttribute()
Hans Wennborg [Tue, 16 Dec 2014 01:15:01 +0000 (01:15 +0000)]
Clarify the code in checkDLLAttribute()

Update the comments to make it more clear what's going on, and address
Richard's comments from PR21718. This doesn't fix that bug, but hopefully
makes the code easier to understand.

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

9 years agoSema: Check value dependent casts when possible
David Majnemer [Tue, 16 Dec 2014 00:46:30 +0000 (00:46 +0000)]
Sema: Check value dependent casts when possible

We know that const_cast<char *>((void)Something) is ill-formed, even if
'Something' is dependent because you can't cast from void to a pointer
type.

This fixes PR21845.

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

9 years agoDiagnose function template definitions inside functions
Reid Kleckner [Mon, 15 Dec 2014 23:16:32 +0000 (23:16 +0000)]
Diagnose function template definitions inside functions

The parser can only be tricked into parsing a function template
definition by inserting a typename keyword before the function template
declaration. This used to make us crash, and now it's fixed.

While here, remove an unneeded boolean parameter from ParseDeclGroup.
This boolean always corresponded to non-typedef declarators at file
scope. ParseDeclGroup already has precise diagnostics for the function
definition typedef case, so we can let that through.

Fixes PR21839.

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

9 years agoSilene -Wreorder warning.
Roman Divacky [Mon, 15 Dec 2014 21:41:59 +0000 (21:41 +0000)]
Silene -Wreorder warning.

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

9 years agoHandle errors in lambda prototype instantiation correctly
Reid Kleckner [Mon, 15 Dec 2014 21:07:16 +0000 (21:07 +0000)]
Handle errors in lambda prototype instantiation correctly

Previously we would attempt to build a TypeSourceInfo for a null type,
and then we would forget to pop the function scope before returning an
error.

Reviewers: rsmith

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

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

9 years agoSema: Cleanup and improve string-plus-char checking.
Daniel Marjamaki [Mon, 15 Dec 2014 20:22:33 +0000 (20:22 +0000)]
Sema: Cleanup and improve string-plus-char checking.

Patch by Anders Rönnholm

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

9 years agoUpdate this testcase for the new metadata assembler syntax.
Adrian Prantl [Mon, 15 Dec 2014 19:25:33 +0000 (19:25 +0000)]
Update this testcase for the new metadata assembler syntax.

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

9 years agoIR: Make metadata typeless in assembly, clang side
Duncan P. N. Exon Smith [Mon, 15 Dec 2014 19:10:08 +0000 (19:10 +0000)]
IR: Make metadata typeless in assembly, clang side

Match LLVM changes from r224257.

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

9 years agoWarn when attribute 'optnone' conflicts with attributes on a
Paul Robinson [Mon, 15 Dec 2014 18:57:28 +0000 (18:57 +0000)]
Warn when attribute 'optnone' conflicts with attributes on a
different declaration of the same function.

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

9 years agoAdd voidType() matcher.
Samuel Benzaquen [Mon, 15 Dec 2014 15:09:22 +0000 (15:09 +0000)]
Add voidType() matcher.

Summary: Add voidType() matcher.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

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

9 years agoSema: Don't diagnose string + int if the int is value dependent
David Majnemer [Mon, 15 Dec 2014 10:00:35 +0000 (10:00 +0000)]
Sema: Don't diagnose string + int if the int is value dependent

Don't send a value dependent expression into the expression evaluator,
HandleSizeof would crash.  Making HandleSizeof handle dependent types
would noisily warn about the operation even if everything turns out OK
after instantiation.

This fixes PR21848.

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

9 years agoPreprocessor: Recover instead of mutating a token in ExpandBuiltinMacro
David Majnemer [Mon, 15 Dec 2014 09:03:58 +0000 (09:03 +0000)]
Preprocessor: Recover instead of mutating a token in ExpandBuiltinMacro

We would CreateString on arbitrary garbage instead of just skipping to
the end of the builtin macro.  Eventually, this would cause us to crash
because we would end up replacing the contents of a character token with
a numeric literal.

This fixes PR21825.

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

9 years agoSema: Don't leave switch stack inconsistent when recovering
David Majnemer [Mon, 15 Dec 2014 07:46:12 +0000 (07:46 +0000)]
Sema: Don't leave switch stack inconsistent when recovering

We would exit Sema::ActOnFinishSwitchStmt early if we didn't have a
body.  This would leave an extra SwitchStmt on the SwitchStack.

This fixes PR21841.

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

9 years agoTest for 'omp for' (for r224233).
Alexander Musman [Mon, 15 Dec 2014 07:08:38 +0000 (07:08 +0000)]
Test for 'omp for' (for r224233).

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

9 years agoFirst patch with codegen of the 'omp for' directive. It implements
Alexander Musman [Mon, 15 Dec 2014 07:07:06 +0000 (07:07 +0000)]
First patch with codegen of the 'omp for' directive. It implements
the simplest case, which is used when no chunk_size is specified in
the schedule(static) or no 'schedule' clause is specified - the
iteration space is divided by the library into chunks that are
approximately equal in size, and at most one chunk is distributed
to each thread. In this case, we do not need an outer loop in each
thread - each thread requests once which iterations range it should
handle (using __kmpc_for_static_init runtime call) and then runs the
inner loop on this range.

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

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

9 years agoParse: Don't reorder tokens using ConsumeToken
David Majnemer [Mon, 15 Dec 2014 07:00:05 +0000 (07:00 +0000)]
Parse: Don't reorder tokens using ConsumeToken

ConsumeToken doesn't work with special tokens.  Instead, just use PP.Lex
to eat the token.

This fixes PR21817.

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

9 years agoFixed test/CodeGen/atomic_ops.c for compatibility with hexagon target
Alexey Bataev [Mon, 15 Dec 2014 06:12:42 +0000 (06:12 +0000)]
Fixed test/CodeGen/atomic_ops.c for compatibility with hexagon target

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

9 years agoBugfix for Codegen of atomic load/store/other ops.
Alexey Bataev [Mon, 15 Dec 2014 05:25:25 +0000 (05:25 +0000)]
Bugfix for Codegen of atomic load/store/other ops.
Currently clang fires assertions on x86-64 on any atomic operations for long double operands. Patch fixes codegen for such operations.
Differential Revision: http://reviews.llvm.org/D6499

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

9 years agoMSVC: A wide string literal from L#macro_arg in a macro
Alexey Bataev [Mon, 15 Dec 2014 04:18:11 +0000 (04:18 +0000)]
MSVC: A wide string literal from L#macro_arg in a macro
Clang should form a wide string literal from L#macro_arg in a function-like macro in -fms-compatibility mode.
Fix for http://llvm.org/PR9984.
Differential Revision: http://reviews.llvm.org/D6604

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

9 years agoDon't break single-line raw string literals.
Alexander Kornienko [Sun, 14 Dec 2014 20:47:11 +0000 (20:47 +0000)]
Don't break single-line raw string literals.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

9 years agoDebugInfo: More accurate line information for placement new.
David Blaikie [Sun, 14 Dec 2014 18:48:18 +0000 (18:48 +0000)]
DebugInfo: More accurate line information for placement new.

This actually came up as a break in UBSan tests (look for a follow-up
commit to this one to see the UBSan test fallout) when I tried a broader
fix to location information.

I have some other ideas about how to do that broader change & will keep
looking into it.

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

9 years agoCodeGen: Compound literals with funny types shouldn't crash
David Majnemer [Sun, 14 Dec 2014 12:16:43 +0000 (12:16 +0000)]
CodeGen: Compound literals with funny types shouldn't crash

CodeGen assumed that a compound literal with array type should have a
corresponding LLVM IR array type.

We had two bugs in this area:
- Zero sized arrays in compound literals would lead to the creation of
  an opaque type.  This is unnecessary, we should just create an array
  type with a bound of zero.
- Funny record types (like unions) lead to exotic IR types for compound
  literals.  In this case, CodeGen must be prepared to deal with the
  possibility that it might not have an array IR type.

This fixes PR21912.

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

9 years agoAST: Limit zero-sized constexpr behavior to array types
David Majnemer [Sun, 14 Dec 2014 08:40:47 +0000 (08:40 +0000)]
AST: Limit zero-sized constexpr behavior to array types

Restricting this "extension" to array types maximizes our standards
conformance while not miscompiling real-world programs.

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

9 years agoLex: Don't crash if both conflict markers are on the same line
David Majnemer [Sun, 14 Dec 2014 04:53:11 +0000 (04:53 +0000)]
Lex: Don't crash if both conflict markers are on the same line

We would check if the terminator marker is on a newline.  However, the
logic would end up out-of-bounds if the terminator marker immediately
follows the start marker.

This fixes PR21820.

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

9 years agoIf a non-template constructor instantiated to X(X),
John McCall [Sun, 14 Dec 2014 01:46:53 +0000 (01:46 +0000)]
If a non-template constructor instantiated to X(X),
ignore it during overload resolution when initializing
X from a value of type cv X.

Previously, our rule here only ignored specializations
of constructor templates.  That's probably because the
standard says that constructors are outright ill-formed
if their first parameter is literally X and they're
callable with one argument.  However, Clang only
enforces that prohibition against non-implicit
instantiations; I'm not sure why, but it seems to be
deliberate.  Given that, the most sensible thing to
do is to just ignore the "illegal" constructor
regardless of where it came from.

Also, stop ignoring such constructors silently:
print a note explaining why they're being ignored.

Fixes <rdar://19199836>.

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

9 years agoSema: attribute((annotate)) must have at least one argument
David Majnemer [Sun, 14 Dec 2014 01:05:01 +0000 (01:05 +0000)]
Sema: attribute((annotate)) must have at least one argument

Sema::handleAnnotateAttr expects that some basic validation is done on
the given AttributeList.  However, ProcessAccessDeclAttributeList called
it directly.  Instead, pass the list to ProcessDeclAttribute.

This fixes PR21847.

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

9 years agoclang-cl: Fix handling of the /volatile flag (PR21893)
Hans Wennborg [Sat, 13 Dec 2014 22:44:46 +0000 (22:44 +0000)]
clang-cl: Fix handling of the /volatile flag (PR21893)

The /volatile:iso flag is our default behaviour, so it can be ignored.

Parse /volatile:ms as unsupported.

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

9 years agoclang-cl: ignore /cgthreads (PR21894)
Hans Wennborg [Sat, 13 Dec 2014 22:24:16 +0000 (22:24 +0000)]
clang-cl: ignore /cgthreads (PR21894)

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

9 years agoclang-cl: Make /Gd ignored instead of unsupported
Hans Wennborg [Sat, 13 Dec 2014 22:13:23 +0000 (22:13 +0000)]
clang-cl: Make /Gd ignored instead of unsupported

/Gd is the default calling convention setting, so we don't
need to take any action.

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

9 years agoclang-cl: Add unsupported /Gv option (PR21892)
Hans Wennborg [Sat, 13 Dec 2014 22:06:23 +0000 (22:06 +0000)]
clang-cl: Add unsupported /Gv option (PR21892)

We don't currently support any of the calling convention options.

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

9 years agoParse: MS property members cannot have an in-class initializer
David Majnemer [Sat, 13 Dec 2014 11:34:16 +0000 (11:34 +0000)]
Parse: MS property members cannot have an in-class initializer

We would crash trying to treat a property member as a field.  These
shoudl be forbidden anyway, reject programs which contain them.

This fixes PR21840.

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

9 years agoSema: Constexpr functions must have return statements which have an expr
David Majnemer [Sat, 13 Dec 2014 08:12:56 +0000 (08:12 +0000)]
Sema: Constexpr functions must have return statements which have an expr

clang lets programmers be pretty cavalier when it comes to void return
statements in functions which have non-void return types.  However, we
cannot be so forgiving in constexpr functions: evaluation will go off
the rails very quickly.

Instead, keep the return statement in the AST but mark the function as
invalid.  Doing so gives us nice diagnostics while making constexpr
evaluation halt.

This fixes PR21859.

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

9 years agoNFC: Minor formatting fix
Will Wilson [Sat, 13 Dec 2014 04:38:19 +0000 (04:38 +0000)]
NFC: Minor formatting fix

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

9 years agoPretty print support for template arg enum constants
Will Wilson [Sat, 13 Dec 2014 04:31:07 +0000 (04:31 +0000)]
Pretty print support for template arg enum constants

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

9 years agoFix two small bugs in typo correction. One assertion failure building member expressi...
Nick Lewycky [Sat, 13 Dec 2014 02:54:28 +0000 (02:54 +0000)]
Fix two small bugs in typo correction. One assertion failure building member expressions because the lookup finds a different name than the original, fixed by updating the LookupResult's name with the name of the found decl. Second is that we also diagnose delayed typo exprs in the index of an array subscript expression.

The testcase shows a third bug with a FIXME in it.

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

9 years agoImplement feedback on r224172 in PR21899
Reid Kleckner [Sat, 13 Dec 2014 01:11:23 +0000 (01:11 +0000)]
Implement feedback on r224172 in PR21899

Based on suggestions from Kaelyn.

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

9 years agoTypo correction: Ignore temporary binding exprs after overload resolution
Reid Kleckner [Sat, 13 Dec 2014 00:53:10 +0000 (00:53 +0000)]
Typo correction: Ignore temporary binding exprs after overload resolution

Transformation of a CallExpr doesn't always result in a new CallExpr.

Fixes PR21899.

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

9 years agoImplement the __builtin_call_with_static_chain GNU extension.
Peter Collingbourne [Fri, 12 Dec 2014 23:41:25 +0000 (23:41 +0000)]
Implement the __builtin_call_with_static_chain GNU extension.

The extension has the following syntax:

  __builtin_call_with_static_chain(Call, Chain)
  where Call must be a function call expression and Chain must be of pointer type

This extension performs a function call Call with a static chain pointer
Chain passed to the callee in a designated register. This is useful for
calling foreign language functions whose ABI uses static chain pointers
(e.g. to implement closures).

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

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

9 years agoFrontend: Canonicalize to native paths when dumping module dependencies
Justin Bogner [Fri, 12 Dec 2014 23:12:27 +0000 (23:12 +0000)]
Frontend: Canonicalize to native paths when dumping module dependencies

Mixed path separators (ie, both / and \\) can mess up the sort order
of the VFS map when dumping module dependencies, as was recently
exposed by r224055 and papered over in r224145. Instead, we should
simply use native paths for consistency.

This also adds a TODO to add handling of .. in paths. There was some
code for this before r224055, but it was untested and probably broken.

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

9 years agoAllow module deps to be printed in an arbitrary order
Reid Kleckner [Fri, 12 Dec 2014 19:13:04 +0000 (19:13 +0000)]
Allow module deps to be printed in an arbitrary order

The order is different between Windows and Unix for reasons unknown, but
the compiler output appears to still be determinstic.

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

9 years agoFix the issue of mangling of local anonymous unions (Itanium C++ ABI):
Evgeny Astigeevich [Fri, 12 Dec 2014 16:17:46 +0000 (16:17 +0000)]
Fix the issue of mangling of local anonymous unions (Itanium C++ ABI):
A discriminator is used for the first occurrence of a name.
inline int f1 () {
  static union {
    int a;
    long int b;
  };

  static union {
    int c;
    double d;
  };

  return a+c;
}
The name of the second union is mangled as _ZZ2f1vE1c_0 instead of _ZZ2f1vE1c.

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

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