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

9 years agoDon't break string literals in Java and JavaScript.
Alexander Kornienko [Fri, 12 Dec 2014 13:03:22 +0000 (13:03 +0000)]
Don't break string literals in Java and JavaScript.

The proper way to break string literals in these languages is by inserting a "+"
between parts which we don't support yet. So we disable string literal breaking
until then.

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

9 years agoclang-format: Revamp nested block formatting.
Daniel Jasper [Fri, 12 Dec 2014 09:40:58 +0000 (09:40 +0000)]
clang-format: Revamp nested block formatting.

This fixed llvm.org/PR21804 and hopefully a few other strange cases.

Before:
    if (blah_blah(whatever, whatever, [] {
      doo_dah();
      doo_dah();
    })) {
    }
    }

After:
    if (blah_blah(whatever, whatever, [] {
          doo_dah();
          doo_dah();
        })) {
    }
    }

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

9 years agoCodeGen: Loads/stores to allocas for atomic ops shouldn't be volatile
David Majnemer [Fri, 12 Dec 2014 08:16:09 +0000 (08:16 +0000)]
CodeGen: Loads/stores to allocas for atomic ops shouldn't be volatile

Don't inherit the volatile-ness of the input pointer to the volatile
operation for memory allocated on the side.

This fixes PR17306.

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

9 years agoDo not warn on keyword undef
Serge Pavlov [Fri, 12 Dec 2014 06:37:55 +0000 (06:37 +0000)]
Do not warn on keyword undef

#undef a keyword is generally harmless but used often in configuration scripts.
Also added tests that I forgot to include to commit in r223114.

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

9 years ago[Objective-C]. This patch extends objc_bridge attribute to support objc_bridge(id).
Fariborz Jahanian [Thu, 11 Dec 2014 22:56:26 +0000 (22:56 +0000)]
[Objective-C]. This patch extends  objc_bridge attribute to support objc_bridge(id).
This means that a pointer to the struct type to which the attribute appertains
is a CF type (and therefore an Objective-C object of some type), but not of any
specific class. rdar://19157264

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

9 years ago[modules] When constructing paths relative to a module, strip out /./ directory
Richard Smith [Thu, 11 Dec 2014 20:50:24 +0000 (20:50 +0000)]
[modules] When constructing paths relative to a module, strip out /./ directory
components. These sometimes get synthetically added, and we don't want -Ifoo
and -I./foo to be treated fundamentally differently here.

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

9 years agoInstead of having -Os/-Oz add OptimizeForSize/MinSize first, and later
Paul Robinson [Thu, 11 Dec 2014 20:14:04 +0000 (20:14 +0000)]
Instead of having -Os/-Oz add OptimizeForSize/MinSize first, and later
having OptimizeNone remove them again, just don't add them in the
first place if the function already has OptimizeNone.

Note that MinSize can still appear due to attributes on different
declarations; a future patch will address that.

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

9 years agoAST: Incomplete types might be zero sized
David Majnemer [Thu, 11 Dec 2014 19:36:24 +0000 (19:36 +0000)]
AST: Incomplete types might be zero sized

Comparing the address of an object with an incomplete type might return
true with a 'distinct' object if the former has a size of zero.
However, such an object should compare unequal with null.

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

9 years agoWhen checking for nonnull parameter attributes, also check the ParmVarDecl since...
Aaron Ballman [Thu, 11 Dec 2014 19:35:42 +0000 (19:35 +0000)]
When checking for nonnull parameter attributes, also check the ParmVarDecl since the attribute may reside there, instead of just on the FunctionDecl. Fixes PR21668.

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

9 years agoEmit warning if define or undef reserved identifier or keyword.
Serge Pavlov [Thu, 11 Dec 2014 12:18:08 +0000 (12:18 +0000)]
Emit warning if define or undef reserved identifier or keyword.

Recommit of r223114, reverted in r223120.

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

9 years agoMS ABI: Fix mangling of unsigned int template params
Will Wilson [Thu, 11 Dec 2014 05:47:10 +0000 (05:47 +0000)]
MS ABI: Fix mangling of unsigned int template params

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

9 years agoParse: Concatenated string literals should be verified in inline asm
David Majnemer [Thu, 11 Dec 2014 01:00:48 +0000 (01:00 +0000)]
Parse: Concatenated string literals should be verified in inline asm

While we would correctly handle asm("foo") and reject asm(L"bar"), we
weren't careful to handle cases where an ascii literal could be
concatenated with a wide literal.

This fixes PR21822.

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

9 years agoRevert r223578, perf data collection depends on the old symbol name.
Paul Robinson [Wed, 10 Dec 2014 23:49:03 +0000 (23:49 +0000)]
Revert r223578, perf data collection depends on the old symbol name.

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

9 years agoDiagnose attributes 'optnone' and 'minsize' on the same declaration.
Paul Robinson [Wed, 10 Dec 2014 23:34:36 +0000 (23:34 +0000)]
Diagnose attributes 'optnone' and 'minsize' on the same declaration.

Eventually we'll diagnose them on different declarations, but let's
get this part out of the way first.

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

9 years agoRevert r223980 as it had wrong commit message.
Paul Robinson [Wed, 10 Dec 2014 23:32:57 +0000 (23:32 +0000)]
Revert r223980 as it had wrong commit message.

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