]> granicus.if.org Git - clang/log
clang
12 years agoConvert DiagnoseEmptyLookup to use correction callbacks.
Kaelyn Uhrain [Wed, 18 Jan 2012 05:58:54 +0000 (05:58 +0000)]
Convert DiagnoseEmptyLookup to use correction callbacks.

No new unit tests yet as there is no behavioral change
(except for slightly more specific filtering in
Sema::ActOnStartOfLambdaDefinition). Tests will be added
as the code paths are traced in greater depth to determine
how to improve the results--there are at least one or two
known bugs that require those improvements. This commit
lays the groundwork for those changes.

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

12 years agoMove narrowing conversion detection code from SemaInit to SemaOverload, ready
Richard Smith [Wed, 18 Jan 2012 05:21:49 +0000 (05:21 +0000)]
Move narrowing conversion detection code from SemaInit to SemaOverload, ready
for it to be used in converted constant expression checking, and fix a couple
of issues:
 - Conversion operators implicitly invoked prior to the narrowing conversion
   were not being correctly handled when determining whether a constant value
   was narrowed.
 - For conversions from floating-point to integral types, the diagnostic text
   incorrectly always claimed that the source expression was not a constant
   expression.

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

12 years agoAdd testcase for r148375!
Nick Lewycky [Wed, 18 Jan 2012 04:28:31 +0000 (04:28 +0000)]
Add testcase for r148375!

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

12 years agoMake PotentiallyPotentiallyEvaluated contexts work correctly when referencing a class...
Eli Friedman [Wed, 18 Jan 2012 03:53:45 +0000 (03:53 +0000)]
Make PotentiallyPotentiallyEvaluated contexts work correctly when referencing a class field from outside an instance method.

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

12 years agoFix a string over-run detected by ASAN.
Nick Lewycky [Wed, 18 Jan 2012 03:41:19 +0000 (03:41 +0000)]
Fix a string over-run detected by ASAN.

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

12 years agoA call to strlen is not a constant expression, even if we're treating it as a
Richard Smith [Wed, 18 Jan 2012 03:06:12 +0000 (03:06 +0000)]
A call to strlen is not a constant expression, even if we're treating it as a
builtin.

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

12 years agoThe value of a case statement is a potentially evaluated context. Found by inspection.
Eli Friedman [Wed, 18 Jan 2012 02:54:10 +0000 (02:54 +0000)]
The value of a case statement is a potentially evaluated context. Found by inspection.

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

12 years ago[analyzer] Refactor: prePropagateTaint ->
Anna Zaks [Wed, 18 Jan 2012 02:45:13 +0000 (02:45 +0000)]
[analyzer] Refactor: prePropagateTaint ->
TaintPropagationRule::process().

Also remove the "should be a pointer argument" warning - should be
handled elsewhere.

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

12 years ago[analyzer] Taint: warn when tainted data is used to specify a buffer
Anna Zaks [Wed, 18 Jan 2012 02:45:11 +0000 (02:45 +0000)]
[analyzer] Taint: warn when tainted data is used to specify a buffer
size (Ex: in malloc, memcpy, strncpy..)

(Maybe some of this could migrate to the CString checker. One issue
with that is that we might want to separate security issues from
regular API misuse.)

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

12 years ago[analyzer] Taint: add taint propagation rules for string and memory copy
Anna Zaks [Wed, 18 Jan 2012 02:45:07 +0000 (02:45 +0000)]
[analyzer] Taint: add taint propagation rules for string and memory copy
functions.

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

12 years agoConstify FunctionDecl::getmemoryFunctionKind().
Anna Zaks [Wed, 18 Jan 2012 02:45:01 +0000 (02:45 +0000)]
Constify FunctionDecl::getmemoryFunctionKind().

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

12 years agoFix special king of typo.
Nick Lewycky [Wed, 18 Jan 2012 01:50:13 +0000 (01:50 +0000)]
Fix special king of typo.

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

12 years agoFix a couple issues where we didn't correctly delay diagnostics in PotentiallyPotenti...
Eli Friedman [Wed, 18 Jan 2012 01:05:54 +0000 (01:05 +0000)]
Fix a couple issues where we didn't correctly delay diagnostics in PotentiallyPotentiallyEvaluated contexts.  In preparation for making sizeof() PotentiallyPotentiallyEvaluated.

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

12 years agooutput body of folded case again.
Fariborz Jahanian [Tue, 17 Jan 2012 23:55:19 +0000 (23:55 +0000)]
output body of folded case again.

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

12 years agoFolding away unreachable case statement.
Fariborz Jahanian [Tue, 17 Jan 2012 23:39:50 +0000 (23:39 +0000)]
Folding away unreachable case statement.
patch (slightly revised) by Aaron Ballman.

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

12 years agoMake sure to initialize ExternalProtocolPtrTy
Douglas Gregor [Tue, 17 Jan 2012 23:38:32 +0000 (23:38 +0000)]
Make sure to initialize ExternalProtocolPtrTy

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

12 years agoobjc-arc: when 'assign' attribute is unspecified,
Fariborz Jahanian [Tue, 17 Jan 2012 22:58:16 +0000 (22:58 +0000)]
objc-arc: when 'assign' attribute is unspecified,
rely on property's type for its life-time to avoid
bogus warning with -Warc-unsafe-retained-assign.
// rdar://10694932

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

12 years agoAdd Sema::isInitListConstructor. This will be needed for upcoming work.
Sebastian Redl [Tue, 17 Jan 2012 22:50:14 +0000 (22:50 +0000)]
Add Sema::isInitListConstructor. This will be needed for upcoming work.

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

12 years agoAuto deduction support for std::initializer_list, including for-range support. This...
Sebastian Redl [Tue, 17 Jan 2012 22:50:08 +0000 (22:50 +0000)]
Auto deduction support for std::initializer_list, including for-range support. This means you can now write:

for (int i : {1, 4, 512, 23, 251}) {}

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

12 years agoTemplate argument deduction for std::initializer_list arguments from initializer...
Sebastian Redl [Tue, 17 Jan 2012 22:49:58 +0000 (22:49 +0000)]
Template argument deduction for std::initializer_list arguments from initializer lists.

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

12 years agoRename the first of 11 DeduceTemplateArguments overloads.
Sebastian Redl [Tue, 17 Jan 2012 22:49:52 +0000 (22:49 +0000)]
Rename the first of 11 DeduceTemplateArguments overloads.

There are 5 functions of this name in Sema, and 6 more static helpers in
SemaTemplateDeduction.cpp. The Sema functions have jobs like "deduce for
function call", "deduce for taking the address", etc. The static helpers
have jobs like "deduce by comparing two types", "deduce by comparing two
lists of types", "deduce by comparing two template arguments", etc.
The fact that they all are called the same and only differ in two of their
6 or more arguments makes the code using them very hard to read.

Here I rename the one function that concerns me most at the moment, but
as a matter of cleanup, the others will eventually be renamed as well.

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

12 years agoBasic overloading support for std::initializer_list.
Sebastian Redl [Tue, 17 Jan 2012 22:49:48 +0000 (22:49 +0000)]
Basic overloading support for std::initializer_list.

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

12 years agoSema support for initialization of std::initializer_list from initializer lists.
Sebastian Redl [Tue, 17 Jan 2012 22:49:42 +0000 (22:49 +0000)]
Sema support for initialization of std::initializer_list from initializer lists.

This does not yet support CodeGen.

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

12 years agoAdd Sema::isStdInitializerList, which will be necessary for the upcoming operations.
Sebastian Redl [Tue, 17 Jan 2012 22:49:33 +0000 (22:49 +0000)]
Add Sema::isStdInitializerList, which will be necessary for the upcoming operations.

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

12 years agofix for PR11655
Anton Yartsev [Tue, 17 Jan 2012 22:40:00 +0000 (22:40 +0000)]
fix for PR11655
changes i64 alignment from 64 to 32 for powerpc-darwin

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

12 years agoDisable -Wduplicate-method-match by default. <rdar://problem/10663536>
Bob Wilson [Tue, 17 Jan 2012 22:24:32 +0000 (22:24 +0000)]
Disable -Wduplicate-method-match by default.  <rdar://problem/10663536>

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

12 years agoAdd __builtin_labs and __builtin_llabs, to complete the set of __builtin_*abs. Patch...
Eli Friedman [Tue, 17 Jan 2012 22:11:30 +0000 (22:11 +0000)]
Add __builtin_labs and __builtin_llabs, to complete the set of __builtin_*abs.  Patch by Ruben Van Boxem.

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

12 years agoRemove constant member pointer support from Expr-based constant emission now
Richard Smith [Tue, 17 Jan 2012 21:42:19 +0000 (21:42 +0000)]
Remove constant member pointer support from Expr-based constant emission now
that APValue-based constant emission knows how to emit member pointers.

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

12 years agoCorrectly resolve an overload set passed to an overloaded operator=. PR11784.
Eli Friedman [Tue, 17 Jan 2012 21:27:43 +0000 (21:27 +0000)]
Correctly resolve an overload set passed to an overloaded operator=.  PR11784.

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

12 years agoEnable constant evaluation of implicit calls to constexpr conversion operators.
Richard Smith [Tue, 17 Jan 2012 21:17:26 +0000 (21:17 +0000)]
Enable constant evaluation of implicit calls to constexpr conversion operators.

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

12 years agoEnable the new ObjC ARC autorelease pool elimination pass.
Dan Gohman [Tue, 17 Jan 2012 20:54:51 +0000 (20:54 +0000)]
Enable the new ObjC ARC autorelease pool elimination pass.

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

12 years agoWhen initializing a catch variable in ARC, be sure to emit retains
John McCall [Tue, 17 Jan 2012 20:16:56 +0000 (20:16 +0000)]
When initializing a catch variable in ARC, be sure to emit retains
or whatever else is required for the initialization instead of
assuming it can be done with a simple store.

Fixes PR11732.

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

12 years agoFix a couples of issues in format strings checking.
Jean-Daniel Dupas [Tue, 17 Jan 2012 20:03:31 +0000 (20:03 +0000)]
Fix a couples of issues in format strings checking.
PR 10274: format function attribute with the NSString archetype yields no compiler warnings
PR 10275: format function attribute isn't checked in Objective-C methods

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

12 years agoRework the way in which we (de-)serialize the declarations
Douglas Gregor [Tue, 17 Jan 2012 19:21:53 +0000 (19:21 +0000)]
Rework the way in which we (de-)serialize the declarations
corresponding to TagType and ObjCInterfaceType. Previously, we would
serialize the definition (if available) or the canonical declaration
(if no definition was available). However, this can end up forcing the
deserialization of the definition even through we might not want to
yet.

Instead, always serialize the canonical declaration reference in the
TagType/ObjCInterfaceType entry, and as part of loading a pending
definition, update the "decl" pointer within the type node to point at
the definition. This is more robust in hard-to-isolate cases
where the *Type gets built and filled in before we see the definition.

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

12 years agoobjc: fixes a bug where struct used inside an
Fariborz Jahanian [Tue, 17 Jan 2012 18:52:07 +0000 (18:52 +0000)]
objc: fixes a bug where struct used inside an
objc class was not being exported to parent decl
context resulting in bogus mismatch warning later on.
// rdar://10655530

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

12 years ago[libclang] Make sure Preprocessor is set in ASTUnit during indexing.
Argyrios Kyrtzidis [Tue, 17 Jan 2012 18:48:07 +0000 (18:48 +0000)]
[libclang] Make sure Preprocessor is set in ASTUnit during indexing.

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

12 years agoDon't eagerly deserialize the 'Protocol' type when initializing code
Douglas Gregor [Tue, 17 Jan 2012 18:36:30 +0000 (18:36 +0000)]
Don't eagerly deserialize the 'Protocol' type when initializing code
generation for Objective-C; it may not be needed.

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

12 years agoWhen collecting all of the redeclarations of a declaration loaded from
Douglas Gregor [Tue, 17 Jan 2012 18:13:45 +0000 (18:13 +0000)]
When collecting all of the redeclarations of a declaration loaded from
a module file, be sure to also add the first (potentially canonical)
declarations to the chain. This isn't guaranteed to occur because the
first declaration is not listed in the stored redeclaration chain.

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

12 years agoDelay the creation of the built-in Objective-C class 'Protocol' by
Douglas Gregor [Tue, 17 Jan 2012 18:09:05 +0000 (18:09 +0000)]
Delay the creation of the built-in Objective-C class 'Protocol' by
moving it from a "special type" to a predefined declaration, as we do
for id, Class, and SEL.

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

12 years agoTreat -Wformat=0 as an alias for -Wformat.
Hans Wennborg [Tue, 17 Jan 2012 09:30:38 +0000 (09:30 +0000)]
Treat -Wformat=0 as an alias for -Wformat.

Fixes PR9195.

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

12 years agoRe-add an over-zealously removed break.
David Blaikie [Tue, 17 Jan 2012 08:24:58 +0000 (08:24 +0000)]
Re-add an over-zealously removed break.

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

12 years agoRemove dead comments as per Chandler's feedback to r148292
David Blaikie [Tue, 17 Jan 2012 07:28:46 +0000 (07:28 +0000)]
Remove dead comments as per Chandler's feedback to r148292

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

12 years agoRemove unreachable code in Clang. (replace with llvm_unreachable where appropriate...
David Blaikie [Tue, 17 Jan 2012 06:56:22 +0000 (06:56 +0000)]
Remove unreachable code in Clang. (replace with llvm_unreachable where appropriate or when GCC requires it)

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

12 years agoRemove unnecessary default cases in switches over enums.
David Blaikie [Tue, 17 Jan 2012 02:30:50 +0000 (02:30 +0000)]
Remove unnecessary default cases in switches over enums.

This allows -Wswitch-enum to find switches that need updating when these enums are modified.

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

12 years ago[libclang] Make clang_getCursorCompletionString not depend on the ASTUnit having
Argyrios Kyrtzidis [Tue, 17 Jan 2012 02:15:54 +0000 (02:15 +0000)]
[libclang] Make clang_getCursorCompletionString not depend on the ASTUnit having
a Sema.

This allows it to work when Sema is not available, like when loading AST files.

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

12 years agoIntroduce a CodeCompletionResult::CreateCodeCompletionString() that
Argyrios Kyrtzidis [Tue, 17 Jan 2012 02:15:51 +0000 (02:15 +0000)]
Introduce a CodeCompletionResult::CreateCodeCompletionString() that
does not depend on Sema, it accepts an ASTContext and a Preprocessor.

Step towards making clang_getCursorCompletionString not depend on Sema.

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

12 years agoIntroduce a static Sema::MarkDeducedTemplateParameters() that only depends
Argyrios Kyrtzidis [Tue, 17 Jan 2012 02:15:41 +0000 (02:15 +0000)]
Introduce a static Sema::MarkDeducedTemplateParameters() that only depends
on an ASTContext.

This is a step towards making clang_getCursorCompletionString not depend on Sema.

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

12 years agoRevert r148271; this requires more thought.
Eli Friedman [Tue, 17 Jan 2012 02:13:45 +0000 (02:13 +0000)]
Revert r148271; this requires more thought.

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

12 years agoChange the behavior of the lvalue-to-rvalue conversion for varargs in PotentiallyPote...
Eli Friedman [Tue, 17 Jan 2012 01:17:46 +0000 (01:17 +0000)]
Change the behavior of the lvalue-to-rvalue conversion for varargs in PotentiallyPotentiallyEvaluated contexts so that we model it in a sane way in most cases, and give up for the edge case which hopefully doesn't matter too much.

In preparation for correctly treating sizeof() as a PotentiallyPotentiallyEvaluated context.

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

12 years agoImprove diagnostics for dangling '}'.
Nico Weber [Tue, 17 Jan 2012 01:04:27 +0000 (01:04 +0000)]
Improve diagnostics for dangling '}'.

Fixes PR6484. Patch from Jason Switzer!

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

12 years agoUse Builtin ID as the return value
Anna Zaks [Tue, 17 Jan 2012 00:37:07 +0000 (00:37 +0000)]
Use Builtin ID as the return value
for FunctionDecl::getMemoryFunctionKind().

This is a follow up on the Chris's review for r148142: We don't want to
pollute FunctionDecl with an extra enum. (To make this work, added
memcmp and family to the library builtins.)

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

12 years ago[analyzer] Taint: generalize taint propagation to simplify adding more
Anna Zaks [Tue, 17 Jan 2012 00:37:02 +0000 (00:37 +0000)]
[analyzer] Taint: generalize taint propagation to simplify adding more
taint propagation functions.

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

12 years agoAdd new line.
Tanya Lattner [Mon, 16 Jan 2012 21:15:33 +0000 (21:15 +0000)]
Add new line.

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

12 years agoAdd support for OpenCL 1.1 logical operations.
Tanya Lattner [Mon, 16 Jan 2012 21:02:28 +0000 (21:02 +0000)]
Add support for OpenCL 1.1 logical operations.

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

12 years agoAdd some calls to MarkDeclarationReferenced, towards a point where every declaration...
Eli Friedman [Mon, 16 Jan 2012 21:00:51 +0000 (21:00 +0000)]
Add some calls to MarkDeclarationReferenced, towards a point where every declaration which is used is marked as used.

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

12 years agoMake the auto-detection hack for the iOS simulator set the target triple correctly...
Eli Friedman [Mon, 16 Jan 2012 18:50:54 +0000 (18:50 +0000)]
Make the auto-detection hack for the iOS simulator set the target triple correctly.  Getting the target triple wrong mostly appears to work, but messes up in subtle cases; for example, we incorrectly conclude that fwrite is actually named fwrite$UNIX2003.  Also shuffles around the auto-detection code a bit to try and make it a bit more reliable.  Fixes <rdar://problem/10664848>.

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

12 years agoAnother test for 148243
Fariborz Jahanian [Mon, 16 Jan 2012 18:22:26 +0000 (18:22 +0000)]
Another test for 148243
non-constant-folded-switch containing a constant-folded switch.

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

12 years agoA little more elaborate test for r148243
Fariborz Jahanian [Mon, 16 Jan 2012 18:07:45 +0000 (18:07 +0000)]
A little more elaborate test for r148243

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

12 years agoPatch for r148243 which was left behind.
Fariborz Jahanian [Mon, 16 Jan 2012 17:52:22 +0000 (17:52 +0000)]
Patch for r148243 which was left behind.

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

12 years agoFixes a crash during constant folding of a switch and case
Fariborz Jahanian [Mon, 16 Jan 2012 17:35:57 +0000 (17:35 +0000)]
Fixes a crash during constant folding of a switch and case
statement which has an unscoped case inside it.
Patch by Aaron Ballman

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

12 years agoSome improvements to the handling of C11 atomic types:
David Chisnall [Mon, 16 Jan 2012 17:27:18 +0000 (17:27 +0000)]
Some improvements to the handling of C11 atomic types:

- Add atomic-to/from-nonatomic cast types
- Emit atomic operations for arithmetic on atomic types
- Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load
- Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type.  This is needed for the corresponding C11 stdatomic.h function.
- Enables the relevant __has_feature() checks.  The feature isn't 100% complete yet, but it's done enough that we want people testing it.

Still to do:

- Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg.
- Add a signal fence builtin
- Properly set the fenv state in atomic operations on floating point values
- Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context)
- Fix the many remaining corner cases

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

12 years agoRefactor variables unused under non-assert builds.
David Blaikie [Mon, 16 Jan 2012 05:16:03 +0000 (05:16 +0000)]
Refactor variables unused under non-assert builds.

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

12 years agoNow that deserializing a definition of a C++ class/Objective-C
Douglas Gregor [Sun, 15 Jan 2012 18:17:48 +0000 (18:17 +0000)]
Now that deserializing a definition of a C++ class/Objective-C
class/Objective-C protocol suffices get all of the redeclarations of
that declaration wired to the definition, we no longer need to record
the identity of the definition in every declaration. Instead, just
record a bit to indicate whether a particular declaration is the
definition.

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

12 years agoWhen deserializing the definition of a C++ class/ObjC class/ObjC
Douglas Gregor [Sun, 15 Jan 2012 18:08:05 +0000 (18:08 +0000)]
When deserializing the definition of a C++ class/ObjC class/ObjC
protocol, record the definition pointer in the canonical declaration
for that entity, and then propagate that definition pointer from the
canonical declaration to all other deserialized declarations. This
approach works well even when deserializing declarations that didn't
know about the original definition, which can occur with modules.

A nice bonus from this definition-deserialization approach is that we
no longer need update records when a definition is added, because the
redeclaration chains ensure that the if any declaration is loaded, the
definition will also get loaded.

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

12 years agoCompletely re-implement (de-)serialization of redeclaration
Douglas Gregor [Sun, 15 Jan 2012 16:58:34 +0000 (16:58 +0000)]
Completely re-implement (de-)serialization of redeclaration
chains, again. The prior implementation was very linked-list oriented, and
the list-splicing logic was both fairly convoluted (when loading from
multiple modules) and failed to preserve a reasonable ordering for the
redeclaration chains.

This new implementation uses a simpler strategy, where we store the
ordered redeclaration chains in an array-like structure (indexed based
on the first declaration), and use that ordering to add individual
deserialized declarations to the end of the existing chain. That way,
the chain mimics the ordering from its modules, and a bug somewhere is
far less likely to result in a broken linked list.

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

12 years agoTweak markup.
Benjamin Kramer [Sun, 15 Jan 2012 16:42:14 +0000 (16:42 +0000)]
Tweak markup.

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

12 years agoadded descriptions of vector extensions, info about vector literals and vector operat...
Anton Yartsev [Sun, 15 Jan 2012 16:22:24 +0000 (16:22 +0000)]
added descriptions of vector extensions, info about vector literals and vector operations.

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

12 years agoFix ALL the markup.
Benjamin Kramer [Sun, 15 Jan 2012 15:26:07 +0000 (15:26 +0000)]
Fix ALL the markup.

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

12 years agoTwo variables had been added for an assert, but their values were
Chandler Carruth [Sun, 15 Jan 2012 09:03:45 +0000 (09:03 +0000)]
Two variables had been added for an assert, but their values were
re-computed rather than the variables be re-used just after the assert.
Just use the variables since we have them already. Fixes an unused
variable warning.

Also fix an 80-column violation.

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

12 years agodecltype(e) is type-dependent if e is instantiation-dependent. Scary but true.
Richard Smith [Sun, 15 Jan 2012 06:24:57 +0000 (06:24 +0000)]
decltype(e) is type-dependent if e is instantiation-dependent. Scary but true.
Don't consider decltype(e) for an instantiation-dependent, but not
type-dependent, e to be non-type-dependent but canonical(!).

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

12 years agoPedantic diagnostic correction: in C++, we have integral constant expressions,
Richard Smith [Sun, 15 Jan 2012 03:51:30 +0000 (03:51 +0000)]
Pedantic diagnostic correction: in C++, we have integral constant expressions,
not integer constant expressions. In passing, fix the 'folding is an extension'
diagnostic to not claim we're accepting the code, since that's not true in
-pedantic-errors mode, and add this diagnostic to -Wgnu.

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

12 years agoconstexpr: casts to void* are allowed in constant expressions, don't set the
Richard Smith [Sun, 15 Jan 2012 03:25:41 +0000 (03:25 +0000)]
constexpr: casts to void* are allowed in constant expressions, don't set the
designator invalid. (Since we can't read the value of such a pointer, this only
affects the quality of diagnostics.)

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

12 years agoChange linkage computation so it doesn't depend on FunctionDecl::isExternC or VarDecl...
Eli Friedman [Sun, 15 Jan 2012 01:23:58 +0000 (01:23 +0000)]
Change linkage computation so it doesn't depend on FunctionDecl::isExternC or VarDecl::isExternC, and instead queries what it actually cares about: whether the given declaration is inside an extern "C" context.  Fundamentally, figuring out whether a function/variable uses C linkage requires knowing the linkage, and the logic in FunctionDecl::isExternC and VarDecl::isExternC was getting it wrong.  Given that, fix FunctionDecl::isExternC and VarDecl::isExternC to use much simpler implementations that depend on the fixed linkage computation.

Fixes a regression to test/SemaCXX/linkage.cpp caused by a new warning exposing the fact that the internal state was wrong.

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

12 years agoUse a smaller vector than SmallVector.
Benjamin Kramer [Sat, 14 Jan 2012 21:05:10 +0000 (21:05 +0000)]
Use a smaller vector than SmallVector.

Shrinks OverloadCandidate from 208 to 168 bytes.

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

12 years agoClear ImplicitConversionSequence the obvious way which turns out to be less fragile.
Benjamin Kramer [Sat, 14 Jan 2012 20:16:52 +0000 (20:16 +0000)]
Clear ImplicitConversionSequence the obvious way which turns out to be less fragile.

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

12 years agoGive OverloadCandidateSet the responsibility for destroying the implicit conversion...
Benjamin Kramer [Sat, 14 Jan 2012 19:31:39 +0000 (19:31 +0000)]
Give OverloadCandidateSet the responsibility for destroying the implicit conversion sequences so we don't get double frees when the vector reallocates.

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

12 years agoobjc: disallow __block attribute on method params.
Fariborz Jahanian [Sat, 14 Jan 2012 18:44:35 +0000 (18:44 +0000)]
objc: disallow __block attribute on method params.

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

12 years agoReorder initializers, make use of the whole array.
Benjamin Kramer [Sat, 14 Jan 2012 17:59:15 +0000 (17:59 +0000)]
Reorder initializers, make use of the whole array.

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

12 years agoMove the inline array to the end.
Benjamin Kramer [Sat, 14 Jan 2012 17:23:10 +0000 (17:23 +0000)]
Move the inline array to the end.

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

12 years agoDestroy OverloadCandidates before taking away the underlying memory.
Benjamin Kramer [Sat, 14 Jan 2012 17:10:59 +0000 (17:10 +0000)]
Destroy OverloadCandidates before taking away the underlying memory.

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

12 years agoReplace a using declararion with a typedef in the hope of satisfying GCC
Douglas Gregor [Sat, 14 Jan 2012 16:48:12 +0000 (16:48 +0000)]
Replace a using declararion with a typedef in the hope of satisfying GCC

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

12 years agoDe-virtualize getPreviousDecl() and getMostRecentDecl() when we know
Douglas Gregor [Sat, 14 Jan 2012 16:38:05 +0000 (16:38 +0000)]
De-virtualize getPreviousDecl() and getMostRecentDecl() when we know
we have a redeclarable type, and only use the new virtual versions
(getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have
that type information. This keeps us from penalizing users with strict
type information (and is the moral equivalent of a "final" method).

Plus, settle on the names getPreviousDecl() and getMostRecentDecl()
throughout.

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

12 years agoPool allocate ImplicitConversionSequences.
Benjamin Kramer [Sat, 14 Jan 2012 16:32:05 +0000 (16:32 +0000)]
Pool allocate ImplicitConversionSequences.

To avoid malloc thrashing give OverloadCandidateSet an inline capacity for conversion sequences.
We use the fact that OverloadCandidates never outlive the OverloadCandidateSet and have a fixed
amount of conversion sequences.

This eliminates the oversized SmallVector from OverloadCandidate shrinking it from 752 to 208 bytes.

On the test case from the "Why is CLANG++ so freaking slow" thread on llvmdev this avoids one gig
of vector reallocation (including memcpy) which translates into 5-10% speedup on Lion/x86_64.

Overload candidate computation is still the biggest malloc contributor when compiling templated
c++ code.

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

12 years agoOverloadCandidateSet: Stop exposing SmallVector internals
Benjamin Kramer [Sat, 14 Jan 2012 16:31:55 +0000 (16:31 +0000)]
OverloadCandidateSet: Stop exposing SmallVector internals

Replace push_back with addCandidate which will let us make use of the fixed size of
the conversion sequence vector soon.

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

12 years agoIntroduce Decl::getPreviousDecl() and Decl::getMostRecentDecl(),
Douglas Gregor [Sat, 14 Jan 2012 15:55:47 +0000 (15:55 +0000)]
Introduce Decl::getPreviousDecl() and Decl::getMostRecentDecl(),
virtual functions that provide previous/most recent redeclaration
information for any declaration. Use this to eliminate the redundant,
less efficient getPreviousDecl() functions.

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

12 years agoRevert accidental commit
Douglas Gregor [Sat, 14 Jan 2012 15:31:52 +0000 (15:31 +0000)]
Revert accidental commit

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

12 years agoAdd a FIXME for mutation of the common pointer of a RedeclarableTemplateDecl. It...
Douglas Gregor [Sat, 14 Jan 2012 15:30:55 +0000 (15:30 +0000)]
Add a FIXME for mutation of the common pointer of a RedeclarableTemplateDecl. It is not clear that it's worth delaying the allocation of said pointer

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

12 years agoReimplement RedeclarableTemplateDecl in terms of
Douglas Gregor [Sat, 14 Jan 2012 15:13:49 +0000 (15:13 +0000)]
Reimplement RedeclarableTemplateDecl in terms of
Redeclarable<RedeclarableTemplateDecl>, eliminating a bunch of
redeclaration-chain logic both in RedeclarableTemplateDecl and
especially in its (de-)serialization.

As part of this, eliminate the RedeclarableTemplate<> class template,
which was an abstraction that didn't actually save anything.

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

12 years agoRemove a redundant word.
Zhongxing Xu [Sat, 14 Jan 2012 09:08:15 +0000 (09:08 +0000)]
Remove a redundant word.

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

12 years agoconstexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
Richard Smith [Sat, 14 Jan 2012 04:30:29 +0000 (04:30 +0000)]
constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
APValue::Array and APValue::MemberPointer. All APValue values can now be emitted
as constants.

Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other
entrypoints dealing with constant member pointers are no longer necessary and
will be removed in a later change.

Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to
VarDecl::evaluateValue. This performs caching and deals with the nasty cases in
C++11 where a non-const object's initializer can refer indirectly to
previously-initialized fields within the same object.

Building the intermediate APValue object incurs a measurable performance hit on
pathological testcases with huge initializer lists, so we continue to build IR
directly from the Expr nodes for array and record types outside of C++11.

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

12 years ago[analyzer] Taint: add system and popen as undesirable sinks for taint
Anna Zaks [Sat, 14 Jan 2012 02:48:40 +0000 (02:48 +0000)]
[analyzer] Taint: add system and popen as undesirable sinks for taint
data.

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

12 years ago[libclang] If CXIndexOpt_IndexFunctionLocalSymbols is enabled, also
Argyrios Kyrtzidis [Sat, 14 Jan 2012 02:05:51 +0000 (02:05 +0000)]
[libclang] If CXIndexOpt_IndexFunctionLocalSymbols is enabled, also
index parameters.

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

12 years agoRemember if a type has its visibility set explicitly or implicitly.
Rafael Espindola [Sat, 14 Jan 2012 00:30:36 +0000 (00:30 +0000)]
Remember if a type has its visibility set explicitly or implicitly.
With that, centralize the way we merge visibility, always preferring explicit over
implicit and then picking the most restrictive one.
Fixes pr10113 and pr11690.

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

12 years agoFix 80-column violation.
Chad Rosier [Sat, 14 Jan 2012 00:30:11 +0000 (00:30 +0000)]
Fix 80-column violation.

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

12 years ago[libclang] Add CXIndexOpt_IndexFunctionLocalSymbols indexing option to indicate
Argyrios Kyrtzidis [Sat, 14 Jan 2012 00:11:49 +0000 (00:11 +0000)]
[libclang] Add CXIndexOpt_IndexFunctionLocalSymbols indexing option to indicate
that one wants indexing callbacks for function-local symbols as well.

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

12 years ago(Implicit) parameters deserialized as part of a function type must not
Douglas Gregor [Fri, 13 Jan 2012 23:49:34 +0000 (23:49 +0000)]
(Implicit) parameters deserialized as part of a function type must not
get added to the identifier chains as part of deserialization, because
they should not be visible to name lookup.

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

12 years agoProgress towards making isUsed() reflect whether a declaration is odr-used; don't...
Eli Friedman [Fri, 13 Jan 2012 23:41:25 +0000 (23:41 +0000)]
Progress towards making isUsed() reflect whether a declaration is odr-used; don't set isUsed for local variables which are referenced in unevaluated contexts.  Make other code use isReferenced() (which basically indicates that a declaration isn't dead) where appropriate.

I was forced to change test/SemaCXX/linkage.cpp because we aren't actually modeling extern "C" in the AST the way that testcase expects; we were not printing a warning only because we skipped the relevant check.  Someone who actually understands the semantics here should fix that.

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

12 years agoFix a silly mistake in ComplexExprEvaluator::ZeroInitialization. <rdar://problem...
Eli Friedman [Fri, 13 Jan 2012 23:34:56 +0000 (23:34 +0000)]
Fix a silly mistake in ComplexExprEvaluator::ZeroInitialization.  <rdar://problem/10691092>.

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

12 years agoConvert SemaTemplate*.cpp to pass a callback object to CorrectTypo.
Kaelyn Uhrain [Fri, 13 Jan 2012 23:10:36 +0000 (23:10 +0000)]
Convert SemaTemplate*.cpp to pass a callback object to CorrectTypo.

The change to SemaTemplateVariadic.cpp improves the typo correction
results in certain situations, while the change to SemaTemplate.cpp
does not change existing behavior.

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

12 years agoMake sure to consider non-DeclContext scopes properly when finding
Douglas Gregor [Fri, 13 Jan 2012 23:06:53 +0000 (23:06 +0000)]
Make sure to consider non-DeclContext scopes properly when finding
multiple name lookup results in C/Objective-C. Fixes a regression a
caused in r147533, found by Enea Zaffanella!

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