]> granicus.if.org Git - clang/log
clang
12 years ago[analyzer] Malloc: Utter the name of the leaked variable.
Anna Zaks [Wed, 21 Mar 2012 19:45:08 +0000 (19:45 +0000)]
[analyzer] Malloc: Utter the name of the leaked variable.
Specifically, we use the last store of the leaked symbol in the leak diagnostic.
(No support for struct fields since the malloc checker doesn't track those
yet.)

+ Infrastructure to track the regions used in store evaluations.
This approach is more precise than iterating the store to
obtain the region bound to the symbol, which is used in RetainCount
checker. The region corresponds to what is uttered in the code in the
last store and we do not rely on the store implementation to support
this functionality.

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

12 years ago[analyser] Factor out FindUniqueBinding from RetainCount checker.
Anna Zaks [Wed, 21 Mar 2012 19:45:01 +0000 (19:45 +0000)]
[analyser] Factor out FindUniqueBinding from RetainCount checker.

So that others could use it as well. No functionality change.

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

12 years ago[analyzer] Re-enable the test disabled by r152969.
Anna Zaks [Wed, 21 Mar 2012 19:44:57 +0000 (19:44 +0000)]
[analyzer] Re-enable the test disabled by r152969.
(The fix was committed in r152982.)

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

12 years agoDuplicated code is bad. At least make it consistent.
Bob Wilson [Wed, 21 Mar 2012 17:19:12 +0000 (17:19 +0000)]
Duplicated code is bad.  At least make it consistent.

The getARMTargetCPU and getLLVMArchSuffixForARM functions exist in both
Toolchain.cpp and Tools.cpp.  This stuff needs a thorough overhaul.  In the
meantime, this patch at least makes them consistent.  One version had been
converted to use StringSwitch, and the other version had new Cortex M-series
processors added.

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

12 years agoAllow void blocks to return witn a void expression in
Fariborz Jahanian [Wed, 21 Mar 2012 16:45:13 +0000 (16:45 +0000)]
Allow void blocks to return witn a void expression in
c-mode to match behavior with void functions in c. Issue
warning with -pedantic. // rdar://11069896

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

12 years agoFor Darwin, do not let -mcpu override the -arch option. <rdar://11059238>
Bob Wilson [Wed, 21 Mar 2012 16:31:37 +0000 (16:31 +0000)]
For Darwin, do not let -mcpu override the -arch option.  <rdar://11059238>

On Darwin the architecture and the corresponding Mach-O slice is typically
specified with -arch.  If not, it defaults to the current host architecture.
Do not use -mcpu to override the -arch value.  This is only an issue when
people need to use specialized code for a non-default CPU (hopefully guarded
by run-time checks to detect the current processor).  The -mcpu option is
still used for the -target-cpu option to clang, but this patch causes it to
not be used to set the architecture in the target triple.

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

12 years agomodern objective-c rewriter: remove 'const' from
Fariborz Jahanian [Wed, 21 Mar 2012 16:23:16 +0000 (16:23 +0000)]
modern objective-c rewriter: remove 'const' from
pointer field declarations in several meta-data.
// rdar://11079898

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

12 years agoRemoved repeated word (of of).
Patrick Beard [Wed, 21 Mar 2012 16:22:53 +0000 (16:22 +0000)]
Removed repeated word (of of).

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

12 years agoUndo previous patch as I checked more than I intended.
Fariborz Jahanian [Wed, 21 Mar 2012 16:18:21 +0000 (16:18 +0000)]
Undo previous patch as I checked more than I intended.

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

12 years agomodern objective-c rewriter: remove 'const' from
Fariborz Jahanian [Wed, 21 Mar 2012 16:17:22 +0000 (16:17 +0000)]
modern objective-c rewriter: remove 'const' from
pointer field declarations in several meta-data.
// rdar://11079898

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

12 years agoFor the annals of subtle but terrible bugs: fix a longstanding bug
John McCall [Wed, 21 Mar 2012 06:57:19 +0000 (06:57 +0000)]
For the annals of subtle but terrible bugs:  fix a longstanding bug
in vtable layout where virtual methods inherited from virtual bases
could be assigned the same vcall adjustment slot if they shared
a name and parameter signature but differed in their
cv-qualification.  The code was already trying to handle this
case, but unfortunately used the ordinary type qualifiers
(which are always empty here) instead of the method qualifiers.
This seems like something that the API should discourage, but
I don't know how to carry that principle out in this instance.

Eliminate this function's need for an ASTContext while we're at it.

This bug affects the ABI, and fixing it brings us into accord with
the Itanium ABI (and GCC's implementation of it), but, obviously,
technically breaks full compatibility with previous releases of Clang.
Just letting you know.

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

12 years agoclang-interpreter/Makefile: [PR12313] Update USEDLIBS to add clangEdit.
NAKAMURA Takumi [Wed, 21 Mar 2012 06:25:42 +0000 (06:25 +0000)]
clang-interpreter/Makefile: [PR12313] Update USEDLIBS to add clangEdit.

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

12 years agoRewriteModernObjC.cpp: Don't expose temporary std::string with StringRef. (StringRef...
NAKAMURA Takumi [Wed, 21 Mar 2012 03:21:46 +0000 (03:21 +0000)]
RewriteModernObjC.cpp: Don't expose temporary std::string with StringRef. (StringRef)getName() can be used here.

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

12 years agoTest case for rdar://problem/11055105, a bug with the instantiation
John McCall [Wed, 21 Mar 2012 00:45:33 +0000 (00:45 +0000)]
Test case for rdar://problem/11055105, a bug with the instantiation
of references to function template parameters in noexcept clauses when
the instantiation is forced from a point during parsing when a block
is in scope.

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

12 years agoClose the paren.
Fariborz Jahanian [Wed, 21 Mar 2012 00:01:15 +0000 (00:01 +0000)]
Close the paren.
// rdar://11076938

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

12 years agoUpdate comment.
Eric Christopher [Tue, 20 Mar 2012 23:28:32 +0000 (23:28 +0000)]
Update comment.

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

12 years agonumberWithFloat -> numberWithDouble.
Patrick Beard [Tue, 20 Mar 2012 22:24:08 +0000 (22:24 +0000)]
numberWithFloat -> numberWithDouble.

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

12 years agomodern objective-c translator: insert couple of pragmas for optimization.
Fariborz Jahanian [Tue, 20 Mar 2012 22:24:05 +0000 (22:24 +0000)]
modern objective-c translator: insert couple of pragmas for optimization.
// rdar://11079898

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

12 years agoFixed typo.
Patrick Beard [Tue, 20 Mar 2012 21:52:11 +0000 (21:52 +0000)]
Fixed typo.

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

12 years agoAdded summary section for Object Literals and Subscripting, which contains the extern...
Patrick Beard [Tue, 20 Mar 2012 21:51:03 +0000 (21:51 +0000)]
Added summary section for Object Literals and Subscripting, which contains the external link.

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

12 years agomodern objective-c translator: add static function to initialize
Fariborz Jahanian [Tue, 20 Mar 2012 21:41:28 +0000 (21:41 +0000)]
modern objective-c translator: add static function to initialize
the class pointer in the category structure.
// rdar://11076938

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

12 years agoMore careful consideration of C++11 13.3.3.1p4. Fixes PR12257.
Sebastian Redl [Tue, 20 Mar 2012 21:24:14 +0000 (21:24 +0000)]
More careful consideration of C++11 13.3.3.1p4. Fixes PR12257.

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

12 years agoFix the other place where C++98 work for initializer lists was necessary.
Sebastian Redl [Tue, 20 Mar 2012 21:24:03 +0000 (21:24 +0000)]
Fix the other place where C++98 work for initializer lists was necessary.

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

12 years agomore modern objective-c meta-data stuff.
Fariborz Jahanian [Tue, 20 Mar 2012 21:09:58 +0000 (21:09 +0000)]
more modern objective-c meta-data stuff.

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

12 years agoFixed typos.
Patrick Beard [Tue, 20 Mar 2012 21:09:25 +0000 (21:09 +0000)]
Fixed typos.

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

12 years agoLink to Objective-C literals documentation.
Patrick Beard [Tue, 20 Mar 2012 20:51:09 +0000 (20:51 +0000)]
Link to Objective-C literals documentation.

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

12 years agoObjective-C literals documentation.
Patrick Beard [Tue, 20 Mar 2012 20:50:45 +0000 (20:50 +0000)]
Objective-C literals documentation.

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

12 years agoDon't include FixIts with a null replacement range. Fixes <rdar://problem/11040133>.
Ted Kremenek [Tue, 20 Mar 2012 20:49:45 +0000 (20:49 +0000)]
Don't include FixIts with a null replacement range.  Fixes <rdar://problem/11040133>.

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

12 years agoFix a use-after-free in thunk emission. EmitThunk may call RAUW on Init, invalidating...
Benjamin Kramer [Tue, 20 Mar 2012 20:18:13 +0000 (20:18 +0000)]
Fix a use-after-free in thunk emission. EmitThunk may call RAUW on Init, invalidating the pointer.

Fixes PR12284. The test case only triggered under asan/valgrind, but it's better than nothing.

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

12 years agomodern objective-c translator: provide meta-data initialization
Fariborz Jahanian [Tue, 20 Mar 2012 19:54:33 +0000 (19:54 +0000)]
modern objective-c translator: provide meta-data initialization
via functions for certain pointer initialization
fields. // rdar://11076938

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

12 years agoDebug info: Tighten up uses of plain MDNode pointers which don't survive replaceOpera...
Benjamin Kramer [Tue, 20 Mar 2012 19:49:14 +0000 (19:49 +0000)]
Debug info: Tighten up uses of plain MDNode pointers which don't survive replaceOperandWith.

TrackingVH notices when it gets RAUW'd. Fixes PR12305 and PR12315.

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

12 years agomodern objective-c translator: couple of minor
Fariborz Jahanian [Tue, 20 Mar 2012 17:34:50 +0000 (17:34 +0000)]
modern objective-c translator: couple of minor
changes to how meta-data is declared.
// rdar://11076938

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

12 years agoTest commit.
Patrick Beard [Tue, 20 Mar 2012 17:25:17 +0000 (17:25 +0000)]
Test commit.

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

12 years agoobjective-c modern translator: Refactor intername ivar names to
Fariborz Jahanian [Tue, 20 Mar 2012 17:13:39 +0000 (17:13 +0000)]
objective-c modern translator: Refactor intername ivar names to
one place and use it throughout. Also, change ivar name to avoid
name collisions. // rdar://11079366

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

12 years ago[avx] Define the _mm256_loadu2_xxx and _mm256_storeu2_xxx intrinsics.
Chad Rosier [Tue, 20 Mar 2012 16:40:00 +0000 (16:40 +0000)]
[avx] Define the _mm256_loadu2_xxx and _mm256_storeu2_xxx intrinsics.

From the Intel Optimization Reference Manual, Section 11.6.2.  When data cannot
be aligned or alignment is not known, 16-byte memory accesses may provide better
performance.
rdar://11076953

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

12 years agoAdd missing bitcast that was breaking Objective-C++ exception typeinfo (GNUstep runtime).
David Chisnall [Tue, 20 Mar 2012 16:25:52 +0000 (16:25 +0000)]
Add missing bitcast that was breaking Objective-C++ exception typeinfo (GNUstep runtime).

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

12 years agoAdd test case for <rdar://problem/10553686>, which illustrates RetainCount checker...
Ted Kremenek [Tue, 20 Mar 2012 00:10:35 +0000 (00:10 +0000)]
Add test case for <rdar://problem/10553686>, which illustrates RetainCount checker working with inlined C++ template functions.

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

12 years agoFix crash when querying the CFG reported when using the thread safety analysis
Ted Kremenek [Mon, 19 Mar 2012 23:48:41 +0000 (23:48 +0000)]
Fix crash when querying the CFG reported when using the thread safety analysis
on code using multi-dimensional arrays.  Fix by DeLesley Hutchins, and reported in
PR 12271.

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

12 years ago[libclang] Have clang_getCursorExtent() return the range of the main file when
Argyrios Kyrtzidis [Mon, 19 Mar 2012 23:17:58 +0000 (23:17 +0000)]
[libclang] Have clang_getCursorExtent() return the range of the main file when
the passed cursor is the translation unit cursor.

Patch by Clint Caywood!

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

12 years agoremoved unused code in the modern objc rewriter file.
Fariborz Jahanian [Mon, 19 Mar 2012 20:38:08 +0000 (20:38 +0000)]
removed unused code in the modern objc rewriter file.

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

12 years agoLanguageExtensions: Manually word wrap a line to reduce horizontal scrolling.
Benjamin Kramer [Mon, 19 Mar 2012 19:12:30 +0000 (19:12 +0000)]
LanguageExtensions: Manually word wrap a line to reduce horizontal scrolling.

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

12 years agoline endings
Matt Beaumont-Gay [Mon, 19 Mar 2012 18:47:12 +0000 (18:47 +0000)]
line endings

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

12 years agoUse a simpler pluralization construct
Matt Beaumont-Gay [Mon, 19 Mar 2012 18:36:28 +0000 (18:36 +0000)]
Use a simpler pluralization construct

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

12 years agomodern objective-c translator: fix type of objc_exception_throw
Fariborz Jahanian [Mon, 19 Mar 2012 18:11:32 +0000 (18:11 +0000)]
modern objective-c translator: fix type of objc_exception_throw
declaration and its siblings.

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

12 years agotest/Driver/cpath.c: Mark this as XFAIL:mingw32,win32 for now.
NAKAMURA Takumi [Mon, 19 Mar 2012 16:07:58 +0000 (16:07 +0000)]
test/Driver/cpath.c: Mark this as XFAIL:mingw32,win32 for now.

On Win32 hosts, ';' is used for path separator.

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

12 years agoFix a regression where ':' in CPLUS_INCLUDE_PATH and friends would no longer separate...
Nico Weber [Mon, 19 Mar 2012 15:00:03 +0000 (15:00 +0000)]
Fix a regression where ':' in CPLUS_INCLUDE_PATH and friends would no longer separate paths.

This regressed in r152583. Also add a test to make sure it doesn't regress again.

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

12 years agoAdd the missing compatibility warning for braced initializers as default arguments.
Sebastian Redl [Sun, 18 Mar 2012 22:25:45 +0000 (22:25 +0000)]
Add the missing compatibility warning for braced initializers as default arguments.

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

12 years agoAn error can't be in a warning group.
Benjamin Kramer [Sun, 18 Mar 2012 13:01:31 +0000 (13:01 +0000)]
An error can't be in a warning group.

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

12 years ago[analyzer] Mark a failed-realloc's result as an interesting symbol between the reallo...
Jordy Rose [Sun, 18 Mar 2012 07:43:35 +0000 (07:43 +0000)]
[analyzer] Mark a failed-realloc's result as an interesting symbol between the realloc call and the null check, so we get nicer path notes. Fixes a regression introduced by the diagnostic pruning added in r152361.

This is accomplished by calling markInteresting /during/ path diagnostic generation, and as such relies on deterministic ordering of BugReporterVisitors -- namely, that BugReporterVisitors are run in /reverse/ order from how they are added. (Right now that's a consequence of storing visitors in an ImmutableList, where new items are added to the front.) It's a little hacky, but it works for now.

I think this is the best we can do without storing the relation between the old and new symbols, and that would be a hit whether or not there ends up being an error.

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

12 years agoTurns #import in MS Mode into an error.
Aaron Ballman [Sun, 18 Mar 2012 03:10:37 +0000 (03:10 +0000)]
Turns #import in MS Mode into an error.

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

12 years agoUse character literals for vexing initialization fixit hints.
David Blaikie [Sun, 18 Mar 2012 02:56:47 +0000 (02:56 +0000)]
Use character literals for vexing initialization fixit hints.

Instead of suggesting " = 0" for "char c();", suggest " = '\0'", and similarly
for other char types (wide, 16, and 32). Add tests for all these, and since
this means testing such hints under C++0x, add tests for some untested C++0x
hint cases in the existing code, including suggesting nullptr for pointer
initialization.

This sets up the initialization helper to provide better type fidelity that
will be especially helpful for non-assignment cases (such as fixit-correcting
NULL usage in function calls (eg: foo(char) + foo(NULL) => foo('\0') instead
of the less informative foo(0)))

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

12 years ago[analyzer] Use a FoldingSet to cache simple RetainSummary instances, rather than...
Jordy Rose [Sun, 18 Mar 2012 01:26:10 +0000 (01:26 +0000)]
[analyzer] Use a FoldingSet to cache simple RetainSummary instances, rather than explicitly keeping DoNothing and StopTracking summaries and nothing else.

I tried to test the effects of this change on memory usage and run time, but what I saw on retain-release.m was indistinguishable from noise (debug and release builds). Even so, some caveman profiling showed 101 cache hits that we would have generated new summaries for before (i.e. not default or stop summaries), and the more code we analyze, the more memory we should save.

Maybe we should have a standard project for benchmarking the retain count checker's memory and time?

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

12 years agoReplace a FIXME with a diagnostic when we can't resolve the
Douglas Gregor [Sun, 18 Mar 2012 00:15:42 +0000 (00:15 +0000)]
Replace a FIXME with a diagnostic when we can't resolve the
nested-name-specifier for a class template declaration. Fixes PR12291.

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

12 years agoDiagnose tag and class template declarations with qualified
Douglas Gregor [Sat, 17 Mar 2012 23:06:31 +0000 (23:06 +0000)]
Diagnose tag and class template declarations with qualified
declarator-ids that occur at class scope. Fixes PR8019.

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

12 years ago[analyzer] Unify retain-count summary generation for class and instance methods....
Jordy Rose [Sat, 17 Mar 2012 21:13:07 +0000 (21:13 +0000)]
[analyzer] Unify retain-count summary generation for class and instance methods. No functionality change.

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

12 years agoKill cocoa::deriveNamingConvention and cocoa::followsFundamentalRule. They are now...
Jordy Rose [Sat, 17 Mar 2012 20:51:32 +0000 (20:51 +0000)]
Kill cocoa::deriveNamingConvention and cocoa::followsFundamentalRule. They are now just simple wrappers around method families, and method decls can cache method family lookups. Also, no one is using them right now.

The one difference between ObjCMethodDecl::getMethodFamily and Selector::getMethodFamily is that the former will do some additional sanity checking, and since CoreFoundation types don't look like Objective-C objects, an otherwise interesting method will get a method family of OMF_None. Future clients that use method families should consider how they want to handle CF types.

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

12 years ago[analyzer] Remove duplicate work on deriving method behavior. No functionality change.
Jordy Rose [Sat, 17 Mar 2012 19:53:04 +0000 (19:53 +0000)]
[analyzer] Remove duplicate work on deriving method behavior. No functionality change.

The cocoa::deriveNamingConventions helper is just using method families anyway now, and the way RetainSummaryTemplate works means we're allocating an extra summary for every method with a relevant family.

Also, fix RetainSummaryTemplate to do the right thing w/r/t annotating an /existing/ summary. This was probably the real cause of <rdar://problem/10824732> and the fix in r152448.

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

12 years agomodern objective-c rewriter: further improvement in
Fariborz Jahanian [Sat, 17 Mar 2012 17:46:02 +0000 (17:46 +0000)]
modern objective-c rewriter: further improvement in
writing @synchronized statement; do not call locking
expression more than once and support early exits in
@synchronized's statement block (such as return).

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

12 years agoStaticAnalyzer: Fix abuse of StringRef in r152962.
NAKAMURA Takumi [Sat, 17 Mar 2012 13:06:05 +0000 (13:06 +0000)]
StaticAnalyzer: Fix abuse of StringRef in r152962.

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

12 years agoWhen determining the availability of an enum constant, also consider
Douglas Gregor [Sat, 17 Mar 2012 06:39:06 +0000 (06:39 +0000)]
When determining the availability of an enum constant, also consider
the availability of the enumeration type itself. Fixes
<rdar://problem/10996386>.

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

12 years ago[analyzer] Don't claim an object was returned with +1 retain count before counting...
Jordy Rose [Sat, 17 Mar 2012 05:49:15 +0000 (05:49 +0000)]
[analyzer] Don't claim an object was returned with +1 retain count before counting autoreleases. Fixes PR10376.

(Also, 80-column violations.)

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

12 years ago[analyzer] Add test case from PR10794 for using 'new' with Obj-C objects.
Jordy Rose [Sat, 17 Mar 2012 03:53:59 +0000 (03:53 +0000)]
[analyzer] Add test case from PR10794 for using 'new' with Obj-C objects.

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

12 years ago[analyzer] This test is breaking windows bots, make it darwin-specific.
Anna Zaks [Sat, 17 Mar 2012 01:53:32 +0000 (01:53 +0000)]
[analyzer] This test is breaking windows bots, make it darwin-specific.

(The plist output does not match the one we expect, specifically we do
not detect that the interesting symbol is returned by a call.)

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

12 years agoFix crash on invalid code. I've tried to produce a reduced test case, but when I...
Ted Kremenek [Sat, 17 Mar 2012 00:53:39 +0000 (00:53 +0000)]
Fix crash on invalid code.  I've tried to produce a reduced test case, but when I do the specific crash is hidden.  Fixes <rdar://problem/11063594>.

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

12 years ago[analyzer] Shorten the stack hint diagnostic.
Anna Zaks [Fri, 16 Mar 2012 23:44:28 +0000 (23:44 +0000)]
[analyzer] Shorten the stack hint diagnostic.

Do not display the standard "Returning from 'foo'", when a stack hint is
available.

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

12 years agoMake the storing variable's name generic.
Bill Wendling [Fri, 16 Mar 2012 23:37:23 +0000 (23:37 +0000)]
Make the storing variable's name generic.

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

12 years ago[analyzer] Create symbol-aware stack hints (building upon r152837).
Anna Zaks [Fri, 16 Mar 2012 23:24:20 +0000 (23:24 +0000)]
[analyzer] Create symbol-aware stack hints (building upon r152837).

The symbol-aware stack hint combines the checker-provided message
with the information about how the symbol was passed to the callee: as
a parameter or a return value.

For malloc, the generated messages look like this :
"Returning from 'foo'; released memory via 1st parameter"
"Returning from 'foo'; allocated memory via 1st parameter"
"Returning from 'foo'; allocated memory returned"
"Returning from 'foo'; reallocation of 1st parameter failed"

(We are yet to handle cases when the symbol is a field in a struct or
an array element.)

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

12 years ago[analyzer] +Comments
Anna Zaks [Fri, 16 Mar 2012 23:24:16 +0000 (23:24 +0000)]
[analyzer] +Comments

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

12 years ago[analyzer] Add a statistic for the number of times we reach the max
Anna Zaks [Fri, 16 Mar 2012 23:24:13 +0000 (23:24 +0000)]
[analyzer] Add a statistic for the number of times we reach the max
number of steps in the work list.

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

12 years agoEscape % in diagnostic message when compiling LLVM IR.
Benjamin Kramer [Fri, 16 Mar 2012 22:31:42 +0000 (22:31 +0000)]
Escape % in diagnostic message when compiling LLVM IR.

% is a common character in IR so we'd crash on almost any malformed IR. The
diagnostic formatter expects a formatting directive when it sees an unescaped %.

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

12 years agosink variable into assert
Matt Beaumont-Gay [Fri, 16 Mar 2012 22:20:39 +0000 (22:20 +0000)]
sink variable into assert

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

12 years agoWhen "low alignment" is specified, then set the alignment of the aggregate's
Bill Wendling [Fri, 16 Mar 2012 21:45:12 +0000 (21:45 +0000)]
When "low alignment" is specified, then set the alignment of the aggregate's
store to 1. This allows code-gen to select a more appropriate alignment. If left
to zero, an alignment greater than the alignment of the pointer may be selected,
causing code-gen to use instructions which require an alignment greater than the
pointer guarantees.
<rdar://problem/11043589>

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

12 years agoMinor clean up of my last patch.
Fariborz Jahanian [Fri, 16 Mar 2012 21:43:45 +0000 (21:43 +0000)]
Minor clean up of my last patch.

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

12 years agomodern objective-c translator: write @synchronized.
Fariborz Jahanian [Fri, 16 Mar 2012 21:33:16 +0000 (21:33 +0000)]
modern objective-c translator: write @synchronized.
// rdar://11063663

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

12 years agoSuppress macro expansion of NULL in NULL warnings.
David Blaikie [Fri, 16 Mar 2012 20:30:12 +0000 (20:30 +0000)]
Suppress macro expansion of NULL in NULL warnings.

For "int i = NULL;" we would produce:

null.cpp:5:11: warning: implicit conversion of NULL constant to integer [-Wconversion]
  int i = NULL;
      ~   ^~~~
null.cpp:1:14: note: expanded from macro 'NULL'
\#define NULL __null
              ^~~~~~

But we really shouldn't trace that macro expansion back into the header, yet we
still want macro back traces for code like this:

\#define FOO NULL
int i = FOO;

or

\#define FOO int i = NULL;
FOO

While providing appropriate tagging at different levels of the expansion, etc.

The included test case exercises these cases & does some basic validation (to
ensure we don't have macro expansion notes where we shouldn't, and do where we
should) - but doesn't go as far as to validate the source location/ranges
used in those notes and warnings.

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

12 years agoSkip through transparent contexts when deciding where to add a friend function.
Nick Lewycky [Fri, 16 Mar 2012 19:51:19 +0000 (19:51 +0000)]
Skip through transparent contexts when deciding where to add a friend function.
This fixes g++.dg/parse/friend5.C.

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

12 years agoAfter r150615, which tablegens the group of a diagnostic as an index into the *.inc...
Argyrios Kyrtzidis [Fri, 16 Mar 2012 19:31:34 +0000 (19:31 +0000)]
After r150615, which tablegens the group of a diagnostic as an index into the *.inc file, all diagnostic *.inc
files depend on all other diagnostic *.td files, because a diagnostic group can be introduced at any of the diagnostic
*.td files.

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

12 years agomodern objective-c translator: writing @throw statement.
Fariborz Jahanian [Fri, 16 Mar 2012 16:52:06 +0000 (16:52 +0000)]
modern objective-c translator: writing @throw statement.

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

12 years agoWarn on flexible array members when in C89 mode, with -pedantic.
David Chisnall [Fri, 16 Mar 2012 12:15:37 +0000 (12:15 +0000)]
Warn on flexible array members when in C89 mode, with -pedantic.
This fixes PR 4307.

Patch by Eitan Adler!

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

12 years agoFrom Vassil Vassilev:
Axel Naumann [Fri, 16 Mar 2012 10:40:17 +0000 (10:40 +0000)]
From Vassil Vassilev:
Enable incremental parsing by the Preprocessor,
where more code can be provided after an EOF.
It mainly prevents the tearing down of the topmost lexer.
To be used like this:
PP.enableIncrementalProcessing();
while (getMoreSource()) {
  while (Parser.ParseTopLevelDecl(ADecl)) {...}
}
PP.enableIncrementalProcessing(false);

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

12 years agoFix Objective-C compilation-time performance regression introduced in r152608.
Richard Smith [Fri, 16 Mar 2012 06:12:59 +0000 (06:12 +0000)]
Fix Objective-C compilation-time performance regression introduced in r152608.

Reintroduce lazy name lookup table building, ensuring that the lazy building step
produces the same lookup table that would be built by the eager step.

Avoid building a lookup table for the translation unit outside C++, even in cases
where we can't recover the contents of the table from the declaration chain on
the translation unit, since we're not going to perform qualified lookup into it
anyway. Continue to support lazily building such lookup tables for now, though,
since ASTMerge uses them.

In my tests, this performs very similarly to ToT with r152608 backed out, for C,
Obj-C and C++, and does not suffer from PR10447.

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

12 years agoFix analyzer crash on analyzing 'catch' with no condition variable.
Ted Kremenek [Fri, 16 Mar 2012 05:58:15 +0000 (05:58 +0000)]
Fix analyzer crash on analyzing 'catch' with no condition variable.

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

12 years agotest/Driver/linker-opts.c: Mark as XFAIL:cygming, using gcc linker driver. It should...
NAKAMURA Takumi [Fri, 16 Mar 2012 05:31:24 +0000 (05:31 +0000)]
test/Driver/linker-opts.c: Mark as XFAIL:cygming, using gcc linker driver. It should be aware of LIBRARY_PATH.

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

12 years agoAdd test case for <rdar://problem/8808566>, which is now fixed by inlining support.
Ted Kremenek [Fri, 16 Mar 2012 04:59:57 +0000 (04:59 +0000)]
Add test case for <rdar://problem/8808566>, which is now fixed by inlining support.

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

12 years agoBased on sage feedback, chang -W#import-pedantic to -Wimport-preprocessor-directive...
Ted Kremenek [Fri, 16 Mar 2012 04:07:45 +0000 (04:07 +0000)]
Based on sage feedback, chang -W#import-pedantic to -Wimport-preprocessor-directive-pedantic.

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

12 years agoDon't try to create "store atomic" instructions of non-integer types; they aren't...
Eli Friedman [Fri, 16 Mar 2012 01:48:04 +0000 (01:48 +0000)]
Don't try to create "store atomic" instructions of non-integer types; they aren't supported at the moment.  PR12040.

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

12 years agoAdd warning flag for '#import is a language extension', -W#import-pedantic.
Ted Kremenek [Fri, 16 Mar 2012 01:03:40 +0000 (01:03 +0000)]
Add warning flag for '#import is a language extension', -W#import-pedantic.

Don't know if it is an anathema to include '#' in the warning name.  I'm fine
with changing it, but this was the most obvious name.

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

12 years ago[arcmt] The hard-coded list of weak-incompatible classes is no longer necessary.
Argyrios Kyrtzidis [Fri, 16 Mar 2012 00:21:22 +0000 (00:21 +0000)]
[arcmt] The hard-coded list of weak-incompatible classes is no longer necessary.
rdar://10673816

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

12 years ago[arcmt] iOS is always safe to use 'weak'. rdar://10950825
Argyrios Kyrtzidis [Fri, 16 Mar 2012 00:10:35 +0000 (00:10 +0000)]
[arcmt] iOS is always safe to use 'weak'. rdar://10950825

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

12 years agomodern objective-c translation: writing @try/@catch/@finally
Fariborz Jahanian [Thu, 15 Mar 2012 23:50:33 +0000 (23:50 +0000)]
modern objective-c translation: writing @try/@catch/@finally
statements.

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

12 years agoWhen a variable has a specified asm name, but isn't using the register storage class...
Eli Friedman [Thu, 15 Mar 2012 23:12:51 +0000 (23:12 +0000)]
When a variable has a specified asm name, but isn't using the register storage class, the asm name doesn't specify a register. PR12244.

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

12 years agoFix help text.
Chad Rosier [Thu, 15 Mar 2012 23:08:22 +0000 (23:08 +0000)]
Fix help text.

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

12 years agoUpdate checker build.
Ted Kremenek [Thu, 15 Mar 2012 23:02:21 +0000 (23:02 +0000)]
Update checker build.

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

12 years ago[analyzer] If a metadata symbol is interesting, its region is interesting as well.
Jordy Rose [Thu, 15 Mar 2012 22:45:29 +0000 (22:45 +0000)]
[analyzer] If a metadata symbol is interesting, its region is interesting as well.

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

12 years agomodern objective-c translator: writing @try/@finally statement.
Fariborz Jahanian [Thu, 15 Mar 2012 22:42:15 +0000 (22:42 +0000)]
modern objective-c translator: writing @try/@finally statement.

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

12 years ago[frontend] Fix how the frontend handles -fno-inline. AFAIK clang now matches
Chad Rosier [Thu, 15 Mar 2012 22:31:42 +0000 (22:31 +0000)]
[frontend] Fix how the frontend handles -fno-inline.  AFAIK clang now matches
the behavior of gcc with respect to the -fno-inline and -fno-inline-functions
flags.

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

12 years agoInclude full plist output in FileCheck test.
Ted Kremenek [Thu, 15 Mar 2012 22:14:09 +0000 (22:14 +0000)]
Include full plist output in FileCheck test.

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

12 years agoInclude full plist output in FileCheck test.
Ted Kremenek [Thu, 15 Mar 2012 22:00:28 +0000 (22:00 +0000)]
Include full plist output in FileCheck test.

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

12 years agoDo not truncate expected plist output in FileCheck test.
Ted Kremenek [Thu, 15 Mar 2012 21:55:38 +0000 (21:55 +0000)]
Do not truncate expected plist output in FileCheck test.

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

12 years ago[analyzer] Remove AggExprVisitor, a dead class that assisted in visiting C++ expressi...
Jordy Rose [Thu, 15 Mar 2012 21:46:47 +0000 (21:46 +0000)]
[analyzer] Remove AggExprVisitor, a dead class that assisted in visiting C++ expressions with a "base object", because the CFG is now linearized.

The only use of AggExprVisitor was in #if 0 code (the analyzer's incomplete C++ support), so there is no actual behavioral change anyway.

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