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

12 years agoSupport deducing template arguments from nested initializer lists. PR12119.
Sebastian Redl [Thu, 15 Mar 2012 21:40:51 +0000 (21:40 +0000)]
Support deducing template arguments from nested initializer lists. PR12119.

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

12 years agoSupport '%p' format specifier with block pointers.
Ted Kremenek [Thu, 15 Mar 2012 21:22:27 +0000 (21:22 +0000)]
Support '%p' format specifier with block pointers.

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

12 years agoIt was pointed out that a checking version of strdup isn't needed. So much for late...
Bill Wendling [Thu, 15 Mar 2012 21:18:47 +0000 (21:18 +0000)]
It was pointed out that a checking version of strdup isn't needed. So much for late-night hacking. :)

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

12 years ago[analyzer] Allow checkers to supply call stack diagnostic hints for the
Anna Zaks [Thu, 15 Mar 2012 21:13:02 +0000 (21:13 +0000)]
[analyzer] Allow checkers to supply call stack diagnostic hints for the
BugVisitor DiagnosticPieces.

When checkers create a DiagnosticPieceEvent, they can supply an extra
string, which will be concatenated with the call exit message for every
call on the stack between the diagnostic event and the final bug report.
(This is a simple version, which could be/will be further enhanced.)

For example, this is used in Malloc checker to produce the ",
which allocated memory" in the following example:

static char *malloc_wrapper() { // 2. Entered call from 'use'
    return malloc(12);    // 3. Memory is allocated
}

void use() {
    char *v;
    v = malloc_wrapper(); // 1. Calling 'malloc_wrappers'
        // 4. Returning from 'malloc_wrapper', which allocated memory
}                         // 5. Memory is never released; potential
memory leak

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

12 years agoProvide the specific target type in the -Wnull-conversion warning.
David Blaikie [Thu, 15 Mar 2012 20:48:26 +0000 (20:48 +0000)]
Provide the specific target type in the -Wnull-conversion warning.

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

12 years agomodern objective-c translator: rewriting of @catch-stmt.
Fariborz Jahanian [Thu, 15 Mar 2012 20:11:10 +0000 (20:11 +0000)]
modern objective-c translator: rewriting of @catch-stmt.

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

12 years agoDocument RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate().
Douglas Gregor [Thu, 15 Mar 2012 19:32:20 +0000 (19:32 +0000)]
Document RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate().

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

12 years ago[c-index-test] Make it C90 compliant.
Argyrios Kyrtzidis [Thu, 15 Mar 2012 18:48:52 +0000 (18:48 +0000)]
[c-index-test] Make it C90 compliant.

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

12 years ago[libclang] A couple of enhancements to c-index-test.
Argyrios Kyrtzidis [Thu, 15 Mar 2012 18:07:22 +0000 (18:07 +0000)]
[libclang] A couple of enhancements to c-index-test.

-When printing location avoid printing the filename if it is
same as the main file, not just if it has '.h' extension.
-Make sure we allocate enough bytes for storing as string a
huge line number.

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

12 years agoMake RecursiveASTVisitor to traverse certain statements using data recursion
Argyrios Kyrtzidis [Thu, 15 Mar 2012 18:07:19 +0000 (18:07 +0000)]
Make RecursiveASTVisitor to traverse certain statements using data recursion
to avoid a stack overflow with extreme cases.

Part of rdar://10941790.

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

12 years ago[Sema] Introduce a data recursive evaluator specific to binary operators.
Argyrios Kyrtzidis [Thu, 15 Mar 2012 18:07:16 +0000 (18:07 +0000)]
[Sema] Introduce a data recursive evaluator specific to binary operators.

This allows us to handle extreme cases of chained binary operators without causing stack
overflow.
The binary operators that are handled with the data recursive evaluator are
comma, logical, or operators that have operands with integral or enumeration type.

Part of rdar://10941790.

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

12 years agoRemove hacky temporary fix of r151585.
Argyrios Kyrtzidis [Thu, 15 Mar 2012 18:07:13 +0000 (18:07 +0000)]
Remove hacky temporary fix of r151585.

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

12 years agomodern objective-c translator: please symbols generated
Fariborz Jahanian [Thu, 15 Mar 2012 17:05:33 +0000 (17:05 +0000)]
modern objective-c translator: please symbols generated
for @protocol expression into their own section.

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

12 years agoWhen laying out an Objective-C object, consult
Sean Callanan [Thu, 15 Mar 2012 16:33:08 +0000 (16:33 +0000)]
When laying out an Objective-C object, consult
the external source to complete the Decl if it
hasn't been completed already.

This fixes a crash in LLDB.

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

12 years agofix link
Kostya Serebryany [Thu, 15 Mar 2012 16:22:06 +0000 (16:22 +0000)]
fix link

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

12 years ago[asan] update asan docs: mention CMake problem and to explain the status of MacOS...
Kostya Serebryany [Thu, 15 Mar 2012 16:20:29 +0000 (16:20 +0000)]
[asan] update asan docs: mention CMake problem and to explain the status of MacOS 10.7 and 32-bit Linux

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

12 years agoAdding in newer MinGW header paths.
Aaron Ballman [Thu, 15 Mar 2012 14:31:30 +0000 (14:31 +0000)]
Adding in newer MinGW header paths.

Patch thanks to Nikola Smiljanic

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

12 years agoAdd the object size checking support for a few other builtins.
Bill Wendling [Thu, 15 Mar 2012 09:27:30 +0000 (09:27 +0000)]
Add the object size checking support for a few other builtins.

The functions memccpy, strdup, strndup, strlcat, and strlcpy should also have
object size checking support. Of course, this is only good if the C library also
supports these functions.
<rdar://problem/10528974>

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

12 years agoFix codegen for vld{3,4}_dup intrinsics.
James Molloy [Thu, 15 Mar 2012 09:12:01 +0000 (09:12 +0000)]
Fix codegen for vld{3,4}_dup intrinsics.

Patch by Silviu Baranga!

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

12 years agoUnpluralize -Wfoo-conversions warnings for consistency.
David Blaikie [Thu, 15 Mar 2012 05:09:31 +0000 (05:09 +0000)]
Unpluralize -Wfoo-conversions warnings for consistency.

Err on the side of brevity and rename (while providing aliases for the original
name) -Wbool-conversions, -Wint-conversions, and -Wvector-conversions for
consistency with constant, literal, string, and sign conversion warnings. And
name the diagnostic groups explicitly while I'm here rather than rewriting the
string in the groups and sema td files.

Curiously, vector-conversion is not under -Wconversion. Perhaps it should be.

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

12 years agoUnrevert r152761 (reverted in r152772) with a fix for the issue which was
Richard Smith [Thu, 15 Mar 2012 04:53:45 +0000 (04:53 +0000)]
Unrevert r152761 (reverted in r152772) with a fix for the issue which was
breaking bootstrap. No test yet: it's quite hard to tickle the failure case.
The specific testcase for this wouldn't be useful for testing anything more
general than a reintroduction of this precise bug in any case.

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

12 years agoReapply r152745 (reverted in 152765) now that compiler-rt is fixed.
David Blaikie [Thu, 15 Mar 2012 04:50:32 +0000 (04:50 +0000)]
Reapply r152745 (reverted in 152765) now that compiler-rt is fixed.

Original commit message:

Provide -Wnull-conversion separately from -Wconversion.

Like GCC, provide a NULL conversion to non-pointer conversion as a separate
flag, on by default. GCC's flag is "conversion-null" which we provide for
cross compatibility, but in the interests of consistency (with
-Wint-conversion, -Wbool-conversion, etc) the canonical Clang flag is called
-Wnull-conversion.

Patch by Lubos Lunak.
Review feedback by myself, Chandler Carruth, and Chad Rosier.

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