]> granicus.if.org Git - clang/log
clang
12 years agoAvoid infinite mutual recursion in DiagnoseInvalidRedeclaration.
Kaelyn Uhrain [Thu, 16 Feb 2012 22:40:59 +0000 (22:40 +0000)]
Avoid infinite mutual recursion in DiagnoseInvalidRedeclaration.

Don't try to typo-correct a method redeclaration to declarations not in
the current record as it could lead to infinite recursion if CorrectTypo
finds more than one correction candidate in a parent record.

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

12 years ago[analyzer] MallocChecker: more tests.
Anna Zaks [Thu, 16 Feb 2012 22:26:15 +0000 (22:26 +0000)]
[analyzer] MallocChecker: more tests.

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

12 years ago[analyzer] Malloc Checker: Clean up bug naming:
Anna Zaks [Thu, 16 Feb 2012 22:26:12 +0000 (22:26 +0000)]
[analyzer] Malloc Checker: Clean up bug naming:
 - Rename the category "Logic Error" -> "Memory Error".
 - Shorten all the messages.

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

12 years ago[analyzer] Malloc Checker: Make the diagnostic visitor handle the case
Anna Zaks [Thu, 16 Feb 2012 22:26:07 +0000 (22:26 +0000)]
[analyzer] Malloc Checker: Make the diagnostic visitor handle the case
of failing realloc. + Minor cleanups.

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

12 years agoPacify gcc's -Wreturn-type
Matt Beaumont-Gay [Thu, 16 Feb 2012 22:15:50 +0000 (22:15 +0000)]
Pacify gcc's -Wreturn-type

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

12 years agofix the property list metadata name.
Fariborz Jahanian [Thu, 16 Feb 2012 21:57:59 +0000 (21:57 +0000)]
fix the property list metadata name.

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

12 years agoImprove recovery for lambda expressions that have 'mutable' or a
Douglas Gregor [Thu, 16 Feb 2012 21:53:36 +0000 (21:53 +0000)]
Improve recovery for lambda expressions that have 'mutable' or a
trailing return type but not a '()'. Recover by inserting the
parentheses. Thanks to Xeo on IRC for the example.

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

12 years agomodern objective-c translator: write the root class meta-data.
Fariborz Jahanian [Thu, 16 Feb 2012 21:37:05 +0000 (21:37 +0000)]
modern objective-c translator: write the root class meta-data.

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

12 years agoLambda closure types are always considered to be like "local" classes,
Douglas Gregor [Thu, 16 Feb 2012 21:36:18 +0000 (21:36 +0000)]
Lambda closure types are always considered to be like "local" classes,
even if they are not within a function scope. Teach template
instantiation to treat them as such, and make sure that we have a
local instantiation scope when instantiating default arguments and
static data members.

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

12 years agoMake sure we still reject static data members in anonymous unions in C++11.
Richard Smith [Thu, 16 Feb 2012 21:23:54 +0000 (21:23 +0000)]
Make sure we still reject static data members in anonymous unions in C++11.

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

12 years agoAdd checker visitation hooks in ExprEngine::Visit() for common no-op expressions...
Ted Kremenek [Thu, 16 Feb 2012 20:56:01 +0000 (20:56 +0000)]
Add checker visitation hooks in ExprEngine::Visit() for common no-op expressions.  To be used later.

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

12 years agoRevert "Move ExplodedNode reclaimation out of ExprEngine and into CoreEngine. Also...
Ted Kremenek [Thu, 16 Feb 2012 20:48:04 +0000 (20:48 +0000)]
Revert "Move ExplodedNode reclaimation out of ExprEngine and into CoreEngine.  Also have it based on adding predecessors/successors, not node allocation.  No measurable performance change."

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

12 years agoC++11 allows unions to have static data members. Remove the corresponding
Richard Smith [Thu, 16 Feb 2012 20:41:22 +0000 (20:41 +0000)]
C++11 allows unions to have static data members. Remove the corresponding
restriction and add some tests.

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

12 years agoMove ExplodedNode reclaimation out of ExprEngine and into CoreEngine. Also have...
Ted Kremenek [Thu, 16 Feb 2012 20:19:30 +0000 (20:19 +0000)]
Move ExplodedNode reclaimation out of ExprEngine and into CoreEngine.  Also have it based on adding predecessors/successors, not node allocation.  No measurable performance change.

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

12 years agoMinor cleanup to node data structures in ExplodedGraph. No functionality change.
Ted Kremenek [Thu, 16 Feb 2012 20:19:25 +0000 (20:19 +0000)]
Minor cleanup to node data structures in ExplodedGraph.  No functionality change.

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

12 years agoTweak the comment on the 'q' length modifier again.
Hans Wennborg [Thu, 16 Feb 2012 18:58:32 +0000 (18:58 +0000)]
Tweak the comment on the 'q' length modifier again.

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

12 years agomodern objc translator: meta-data generation for first
Fariborz Jahanian [Thu, 16 Feb 2012 18:54:09 +0000 (18:54 +0000)]
modern objc translator: meta-data generation for first
part of class meta-data.

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

12 years agoFix this test to work with and without Asserts mode.
Dan Gohman [Thu, 16 Feb 2012 18:51:05 +0000 (18:51 +0000)]
Fix this test to work with and without Asserts mode.

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

12 years agoUpdate comment as per Joerg's comment on r150697.
Hans Wennborg [Thu, 16 Feb 2012 18:19:51 +0000 (18:19 +0000)]
Update comment as per Joerg's comment on r150697.

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

12 years agoIn Objective-C++, allow the keyword 'class' to be used as a property
Douglas Gregor [Thu, 16 Feb 2012 18:19:22 +0000 (18:19 +0000)]
In Objective-C++, allow the keyword 'class' to be used as a property
name for dot syntax, e.g., NSObject.class or foo.class. For other
C++-keywords-as-method-names, use message send syntax. Fixes
<rdar://problem/10794452>.

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

12 years agoIf code completion patterns are not enabled, use simpler else/else if
Douglas Gregor [Thu, 16 Feb 2012 17:49:04 +0000 (17:49 +0000)]
If code completion patterns are not enabled, use simpler else/else if
completions that don't insert braces. Fixes <rdar://problem/10764168>.

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

12 years agoAdd fixits for ARC casting errors for implicit conversions as well. rdar://10289283
Argyrios Kyrtzidis [Thu, 16 Feb 2012 17:31:07 +0000 (17:31 +0000)]
Add fixits for ARC casting errors for implicit conversions as well. rdar://10289283

Also fix the fixit (oh the irony) when it uses CFBridgingRetain/CFBridgingRelease;
they are supposed to be calls with the casted expression as parameter, they should
not be inserted into the cast like the __bridge keywords.

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

12 years agoMinor fix to template instantiation, which properly instantiates
DeLesley Hutchins [Thu, 16 Feb 2012 17:30:51 +0000 (17:30 +0000)]
Minor fix to template instantiation, which properly instantiates
dependent attributes on static members of templatized classes.

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

12 years agoThread safety analysis: Don't check for lockable on undefined types.
DeLesley Hutchins [Thu, 16 Feb 2012 17:15:51 +0000 (17:15 +0000)]
Thread safety analysis: Don't check for lockable on undefined types.

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

12 years agoThread-safety analysis: Disable checking inside constructors, destructors, lock,...
DeLesley Hutchins [Thu, 16 Feb 2012 17:13:43 +0000 (17:13 +0000)]
Thread-safety analysis: Disable checking inside constructors, destructors, lock, and unlock functions

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

12 years agoThread-Safety: added support for 'this' as a lock expression.
DeLesley Hutchins [Thu, 16 Feb 2012 17:03:24 +0000 (17:03 +0000)]
Thread-Safety: added support for 'this' as a lock expression.

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

12 years agoAllow thread safety attributes on function definitions.
DeLesley Hutchins [Thu, 16 Feb 2012 16:50:43 +0000 (16:50 +0000)]
Allow thread safety attributes on function definitions.
For compatibility with gcc, clang will now parse gcc attributes on
function definitions, but issue a warning if the attribute is not a
thread safety attribute.  Warning controlled by -Wgcc-compat.

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

12 years agoFormat string analysis: give 'q' its own enumerator.
Hans Wennborg [Thu, 16 Feb 2012 16:34:54 +0000 (16:34 +0000)]
Format string analysis: give 'q' its own enumerator.

This is in preparation for being able to warn about 'q' and other
non-standard format string features.

It also allows us to print its name correctly.

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

12 years agoTweak link order on Solaris so that global ctors work.
David Chisnall [Thu, 16 Feb 2012 16:00:47 +0000 (16:00 +0000)]
Tweak link order on Solaris so that global ctors work.

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

12 years agoProper checking of list-initializers for array new expressions.
Sebastian Redl [Thu, 16 Feb 2012 12:59:47 +0000 (12:59 +0000)]
Proper checking of list-initializers for array new expressions.

This finishes generalized initializer support in Sema.

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

12 years agoRevert "Revert "Make CXXNewExpr contain only a single initialier, and not hold the...
Sebastian Redl [Thu, 16 Feb 2012 12:22:20 +0000 (12:22 +0000)]
Revert "Revert "Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself.""

This reintroduces commit r150682 with a fix for the Bullet benchmark crash.

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

12 years agoRevert "Make CXXNewExpr contain only a single initialier, and not hold the used const...
Sebastian Redl [Thu, 16 Feb 2012 11:35:52 +0000 (11:35 +0000)]
Revert "Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself."
It leads to a compiler crash in the Bullet benchmark.

This reverts commit r12014.

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

12 years agoMake CXXNewExpr contain only a single initialier, and not hold the used constructor...
Sebastian Redl [Thu, 16 Feb 2012 10:58:10 +0000 (10:58 +0000)]
Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself.

Holding the constructor directly makes no sense when list-initialized arrays come into play. The constructor is now held in a CXXConstructExpr, if construction is what is done. The new design can also distinguish properly between list-initialization and direct-initialization, as well as implicit default-initialization constructors and explicit value-initialization constructors. Finally, doing it this way removes redundance from the AST because CXXNewExpr doesn't try to handle both the allocation and the initialization responsibilities.

This breaks the static analysis of new expressions. I've filed PR12014 to track this.

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

12 years agoFix test to not depend upon metadata numbers.
Bill Wendling [Thu, 16 Feb 2012 08:58:11 +0000 (08:58 +0000)]
Fix test to not depend upon metadata numbers.

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

12 years agotest/CodeGenObjC/arc-no-arc-exceptions.m: Disable it at -Asserts for now.
NAKAMURA Takumi [Thu, 16 Feb 2012 08:12:12 +0000 (08:12 +0000)]
test/CodeGenObjC/arc-no-arc-exceptions.m: Disable it at -Asserts for now.

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

12 years agoShift Microsoft enum extensions from -fms-extensions to -fms-compatibility, so -fms...
Eli Friedman [Thu, 16 Feb 2012 05:20:44 +0000 (05:20 +0000)]
Shift Microsoft enum extensions from -fms-extensions to -fms-compatibility, so -fms-extensions doesn't affect enum semantics in incompatible ways. <rdar://problem/10657186>.

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

12 years agoInitial implementation of IRGen for the lambda conversion-to-function-pointer operator.
Eli Friedman [Thu, 16 Feb 2012 03:47:28 +0000 (03:47 +0000)]
Initial implementation of IRGen for the lambda conversion-to-function-pointer operator.

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

12 years ago[analyzer] Diagnostics: Ensure that the default end of diagnostic path
Anna Zaks [Thu, 16 Feb 2012 03:41:01 +0000 (03:41 +0000)]
[analyzer] Diagnostics: Ensure that the default end of diagnostic path
piece can always be generated.

The default end of diagnostic path piece was failing to generate on a
BlockEdge that was outgoing from a basic block without a terminator,
resulting in a very simple diagnostic being rendered (ex: no path
highlighting or custom visitors). Reuse another function, which is
essentially doing the same thing and correct it not to fail when a block
has no terminator.

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

12 years ago[analyzer] Malloc Checker: Give up when a pointer escapes into a struct.
Anna Zaks [Thu, 16 Feb 2012 03:40:57 +0000 (03:40 +0000)]
[analyzer] Malloc Checker: Give up when a pointer escapes into a struct.

We are not properly handling the memory regions that escape into struct
fields, which led to a bunch of false positives. Be conservative here
and give up when a pointer escapes into a struct.

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

12 years agoconstexpr tidyups:
Richard Smith [Thu, 16 Feb 2012 02:46:34 +0000 (02:46 +0000)]
constexpr tidyups:
  * Fix bug when determining whether && / || are potential constant expressions
  * Try harder when determining whether ?: is a potential constant expression
  * Produce a diagnostic on sizeof(VLA) to provide a better source location

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

12 years agoAdd a few minor items to the 3.1 release notes.
Nico Weber [Thu, 16 Feb 2012 02:35:03 +0000 (02:35 +0000)]
Add a few minor items to the 3.1 release notes.

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

12 years agoFix the RecursiveASTVisitor to not traverse C++ default parameters twice.
Argyrios Kyrtzidis [Thu, 16 Feb 2012 02:02:14 +0000 (02:02 +0000)]
Fix the RecursiveASTVisitor to not traverse C++ default parameters twice.

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

12 years agoFix test for r150648.
Chad Rosier [Thu, 16 Feb 2012 01:56:55 +0000 (01:56 +0000)]
Fix test for r150648.

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

12 years agoStart of IRGen for lambda conversion operators.
Eli Friedman [Thu, 16 Feb 2012 01:37:33 +0000 (01:37 +0000)]
Start of IRGen for lambda conversion operators.

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

12 years agoUse the new method for specifying garbage collection metadata in the module.
Bill Wendling [Thu, 16 Feb 2012 01:13:30 +0000 (01:13 +0000)]
Use the new method for specifying garbage collection metadata in the module.

The garbage collection metadata needs to be merged "intelligently", when two or
more modules are linked together, and not merely appended. (Appending creates a
section which is too large.) The module flags metadata method is the way to do
this.
<rdar://problem/8198537>

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

12 years ago[libclang] Do index statements inside a type source info. rdar://10872758
Argyrios Kyrtzidis [Thu, 16 Feb 2012 01:12:04 +0000 (01:12 +0000)]
[libclang] Do index statements inside a type source info. rdar://10872758

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

12 years agoImplicitly define a lambda's conversion functions (to function
Douglas Gregor [Thu, 16 Feb 2012 01:06:16 +0000 (01:06 +0000)]
Implicitly define a lambda's conversion functions (to function
pointers and block pointers). We use dummy definitions to keep the
invariant that an implicit, used definition has a body; IR generation
will substitute the actual contents, since they can't be represented
as C++.

For the block pointer case, compute the copy-initialization needed to
capture the lambda object in the block, which IR generation will need
later.

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

12 years agoTeach clang to add metadata tags to calls and invokes in ObjC with
Dan Gohman [Thu, 16 Feb 2012 00:57:37 +0000 (00:57 +0000)]
Teach clang to add metadata tags to calls and invokes in ObjC with
-fno-objc-arc-exceptions. This will allow the optimizer to perform
optimizations which are only safe under that flag.

This is a part of rdar://10803830.

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

12 years agoMark the parenthesized array member initialization diagnostic as DefaultError,
Richard Smith [Thu, 16 Feb 2012 00:54:02 +0000 (00:54 +0000)]
Mark the parenthesized array member initialization diagnostic as DefaultError,
and move it out of -Wgnu so that -Wno-gnu leaves it enabled. As requested by
Eli.

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

12 years agoStart off release notes for clang 3.1 with reference to C11 anonymous structs
Richard Smith [Thu, 16 Feb 2012 00:32:27 +0000 (00:32 +0000)]
Start off release notes for clang 3.1 with reference to C11 anonymous structs
and unions, and C++11 generalized constant expressions.

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

12 years agoobjc-arc: For arc's ivar layout, treat __unsafe_unretained ivars
Fariborz Jahanian [Thu, 16 Feb 2012 00:15:02 +0000 (00:15 +0000)]
objc-arc: For arc's ivar layout, treat __unsafe_unretained ivars
as unscanned. // rdar://10832643

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

12 years agoRevert "Add a completed/incomplete type difference. This allows us to have"
Eric Christopher [Wed, 15 Feb 2012 23:51:20 +0000 (23:51 +0000)]
Revert "Add a completed/incomplete type difference. This allows us to have"

This reverts commit 9a68d4584afcd0853b930bd80235b58736e785b4.

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

12 years agoAdd a completed/incomplete type difference. This allows us to have
Eric Christopher [Wed, 15 Feb 2012 23:25:18 +0000 (23:25 +0000)]
Add a completed/incomplete type difference. This allows us to have
partial types for contexts and forward decls while allowing us to
complete types later on for debug purposes.

This piggy-backs on the metadata replacement and rauw changes
for temporary nodes and takes advantage of the incremental
support I added in earlier. This allows us to, if we decide,
to limit adding methods and variables to structures in order
to limit the amount of debug information output into a .o file.

The caching is a bit complicated though so any thoughts on
untangling that are welcome.

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

12 years agoSilence a valgrind warning, and remove an unused var.
Kaelyn Uhrain [Wed, 15 Feb 2012 22:59:03 +0000 (22:59 +0000)]
Silence a valgrind warning, and remove an unused var.

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

12 years agoSupport GCC's bug^Wextension allowing class array members to be initalized by a
Richard Smith [Wed, 15 Feb 2012 22:38:09 +0000 (22:38 +0000)]
Support GCC's bug^Wextension allowing class array members to be initalized by a
parenthesized braced-init-list in the base/member initialization list.

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

12 years agoImprove typo correction involving nested name specifiers.
Kaelyn Uhrain [Wed, 15 Feb 2012 22:14:18 +0000 (22:14 +0000)]
Improve typo correction involving nested name specifiers.

Snooping in other namespaces when the identifier being corrected is
already qualified (i.e. a valid CXXScopeSpec is passed to CorrectTypo)
and ranking synthesized namespace qualifiers relative to the existing
qualifier is now performed. Support for disambiguating the string
representation of synthesized namespace qualifers has also been added
(the change to test/Parser/cxx-using-directive.cpp is an example of an
ambiguous relative qualifier).

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

12 years agoLambda closure types have a conversion function to a block pointer
Douglas Gregor [Wed, 15 Feb 2012 22:08:38 +0000 (22:08 +0000)]
Lambda closure types have a conversion function to a block pointer
with the same parameter types and return type as the function call
operator. This is the real answer to

  http://stackoverflow.com/questions/4148242/is-it-possible-to-convert-a-c0x-lambda-to-a-clang-block

:)

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

12 years agoobjective-c translator: fixes an obscure rewriting bug
Fariborz Jahanian [Wed, 15 Feb 2012 22:01:47 +0000 (22:01 +0000)]
objective-c translator: fixes an obscure rewriting bug
which attempted to rewrite the same meta-data twice.

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

12 years agoFactor the construction of the lambda-to-function-pointer conversion function declara...
Douglas Gregor [Wed, 15 Feb 2012 22:00:51 +0000 (22:00 +0000)]
Factor the construction of the lambda-to-function-pointer conversion function declaration into a separate function. No functionality change

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

12 years agoProvide common include for all diagnostic headers.
David Blaikie [Wed, 15 Feb 2012 21:58:34 +0000 (21:58 +0000)]
Provide common include for all diagnostic headers.

Reviewed by Ted Kremenek.

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

12 years agoStore the warning option corresponding to a diagnostics as an index into the option...
Benjamin Kramer [Wed, 15 Feb 2012 20:57:03 +0000 (20:57 +0000)]
Store the warning option corresponding to a diagnostics as an index into the option table instead of storing the name.

Another 8 bytes + relocation removed from every diagnostic on x86_64.

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

12 years agoRemove the unuseful -fdiagnostics-show-name
David Blaikie [Wed, 15 Feb 2012 19:45:34 +0000 (19:45 +0000)]
Remove the unuseful -fdiagnostics-show-name

This option was added in r129614 and doesn't have any use case that I'm aware
of. It's possible that external tools are using these names - and if that's
the case we can certainly reassess the functionality, but for now it lets us
shave out a few unneeded bits from clang.

Move the "StaticDiagNameIndex" table into the only remaining consumer, diagtool.
This removes the actual diagnostic name strings from clang entirely.

Reviewed by Chris Lattner & Ted Kremenek.

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

12 years agoWhen overload resolution picks an implicitly-deleted special member
Douglas Gregor [Wed, 15 Feb 2012 19:33:52 +0000 (19:33 +0000)]
When overload resolution picks an implicitly-deleted special member
function, provide a specialized diagnostic that indicates the kind of
special member function (default constructor, copy assignment
operator, etc.) and that it was implicitly deleted. Add a hook where
we can provide more detailed information later.

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

12 years agoAdd some Solaris include paths and fix a -lgcc_eh that apparently should be -lgcc_s.
David Chisnall [Wed, 15 Feb 2012 18:24:31 +0000 (18:24 +0000)]
Add some Solaris include paths and fix a -lgcc_eh that apparently should be -lgcc_s.

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

12 years agoTweak comment above DiagGroup<"all">.
Nico Weber [Wed, 15 Feb 2012 18:18:51 +0000 (18:18 +0000)]
Tweak comment above DiagGroup<"all">.

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

12 years agoA little more lambda capture initialization diagnostics cleanup
Douglas Gregor [Wed, 15 Feb 2012 17:05:32 +0000 (17:05 +0000)]
A little more lambda capture initialization diagnostics cleanup

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

12 years agoIntroduce a new initialization entity for lambda captures, and
Douglas Gregor [Wed, 15 Feb 2012 16:57:26 +0000 (16:57 +0000)]
Introduce a new initialization entity for lambda captures, and
specialize location information and diagnostics for this entity.

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

12 years agoFix copy-and-paste error in comment
David Chisnall [Wed, 15 Feb 2012 16:25:46 +0000 (16:25 +0000)]
Fix copy-and-paste error in comment

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

12 years agoSpecialize noreturn diagnostics for lambda expressions.
Douglas Gregor [Wed, 15 Feb 2012 16:20:15 +0000 (16:20 +0000)]
Specialize noreturn diagnostics for lambda expressions.

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

12 years agoFix silly precedence error.
Douglas Gregor [Wed, 15 Feb 2012 15:59:09 +0000 (15:59 +0000)]
Fix silly precedence error.

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

12 years agoSpecialize the diagnostic complaining about conflicting types of
Douglas Gregor [Wed, 15 Feb 2012 15:57:22 +0000 (15:57 +0000)]
Specialize the diagnostic complaining about conflicting types of
return statements within a lambda; this diagnostic previously referred
to blocks.

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

12 years agoImplement code completion support for lambda capture lists.
Douglas Gregor [Wed, 15 Feb 2012 15:34:24 +0000 (15:34 +0000)]
Implement code completion support for lambda capture lists.

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

12 years agoFirst pass at Solaris toolchain support. This version compiles and links hello
David Chisnall [Wed, 15 Feb 2012 13:39:01 +0000 (13:39 +0000)]
First pass at Solaris toolchain support.  This version compiles and links hello
world on Solaris 11 for both x86 and x86-64 using the built-in assembler and
Solaris (not GNU) ld, however it currently relies on a hard-coded GCC location
to find crtbegin.o and crtend.o, as well as libgcc and libgcc_eh.

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

12 years agoConvert ad-hoc `int array[expr ? -1 : 1]' assertions
Dmitri Gribenko [Wed, 15 Feb 2012 13:30:53 +0000 (13:30 +0000)]
Convert ad-hoc `int array[expr ? -1 : 1]' assertions
in test/SemaCXX/nullptr.cpp to static_assert

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

12 years agoMake -Wformat fix-its preserve original conversion specifiers.
Hans Wennborg [Wed, 15 Feb 2012 09:59:46 +0000 (09:59 +0000)]
Make -Wformat fix-its preserve original conversion specifiers.

This commit makes PrintfSpecifier::fixType() and ScanfSpecifier::fixType()
only fix a conversion specification enough that Clang wouldn't warn about it,
as opposed to always changing it to use the "canonical" conversion specifier.
(PR11975)

This preserves the user's choice of conversion specifier in cases like:

printf("%a", (long double)1);
where we previously suggested "%Lf", we now suggest "%La"

printf("%x", (long)1);
where we previously suggested "%ld", we now suggest "%lx".

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

12 years agoIf a static data member of a class template which could be used in a constant
Richard Smith [Wed, 15 Feb 2012 02:42:50 +0000 (02:42 +0000)]
If a static data member of a class template which could be used in a constant
expression is referenced, defined, then referenced again, make sure we
instantiate it the second time it's referenced. This is the static data member
analogue of r150518.

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

12 years agoImplement DR1454. This allows all intermediate results in constant expressions
Richard Smith [Wed, 15 Feb 2012 02:18:13 +0000 (02:18 +0000)]
Implement DR1454. This allows all intermediate results in constant expressions
to be core constant expressions (including pointers and references to
temporaries), and makes constexpr calculations Turing-complete. A Turing machine
simulator is included as a testcase.

This opens up the possibilty of removing CCValue entirely, and removing some
copies from the constant evaluator in the process, but that cleanup is not part
of this change.

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

12 years ago[analyzer] Malloc checker: make a bit safer.
Anna Zaks [Wed, 15 Feb 2012 02:12:00 +0000 (02:12 +0000)]
[analyzer] Malloc checker: make a bit safer.

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

12 years agoFix typo in r150549.
Richard Smith [Wed, 15 Feb 2012 02:07:05 +0000 (02:07 +0000)]
Fix typo in r150549.

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

12 years agoSplit reinterpret_casts of member pointers out from CK_BitCast; this
John McCall [Wed, 15 Feb 2012 01:22:51 +0000 (01:22 +0000)]
Split reinterpret_casts of member pointers out from CK_BitCast; this
is general goodness because representations of member pointers are
not always equivalent across member pointer types on all ABIs
(even though this isn't really standard-endorsed).

Take advantage of the new information to teach IR-generation how
to do these reinterprets in constant initializers.  Make sure this
works when intermingled with hierarchy conversions (although
this is not part of our motivating use case).  Doing this in the
constant-evaluator would probably have been better, but that would
require a *lot* of extra structure in the representation of
constant member pointers:  you'd really have to track an arbitrary
chain of hierarchy conversions and reinterpretations in order to
get this right.  Ultimately, this seems less complex.  I also
wasn't quite sure how to extend the constant evaluator to handle
foldings that we don't actually want to treat as extended
constant expressions.

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

12 years agoImplement indexing support for lambdas in libclang (both kinds), as
Douglas Gregor [Wed, 15 Feb 2012 00:54:55 +0000 (00:54 +0000)]
Implement indexing support for lambdas in libclang (both kinds), as
well as improving the RecursiveASTVisitor's walk of lambda
expressions.

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

12 years agomodern objective-c translator: start writing the main class
Fariborz Jahanian [Wed, 15 Feb 2012 00:50:11 +0000 (00:50 +0000)]
modern objective-c translator: start writing the main class
meta-data.

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

12 years ago[analyzer] Add the Malloc checker to the list of tested checkers.
Anna Zaks [Wed, 15 Feb 2012 00:19:07 +0000 (00:19 +0000)]
[analyzer] Add the Malloc checker to the list of tested checkers.

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

12 years ago[analyzer] Malloc Checker: Add another false positive as a todo test.
Anna Zaks [Wed, 15 Feb 2012 00:11:28 +0000 (00:11 +0000)]
[analyzer] Malloc Checker: Add another false positive as a todo test.

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

12 years ago[analyzer] Malloc Checker: add support for reallocf, which always frees
Anna Zaks [Wed, 15 Feb 2012 00:11:25 +0000 (00:11 +0000)]
[analyzer] Malloc Checker: add support for reallocf, which always frees
the passed in pointer on failure.

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

12 years ago[analyzer] Malloc Checker: add support for valloc + minor code
Anna Zaks [Wed, 15 Feb 2012 00:11:22 +0000 (00:11 +0000)]
[analyzer] Malloc Checker: add support for valloc + minor code
hardening.

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

12 years agoExtend all-std-headers.cpp to include C++11 headers when building in C++11 mode.
Richard Smith [Tue, 14 Feb 2012 23:06:14 +0000 (23:06 +0000)]
Extend all-std-headers.cpp to include C++11 headers when building in C++11 mode.
Conditionally include headers which older STL implementations don't provide.

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

12 years agoAdvertize support for constexpr.
Richard Smith [Tue, 14 Feb 2012 22:56:17 +0000 (22:56 +0000)]
Advertize support for constexpr.

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

12 years agoI hereby declare that all remaining constexpr issues are bugs, not unimplemented
Richard Smith [Tue, 14 Feb 2012 22:39:23 +0000 (22:39 +0000)]
I hereby declare that all remaining constexpr issues are bugs, not unimplemented
features. :)

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

12 years agoconstexpr: evaluation support for nullptr comparisons.
Richard Smith [Tue, 14 Feb 2012 22:35:28 +0000 (22:35 +0000)]
constexpr: evaluation support for nullptr comparisons.

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

12 years agoImplement C++ core issue 974, which permits default arguments for
Douglas Gregor [Tue, 14 Feb 2012 22:28:59 +0000 (22:28 +0000)]
Implement C++ core issue 974, which permits default arguments for
lambda expressions. Because these issue was pulled back from Ready
status at the Kona meeting, we still emit an ExtWarn when using
default arguments for lambda expressions.

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

12 years agoIf a constexpr function template specialization is referenced, and then the
Richard Smith [Tue, 14 Feb 2012 22:25:15 +0000 (22:25 +0000)]
If a constexpr function template specialization is referenced, and then the
template is defined, and then the specialization is referenced again, don't
forget to instantiate the template on the second reference. Use the source
location of the first reference as the point of instantiation, though.

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

12 years ago[libclang] Indexing: only index implicit template instantiations via an opt-in indexi...
Argyrios Kyrtzidis [Tue, 14 Feb 2012 22:23:11 +0000 (22:23 +0000)]
[libclang] Indexing: only index implicit template instantiations via an opt-in indexing option.

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

12 years agoGeneralize -Wempty-body: warn when statement body is empty (closes: PR11329)
Dmitri Gribenko [Tue, 14 Feb 2012 22:14:32 +0000 (22:14 +0000)]
Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)

* if, switch, range-based for: warn if semicolon is on the same line.
* for, while: warn if semicolon is on the same line and either next
statement is compound statement or next statement has more
indentation.

Replacing the semicolon with {} or moving the semicolon to the next
line will always silence the warning.

Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp.

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

12 years ago[analyzer] Make Malloc Checker optimistic in presence of inlining.
Anna Zaks [Tue, 14 Feb 2012 21:55:24 +0000 (21:55 +0000)]
[analyzer] Make Malloc Checker optimistic in presence of inlining.
(In response of Ted's review of r150112.)

This moves the logic which checked if a symbol escapes through a
parameter to invalidateRegionCallback (instead of post CallExpr visit.)

To accommodate the change, added a CallOrObjCMessage parameter to
checkRegionChanges callback.

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

12 years agoRemove recusive expression visitation in ExprEngine::VisitIncrementDecrementOperator().
Ted Kremenek [Tue, 14 Feb 2012 21:38:30 +0000 (21:38 +0000)]
Remove recusive expression visitation in ExprEngine::VisitIncrementDecrementOperator().

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

12 years agoPending clear answer from WG21 on whether core issue 903 is intended to apply to
Richard Smith [Tue, 14 Feb 2012 21:38:30 +0000 (21:38 +0000)]
Pending clear answer from WG21 on whether core issue 903 is intended to apply to
C++11 or just C++17, restrict the set of null pointer constants in C++11 mode
back to those which were considered null in C++98.

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

12 years agoRemove recursive visitation in ExprEngine for UO_Not, UO_Minus, UO_LNot.
Ted Kremenek [Tue, 14 Feb 2012 21:31:00 +0000 (21:31 +0000)]
Remove recursive visitation in ExprEngine for UO_Not, UO_Minus, UO_LNot.

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

12 years agoRemove recursive visitation in ExprEngine for UO_Deref, UO_AddrOf, and UO_Extension.
Ted Kremenek [Tue, 14 Feb 2012 21:27:05 +0000 (21:27 +0000)]
Remove recursive visitation in ExprEngine for UO_Deref, UO_AddrOf, and UO_Extension.

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

12 years agoRemove ExprEngine recursive visitation of unary UO_Imag operation.
Ted Kremenek [Tue, 14 Feb 2012 21:27:02 +0000 (21:27 +0000)]
Remove ExprEngine recursive visitation of unary UO_Imag operation.

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