]> granicus.if.org Git - clang/log
clang
13 years agoKeep track of when "unrecoverable" errors occur, then allow
Douglas Gregor [Wed, 6 Jul 2011 17:40:26 +0000 (17:40 +0000)]
Keep track of when "unrecoverable" errors occur, then allow
clang_saveTranslationUnit() to save a PCH file if the only errors it
contains are recoverable errors. Fixes <rdar://problem/9727804>.

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

13 years agoSmallVectorize a critical vector.
Benjamin Kramer [Wed, 6 Jul 2011 16:43:46 +0000 (16:43 +0000)]
SmallVectorize a critical vector.

The small number of elements was determined by taking the median
file length in clang+llvm and /usr/include on OS X with xcode installed.

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

13 years agolibclang: Allow callers of clang_saveTranslationUnit() to distinguish
Douglas Gregor [Wed, 6 Jul 2011 16:43:36 +0000 (16:43 +0000)]
libclang: Allow callers of clang_saveTranslationUnit() to distinguish
between different classes of errors. Addresses most of
<rdar://problem/9660328>.

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

13 years agoBuild up statistics about the work done for analysis based warnings.
Chandler Carruth [Wed, 6 Jul 2011 16:21:37 +0000 (16:21 +0000)]
Build up statistics about the work done for analysis based warnings.
Special detail is added for uninitialized variable analysis as this has
serious performance problems than need to be tracked.

Computing some of this data is expensive, for example walking the CFG to
determine its size. To avoid doing that unless the stats data is going
to be used, we thread a bit into the Sema object to track whether
detailed stats should be collected or not. This bit is used to avoid
computations whereever the computations are likely to be more expensive
than checking the state of the flag. Thus, counters are in some cases
unconditionally updated, but the more expensive (and less frequent)
aggregation steps are skipped.

With this patch, we're able to see that for 'gcc.c':
*** Analysis Based Warnings Stats:
232 functions analyzed (0 w/o CFGs).
  7151 CFG blocks built.
  30 average CFG blocks per function.
  1167 max CFG blocks per function.
163 functions analyzed for uninitialiazed variables
  640 variables analyzed.
  3 average variables per function.
  94 max variables per function.
  96409 block visits.
  591 average block visits per function.
  61546 max block visits per function.

And for the reduced testcase in PR10183:
*** Analysis Based Warnings Stats:
98 functions analyzed (0 w/o CFGs).
  8526 CFG blocks built.
  87 average CFG blocks per function.
  7277 max CFG blocks per function.
68 functions analyzed for uninitialiazed variables
  1359 variables analyzed.
  19 average variables per function.
  1196 max variables per function.
  2540494 block visits.
  37360 average block visits per function.
  2536495 max block visits per function.

That last number is the somewhat scary one that indicates the problem in
PR10183.

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

13 years agoTeach the static analyzer's interpretation of Cocoa conventions to
Douglas Gregor [Wed, 6 Jul 2011 16:00:34 +0000 (16:00 +0000)]
Teach the static analyzer's interpretation of Cocoa conventions to
obey the objc_method_family attribute when provided. Fixes
<rdar://problem/9726279>.

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

13 years agoUse attributes from the definition (if available) when
Rafael Espindola [Wed, 6 Jul 2011 15:46:09 +0000 (15:46 +0000)]
Use attributes from the definition (if available) when
instantiating functions.

Fixes PR10272.

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

13 years agoFix C&P error
Joerg Sonnenberger [Wed, 6 Jul 2011 11:00:56 +0000 (11:00 +0000)]
Fix C&P error

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

13 years agoWhen tree-transforming an expression sequence, always flag expanded
John McCall [Wed, 6 Jul 2011 07:30:07 +0000 (07:30 +0000)]
When tree-transforming an expression sequence, always flag expanded
variadic argument pack expansions as having changed, rather than doing
it for each changed expansion, which leaves out zero-argument packs
with catastrophic consequences.

Fixes PR10260.

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

13 years agoFixed enum types can be complete without actually being valid to use
John McCall [Wed, 6 Jul 2011 06:57:57 +0000 (06:57 +0000)]
Fixed enum types can be complete without actually being valid to use
as scope specifiers;  diagnose the attempt, rather than letting it go
to an assert.  The rest of PR10264.

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

13 years agoProperly protect colons when parsing a nested-name-specifier as part
John McCall [Wed, 6 Jul 2011 05:58:41 +0000 (05:58 +0000)]
Properly protect colons when parsing a nested-name-specifier as part
of an enum specifier in dialects which permit fixed underlying types.
Fixes the rejects-valid part of PR10264.

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

13 years agoImprove the Python bindings for libclang in a few ways, from Eli
Douglas Gregor [Wed, 6 Jul 2011 03:00:34 +0000 (03:00 +0000)]
Improve the Python bindings for libclang in a few ways, from Eli
Bendersky. Specifically:

* Implemented a new function in libclang: clang_isAttribute

* Fixing TranslationUnit.get_includes to only go through the argument
* buffer when it contains something. This fixed a crash on Windows

* clang_getFileName returns CXString, not char*. Made appropriate
* fixes in cindex.py - now the relevant tests pass and we can see the
* full locations correctly again (previously there was garbage in
* place of the file name)
* Exposed clang_getCursorDisplayName to the python bindings

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

13 years agoSomehow the -fgnu-runtime option itself got lost in all that shuffling.
John McCall [Wed, 6 Jul 2011 02:36:30 +0000 (02:36 +0000)]
Somehow the -fgnu-runtime option itself got lost in all that shuffling.
Restore it.

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

13 years agoCall objc_terminate() instead of abort() when a cleanup throws an
John McCall [Wed, 6 Jul 2011 01:22:26 +0000 (01:22 +0000)]
Call objc_terminate() instead of abort() when a cleanup throws an
exception in Objective-C;  in Objective-C++ we still use std::terminate().
This is only available in very recent runtimes.

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

13 years agoMissing header from last commit; accidental change.
John McCall [Wed, 6 Jul 2011 00:38:59 +0000 (00:38 +0000)]
Missing header from last commit; accidental change.

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

13 years agoAdded a missing case label.
Fariborz Jahanian [Wed, 6 Jul 2011 00:29:51 +0000 (00:29 +0000)]
Added a missing case  label.

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

13 years agoChange the driver's logic about Objective-C runtimes: abstract out a
John McCall [Wed, 6 Jul 2011 00:26:06 +0000 (00:26 +0000)]
Change the driver's logic about Objective-C runtimes:  abstract out a
structure to hold inferred information, then propagate each invididual
bit down to -cc1.  Separate the bits of "supports weak" and "has a native
ARC runtime";  make the latter a CodeGenOption.

The tool chain is still driving this decision, because it's the place that
has the required deployment target information on Darwin, but at least it's
better-factored now.

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

13 years agoobjc-arc: enforce performSelector rules in rejecting retaining selectors
Fariborz Jahanian [Tue, 5 Jul 2011 22:38:59 +0000 (22:38 +0000)]
objc-arc: enforce performSelector rules in rejecting retaining selectors
passed to it, and unknown selectors causing potential leak.
// rdar://9659270

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

13 years agoAdd the ObjC ARC optimization passes manually, now that they're not
Dan Gohman [Tue, 5 Jul 2011 22:02:36 +0000 (22:02 +0000)]
Add the ObjC ARC optimization passes manually, now that they're not
hardwired into the default pass list.

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

13 years agoRemove unused member of Builtin::Info.
Eli Friedman [Tue, 5 Jul 2011 21:53:01 +0000 (21:53 +0000)]
Remove unused member of Builtin::Info.

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

13 years agoTestcase for r134441.
Devang Patel [Tue, 5 Jul 2011 21:48:46 +0000 (21:48 +0000)]
Testcase for r134441.

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

13 years agoDrop "soft" argument that would be considered as file argument by cc1.
Joerg Sonnenberger [Tue, 5 Jul 2011 19:52:46 +0000 (19:52 +0000)]
Drop "soft" argument that would be considered as file argument by cc1.

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

13 years agoLook through parenthesized declarators when determining whether an
Douglas Gregor [Tue, 5 Jul 2011 18:30:26 +0000 (18:30 +0000)]
Look through parenthesized declarators when determining whether an
instantiated function template was written with a prototype or via
some kind of typedef. Fixes PR10273 / <rdar://problem/9723679>.

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

13 years agoHook up mipsel-netbsd and mipsel-freebsd for OS specific handling.
Joerg Sonnenberger [Tue, 5 Jul 2011 18:24:04 +0000 (18:24 +0000)]
Hook up mipsel-netbsd and mipsel-freebsd for OS specific handling.

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

13 years agoUse OS-specific configuration for mips-netbsd and mips-freebsd.
Joerg Sonnenberger [Tue, 5 Jul 2011 18:05:54 +0000 (18:05 +0000)]
Use OS-specific configuration for mips-netbsd and mips-freebsd.

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

13 years agoSome documentation fixes for the parser, from John Freeman
Douglas Gregor [Tue, 5 Jul 2011 17:13:11 +0000 (17:13 +0000)]
Some documentation fixes for the parser, from John Freeman

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

13 years agoStringRef'ize clang::drive::Option::getName(), from Zach Wheeler!
Douglas Gregor [Tue, 5 Jul 2011 16:56:25 +0000 (16:56 +0000)]
StringRef'ize clang::drive::Option::getName(), from Zach Wheeler!

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

13 years agoClean up and refactor ParseFunctionDeclarator to reduce code
Douglas Gregor [Tue, 5 Jul 2011 16:44:18 +0000 (16:44 +0000)]
Clean up and refactor ParseFunctionDeclarator to reduce code
repetition and better reflect the actual grammar, from John Freeman!

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

13 years agoActOnCXXConditionDeclaration should take into account that
Douglas Gregor [Tue, 5 Jul 2011 16:13:20 +0000 (16:13 +0000)]
ActOnCXXConditionDeclaration should take into account that
ActOnDeclarator can return NULL. Fixes PR10270, from Hans Wennborg!

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

13 years agoDon't define __CONSTANT_CFSTRINGS__ with -fno-constant-cfstrings issue.
Fariborz Jahanian [Tue, 5 Jul 2011 16:00:59 +0000 (16:00 +0000)]
Don't define __CONSTANT_CFSTRINGS__ with -fno-constant-cfstrings issue.
Patch by Jean-Daniel Dupas.

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

13 years agoDon't define _BIG_ENDIAN for NetBSD/PowerPC.
Joerg Sonnenberger [Tue, 5 Jul 2011 14:56:12 +0000 (14:56 +0000)]
Don't define _BIG_ENDIAN for NetBSD/PowerPC.

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

13 years agoFix indentation
Joerg Sonnenberger [Tue, 5 Jul 2011 14:54:41 +0000 (14:54 +0000)]
Fix indentation

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

13 years agoTeach Clang's <float.h> to also include MinGW's <float.h>, which provides additional...
Douglas Gregor [Tue, 5 Jul 2011 14:17:04 +0000 (14:17 +0000)]
Teach Clang's <float.h> to also include MinGW's <float.h>, which provides additional system definitions, from Ruben Van Boxem

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

13 years agoUpdate header-search paths for MinGW, from Ruben Van Boxem
Douglas Gregor [Tue, 5 Jul 2011 14:16:05 +0000 (14:16 +0000)]
Update header-search paths for MinGW, from Ruben Van Boxem

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

13 years agoDon't overread the buffer when an %x escape in inline asm ends prematurely.
Benjamin Kramer [Tue, 5 Jul 2011 11:13:37 +0000 (11:13 +0000)]
Don't overread the buffer when an %x escape in inline asm ends prematurely.

Tested by valgrind & Sema/asm.c.

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

13 years agoInitialize member.
Benjamin Kramer [Tue, 5 Jul 2011 09:46:31 +0000 (09:46 +0000)]
Initialize member.

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

13 years agoAdd explicit default case for -Wswitch-enum.
Joerg Sonnenberger [Mon, 4 Jul 2011 23:11:58 +0000 (23:11 +0000)]
Add explicit default case for -Wswitch-enum.

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

13 years agoUse switch(os) style consistently. Add a bunch of NetBSD branches.
Joerg Sonnenberger [Mon, 4 Jul 2011 21:59:44 +0000 (21:59 +0000)]
Use switch(os) style consistently. Add a bunch of NetBSD branches.

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

13 years agoOn PowerPC, both FreeBSD and NetBSD use ints for (s)size_t
Joerg Sonnenberger [Mon, 4 Jul 2011 21:57:55 +0000 (21:57 +0000)]
On PowerPC, both FreeBSD and NetBSD use ints for (s)size_t

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

13 years agoRemove unused parameter from ActOnDeclarator.
Anders Carlsson [Mon, 4 Jul 2011 16:28:17 +0000 (16:28 +0000)]
Remove unused parameter from ActOnDeclarator.

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

13 years agoSwitch the Decl and Stmt stats printing to use llvm::errs() instead of
Chandler Carruth [Mon, 4 Jul 2011 06:13:27 +0000 (06:13 +0000)]
Switch the Decl and Stmt stats printing to use llvm::errs() instead of
fprintf, and to be more consistent in formatting with the other stats
printing routines.

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

13 years agoStart switching the AST stats printing to use llvm::errs() instead of
Chandler Carruth [Mon, 4 Jul 2011 05:32:14 +0000 (05:32 +0000)]
Start switching the AST stats printing to use llvm::errs() instead of
fprintf. There is more cleanup to be done to the AST stats printing...

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

13 years agofix typo
Chris Lattner [Sun, 3 Jul 2011 02:21:48 +0000 (02:21 +0000)]
fix typo

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

13 years agoRewritten fix in r134139 to conform evaluation result to original evaluation context.
Abramo Bagnara [Sat, 2 Jul 2011 13:13:53 +0000 (13:13 +0000)]
Rewritten fix in r134139 to conform evaluation result to original evaluation context.

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

13 years agoFix a typo, remove a tab, canonicalize some spacing. No functional change.
Nick Lewycky [Sat, 2 Jul 2011 02:05:12 +0000 (02:05 +0000)]
Fix a typo, remove a tab, canonicalize some spacing. No functional change.

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

13 years agoReorganize builtins to separate out builtins which require MMX registers. No functio...
Eli Friedman [Sat, 2 Jul 2011 01:53:37 +0000 (01:53 +0000)]
Reorganize builtins to separate out builtins which require MMX registers.  No functional change.

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

13 years agoWhen producing -Wuninitialized Fix-Its for pointers, prefer " = NULL"
Douglas Gregor [Sat, 2 Jul 2011 00:59:18 +0000 (00:59 +0000)]
When producing -Wuninitialized Fix-Its for pointers, prefer " = NULL"
over "= 0". Fixes <rdar://problem/9714386>.

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

13 years agoDon't use x86_mmx where it isn't necessary.
Eli Friedman [Sat, 2 Jul 2011 00:57:27 +0000 (00:57 +0000)]
Don't use x86_mmx where it isn't necessary.

The start of some work on getting -mno-mmx working the way we want it to.

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

13 years agoMake the GCC version proliferation worse by N+1 for the sake of
Chandler Carruth [Sat, 2 Jul 2011 00:51:03 +0000 (00:51 +0000)]
Make the GCC version proliferation worse by N+1 for the sake of
ArchLinux. =/ Fixes PR10246.

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

13 years agoMake clang behave in a gcc-compatible way in the presence of multiple flags for the...
Eli Friedman [Sat, 2 Jul 2011 00:34:19 +0000 (00:34 +0000)]
Make clang behave in a gcc-compatible way in the presence of multiple flags for the same x86 target feature (e.g. -mno-sse -msse).  gcc uses a somewhat unintuitive algorithm here in that the enabled SSE instructions is based on the order of the *last* flag for *each* feature-level, so that "-mno-sse -msse2" only enables SSE2, but "-mno-sse -msse2 -msse" enables all SSE levels.

Issue reported on cfe-dev.

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

13 years agoAdd a testcase for r134292.
Eric Christopher [Sat, 2 Jul 2011 00:28:30 +0000 (00:28 +0000)]
Add a testcase for r134292.

Part of rdar://9714064

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

13 years agoUpdate for llvm commit r134291.
Eric Christopher [Sat, 2 Jul 2011 00:20:22 +0000 (00:20 +0000)]
Update for llvm commit r134291.

Fixes rdar://9714064

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

13 years agoMove the Sema argument to all of the Sema-using helper functions in
Chandler Carruth [Sat, 2 Jul 2011 00:01:44 +0000 (00:01 +0000)]
Move the Sema argument to all of the Sema-using helper functions in
SemaDeclAttr to the first argument. This makes them follow the very
consistent policy elsewhere in Sema for helper functions.

Original patch by Caitlin Sadowski, with some tweaking by me.

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

13 years agoRename static helpers to use 'camelCaseNames' per the new style
Chandler Carruth [Fri, 1 Jul 2011 23:49:16 +0000 (23:49 +0000)]
Rename static helpers to use 'camelCaseNames' per the new style
recommendations before adding more of them.

Patch by Caitlin Sadowski.

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

13 years agoMechanical rename of 'd' Decl pointer parameters to 'D'. This is more
Chandler Carruth [Fri, 1 Jul 2011 23:49:12 +0000 (23:49 +0000)]
Mechanical rename of 'd' Decl pointer parameters to 'D'. This is more
conventional in the rest of Clang's codebase, and closer to the current
style recommendations. It also makes the code more internally consistent
as FD, VD, etc are used frequently for particular decl variables.

Patch by Caitlin Sadowski.

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

13 years ago-Fix mistake in ASTContext::getInnerObjCOwnership noticed by Doug
Argyrios Kyrtzidis [Fri, 1 Jul 2011 23:01:46 +0000 (23:01 +0000)]
-Fix mistake in ASTContext::getInnerObjCOwnership noticed by Doug
-Remove unnecessary 'return'.
-Remove unnecessary 'if' check (llvm_unreachable make sure attrStr will be non-null)
-Add a test of transferring ownership to a reference cast type.

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

13 years agoAdd initial *-*-rtems* target, from Joel Sherrill
Douglas Gregor [Fri, 1 Jul 2011 22:41:14 +0000 (22:41 +0000)]
Add initial *-*-rtems* target, from Joel Sherrill

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

13 years agoFix the warning that is emitted when an ownership attribute is applied incorrectly.
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:23:09 +0000 (22:23 +0000)]
Fix the warning that is emitted when an ownership attribute is applied incorrectly.

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

13 years agoUse transferARCOwnershipToDeclaratorChunk in inferARCWriteback, no functionality...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:23:05 +0000 (22:23 +0000)]
Use transferARCOwnershipToDeclaratorChunk in inferARCWriteback, no functionality change.

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

13 years agoFix assertion hit in inferARCWriteback.
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:23:03 +0000 (22:23 +0000)]
Fix assertion hit in inferARCWriteback.

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

13 years ago[ARC] When casting from a pointer to an objective-c object with known ownership,...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:59 +0000 (22:22 +0000)]
[ARC] When casting from a pointer to an objective-c object with known ownership, if the
cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type
to the cast type:

id x;
(NSString**)&x; // Casting as (__strong NSString**).

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

13 years ago-Remove Sema::ActOnCastOfParenListExpr and move most of its functionality to
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:54 +0000 (22:22 +0000)]
-Remove Sema::ActOnCastOfParenListExpr and move most of its functionality to
 newly introduced Sema::BuildVectorLiteral.
-Make Sema::ActOnCastExpr handle a vector initializer both when the cast'ed expression
 is a ParenListExpr and when it is a ParenExpr.
-Ultimately make Sema::ActOnParenOrParenListExpr independent of what the cast type was.

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

13 years ago[ARC] When casting from a pointer to an objective-c object with known ownership,...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:50 +0000 (22:22 +0000)]
[ARC] When casting from a pointer to an objective-c object with known ownership, if the
cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type
to the cast type:

id x;
static_cast<NSString**>(&x); // Casting as (__strong NSString**).

This currently only works for C++ named casts, C casts to follow.

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

13 years agoBreak Sema::GetTypeForDeclarator in 2 functions, one for DeclSpec processing and...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:42 +0000 (22:22 +0000)]
Break Sema::GetTypeForDeclarator in 2 functions, one for DeclSpec processing and another for the rest.
No functionality change.

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

13 years agoIntroduce Declarator::ObjCCatchContext, this will result in correct error for 'auto...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:40 +0000 (22:22 +0000)]
Introduce Declarator::ObjCCatchContext, this will result in correct error for 'auto' in obj-c catch.

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

13 years agoRefactor AttributeList.h to use alphabetical order, from Caitlin Sadowski
Douglas Gregor [Fri, 1 Jul 2011 22:04:06 +0000 (22:04 +0000)]
Refactor AttributeList.h to use alphabetical order, from Caitlin Sadowski

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

13 years agoEmit guard variables for any weak global that has a run-time
Douglas Gregor [Fri, 1 Jul 2011 21:54:36 +0000 (21:54 +0000)]
Emit guard variables for any weak global that has a run-time
initializer. Previously, we only used guard variables for weak static
data members. Fixes <rdar://problem/9692249>.

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

13 years agoWhen adding boolean keywords for typo correction, add either "bool" or
Douglas Gregor [Fri, 1 Jul 2011 21:27:45 +0000 (21:27 +0000)]
When adding boolean keywords for typo correction, add either "bool" or
"_Bool" (depending on dialect), but not both, since they have the same
edit distance from "Bool".

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

13 years agoFix testcase
Douglas Gregor [Fri, 1 Jul 2011 21:19:15 +0000 (21:19 +0000)]
Fix testcase

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

13 years agoDon't zero-initialize default-initialized local variables that have
Douglas Gregor [Fri, 1 Jul 2011 21:08:19 +0000 (21:08 +0000)]
Don't zero-initialize default-initialized local variables that have
trivial default constructors. This generated-code regression was
caused by r131796, which had simplified the handling of default
initialization in Sema. Fixes <rdar://problem/9694300>.

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

13 years agoFor code such as:
Richard Trieu [Fri, 1 Jul 2011 20:54:02 +0000 (20:54 +0000)]
For code such as:

int f(int x) {
  if (int foo = f(bar)) {}
  return 0;
}

Clang produces the following error messages:

paren_imbalance.cc:2:19: error: use of undeclared identifier 'bar'
  if (int foo = f(bar)) {}
                  ^
paren_imbalance.cc:2:26: error: expected ')'
  if (int foo = f(bar)) {}
                        ^
paren_imbalance.cc:2:6: note: to match this '('
  if (int foo = f(bar)) {}
     ^

The second error is incorrect.  This patch will stop Clang from producing an error on parenthesis imbalance during error recovery when there isn't one.

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

13 years agoFix for PR7410. Allow functions in a derived class that improperly overwrite a virtua...
Richard Trieu [Fri, 1 Jul 2011 20:02:53 +0000 (20:02 +0000)]
Fix for PR7410. Allow functions in a derived class that improperly overwrite a virtual function in the base class to be inserted into the derived class function list to prevent extra errors every time the derived class is used.

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

13 years agoFix AST representations of alias-declarations which define tag types. Inside classes...
Richard Smith [Fri, 1 Jul 2011 19:46:12 +0000 (19:46 +0000)]
Fix AST representations of alias-declarations which define tag types. Inside classes, the tag types need to have an associated access specifier, and inside function definitions, they need to be included in the declarations of the DeclStmt. These issues manifested as assertions during template instantiation, and also in a WIP constexpr patch.

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

13 years agoWhen we create a precompiled preamble, don't copy the
Douglas Gregor [Fri, 1 Jul 2011 18:22:13 +0000 (18:22 +0000)]
When we create a precompiled preamble, don't copy the
CompilerInvocation on the stack, because other objects (e.g., the
CompilerInstance) maintain an intrusive reference-counted pointer to
the CompilerInvocation. This doesn't matter in the normal case,
because we take back the CompilerInvocation. However, during crash
recovery, this leads to us trying to free an object on the stack, and
hilarity ensues. Fixes <rdar://problem/9652540>.

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

13 years agoRemove reference to the Index library
Douglas Gregor [Fri, 1 Jul 2011 16:35:47 +0000 (16:35 +0000)]
Remove reference to the Index library

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

13 years agoJust mangle substituted template parameter types as unresolved types.
John McCall [Fri, 1 Jul 2011 02:19:08 +0000 (02:19 +0000)]
Just mangle substituted template parameter types as unresolved types.
This is kindof questionable but seems to do more-or-less the right thing.
This is not a particularly friendly part of the ABI.

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

13 years agoIntroduce the notion of instantiation dependence into Clang's AST. A
Douglas Gregor [Fri, 1 Jul 2011 01:22:09 +0000 (01:22 +0000)]
Introduce the notion of instantiation dependence into Clang's AST. A
type/expression/template argument/etc. is instantiation-dependent if
it somehow involves a template parameter, even if it doesn't meet the
requirements for the more common kinds of dependence (dependent type,
type-dependent expression, value-dependent expression).

When we see an instantiation-dependent type, we know we always need to
perform substitution into that instantiation-dependent type. This
keeps us from short-circuiting evaluation in places where we
shouldn't, and lets us properly implement C++0x [temp.type]p2.

In theory, this would also allow us to properly mangle
instantiation-dependent-but-not-dependent decltype types per the
Itanium C++ ABI, but we aren't quite there because we still mangle
based on the canonical type in cases like, e.g.,

  template<unsigned> struct A { };
  template<typename T>
    void f(A<sizeof(sizeof(decltype(T() + T())))>) { }
  template void f<int>(A<sizeof(sizeof(int))>);

and therefore get the wrong answer.

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

13 years agoChange the mangling of enclosing template template parameters
John McCall [Fri, 1 Jul 2011 00:04:39 +0000 (00:04 +0000)]
Change the mangling of enclosing template template parameters
that serve as the base template name of an unresolved-name to
be mangled as a substitution.

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

13 years agoNo, actually, we do need to be able to mangle substituted template names.
John McCall [Thu, 30 Jun 2011 21:59:02 +0000 (21:59 +0000)]
No, actually, we do need to be able to mangle substituted template names.

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

13 years agoFix off-by-one error in StringLiteral::getLocationOfByte.
Hans Wennborg [Thu, 30 Jun 2011 20:17:41 +0000 (20:17 +0000)]
Fix off-by-one error in StringLiteral::getLocationOfByte.

This fixes PR10223.

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

13 years agoMove test/Sema/return.cpp into test/SemaCXX/return.cpp
Hans Wennborg [Thu, 30 Jun 2011 17:20:18 +0000 (17:20 +0000)]
Move test/Sema/return.cpp into test/SemaCXX/return.cpp

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

13 years agoPerform lvalue-to-rvalue conversions on both operands of ->*
John McCall [Thu, 30 Jun 2011 17:15:34 +0000 (17:15 +0000)]
Perform lvalue-to-rvalue conversions on both operands of ->*
and the RHS of .*.  Noticed by Enea Zaffanella!

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

13 years agosvn propdel svn:eol-style test/Sema/return.cpp
Hans Wennborg [Thu, 30 Jun 2011 16:49:43 +0000 (16:49 +0000)]
svn propdel svn:eol-style test/Sema/return.cpp

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

13 years agoReplace an unreachable error path with an assert
Peter Collingbourne [Thu, 30 Jun 2011 16:41:03 +0000 (16:41 +0000)]
Replace an unreachable error path with an assert
(SourceManager::createFileID cannot return an invalid file ID).
Also update a comment to reflect this.

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

13 years agoFix typo
Peter Collingbourne [Thu, 30 Jun 2011 16:40:50 +0000 (16:40 +0000)]
Fix typo

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

13 years agoTest for errors for returning a value from a ctor or dtor.
Hans Wennborg [Thu, 30 Jun 2011 15:48:23 +0000 (15:48 +0000)]
Test for errors for returning a value from a ctor or dtor.

This fell out when Chandler landed the patch in r134138.

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

13 years agoAdd support for weakly imported classes (GNU runtime).
David Chisnall [Thu, 30 Jun 2011 10:14:37 +0000 (10:14 +0000)]
Add support for weakly imported classes (GNU runtime).

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

13 years agoFixed enum constant evaluation assertions.
Abramo Bagnara [Thu, 30 Jun 2011 09:36:05 +0000 (09:36 +0000)]
Fixed enum constant evaluation assertions.

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

13 years agoImprove the wording of the warning when returning a value from
Chandler Carruth [Thu, 30 Jun 2011 08:56:22 +0000 (08:56 +0000)]
Improve the wording of the warning when returning a value from
a constructor or destructor.

Patch by Hans Wennborg.

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

13 years agoPreserve that a TemplateName was arrived at by substituting
John McCall [Thu, 30 Jun 2011 08:33:18 +0000 (08:33 +0000)]
Preserve that a TemplateName was arrived at by substituting
for a template template parameter.

Uses to follow.

I've also made the uniquing of SubstTemplateTemplateParmPacks
use a ContextualFoldingSet as a minor space efficiency.

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

13 years agoFix an obvious typo in an attribute's diagnostics.
Chandler Carruth [Thu, 30 Jun 2011 08:14:54 +0000 (08:14 +0000)]
Fix an obvious typo in an attribute's diagnostics.
Patch by Caitlin Sadowski.

Unfortunately, this attribute doesn't seem to have a single test. It is
only mentioned in comments in one test, and as a string literal in
a copy of some Clang code checked in as a test for the Indexer. =[ It
dates from 2009 r74280 as part of OpenCL 1.0.

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

13 years agocreateTargetMachine now takes a CPU string.
Evan Cheng [Thu, 30 Jun 2011 02:06:32 +0000 (02:06 +0000)]
createTargetMachine now takes a CPU string.

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

13 years agoDocument and check tighter assumptions about the TemplateName of a
John McCall [Thu, 30 Jun 2011 00:42:27 +0000 (00:42 +0000)]
Document and check tighter assumptions about the TemplateName of a
TemplateSpecializationType.

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

13 years agoIntroduce a caching mechanism for macro expanded tokens.
Argyrios Kyrtzidis [Wed, 29 Jun 2011 22:20:11 +0000 (22:20 +0000)]
Introduce a caching mechanism for macro expanded tokens.

Previously macro expanded tokens were added to Preprocessor's bump allocator and never released,
even after the TokenLexer that were lexing them was finished, thus they were wasting memory.
A very "useful" boost library was causing clang to eat 1 GB just for the expanded macro tokens.

Introduce a special cache that works like a stack; a TokenLexer can add the macro expanded tokens
in the cache, and when it finishes, the tokens are removed from the end of the cache.

Now consumed memory by expanded tokens for that library is ~ 1.5 MB.

Part of rdar://9327049.

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

13 years ago[libclang] Introduce cxcursor::getCursorParentDecl(CXCursor Cursor) and use it at...
Argyrios Kyrtzidis [Wed, 29 Jun 2011 22:20:07 +0000 (22:20 +0000)]
[libclang] Introduce cxcursor::getCursorParentDecl(CXCursor Cursor) and use it at the appropriate place in CIndex.cpp
No functionality change.

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

13 years agoIntroduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no functionality...
Argyrios Kyrtzidis [Wed, 29 Jun 2011 22:20:04 +0000 (22:20 +0000)]
Introduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no functionality change.

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

13 years agoCheck for deprecated/unavailable/etc attributes on fields that are
Douglas Gregor [Wed, 29 Jun 2011 21:51:31 +0000 (21:51 +0000)]
Check for deprecated/unavailable/etc attributes on fields that are
initialized via initializer lists. Fixes <rdar://problem/9694686>.

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

13 years agoWhen redeclaring a local extern in the same scope, make sure that we
Douglas Gregor [Wed, 29 Jun 2011 21:22:02 +0000 (21:22 +0000)]
When redeclaring a local extern in the same scope, make sure that we
replace the existing declaration appropriately. Patch by Jordy Rose,
fixes PR10013 / <rdar://problem/9584157>.

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

13 years agoobjc-arc: fix a IRGen crash when checking for
Fariborz Jahanian [Wed, 29 Jun 2011 20:00:16 +0000 (20:00 +0000)]
objc-arc: fix a IRGen crash when checking for
accessibility of an initializer which is a compound
statement. // rdar://9694706

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

13 years agoUse existing -fcatch-undefined-behavior option,
Fariborz Jahanian [Wed, 29 Jun 2011 18:41:17 +0000 (18:41 +0000)]
Use existing -fcatch-undefined-behavior option,
replacing -freset-local-blocks. // rdar://9227352

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

13 years agoRemove doxygen.cfg to prevent accidental commits, it is generated from doxygen.cfg.in.
Benjamin Kramer [Wed, 29 Jun 2011 16:22:39 +0000 (16:22 +0000)]
Remove doxygen.cfg to prevent accidental commits, it is generated from doxygen.cfg.in.

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