Commit Graph

36824 Commits

Author SHA1 Message Date
Rafael Espindola c41db927f3 Implement -fno-dwarf2-cfi-asm on linux too.
llvm-svn: 152316
2012-03-08 14:39:55 +00:00
Richard Smith 75025ba487 Ensure we don't print 123ULL_foo when printing a user-defined integer literal.
llvm-svn: 152303
2012-03-08 09:02:38 +00:00
Richard Smith 39570d0020 Add support for cooked forms of user-defined-integer-literal and
user-defined-floating-literal. Support for raw forms of these literals
to follow.

llvm-svn: 152302
2012-03-08 08:45:32 +00:00
Stepan Dyatkovskiy 85fcc2daf5 Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
  BasicBlock *BB = i.getCaseSuccessor();
  ConstantInt *V = i.getCaseValue();
  // Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.

llvm-svn: 152298
2012-03-08 07:06:48 +00:00
Daniel Dunbar d043733ad9 [AST] Change Type::isIntegerType to be inlined(). It is very popular.
llvm-svn: 152289
2012-03-08 02:52:18 +00:00
Richard Smith 0df56f4a90 Implement C++11 [lex.ext]p10 for string and character literals: a ud-suffix not
starting with an underscore is ill-formed.

Since this rule rejects programs that were using <inttypes.h>'s macros, recover
from this error by treating the ud-suffix as a separate preprocessing-token,
with a DefaultError ExtWarn. The approach of treating such cases as two tokens
is under discussion for standardization, but is in any case a conforming
extension and allows existing codebases to keep building while the committee
makes up its mind.

Reword the warning on the definition of literal operators not starting with
underscores (which are, strangely, legal) to more explicitly state that such
operators can't be called by literals. Remove the special-case diagnostic for
hexfloats, since it was both triggering in the wrong cases and incorrect.

llvm-svn: 152287
2012-03-08 02:39:21 +00:00
Douglas Gregor 3f28ec28d5 Loosen the precondition of isCXXInstanceMember() to simply return
"false" for declarations that aren't members of classes. Fixes PR12106.

llvm-svn: 152284
2012-03-08 02:08:05 +00:00
Daniel Dunbar 1c66a0e1c0 Spelling.
llvm-svn: 152281
2012-03-08 01:54:33 +00:00
Daniel Dunbar 9e19f13416 Sema: Don't emit a gajillion calls to sanity() -- an empty function -- in NDEBUG
builds. Sheesh.

llvm-svn: 152279
2012-03-08 01:43:06 +00:00
Richard Smith 75b67d6dc5 User-defined literal support for character literals.
llvm-svn: 152277
2012-03-08 01:34:56 +00:00
Richard Trieu 978dfc0d1e Fix -Wuninitialized to catch the case of a class being initialized with a call
to its own member function.

llvm-svn: 152276
2012-03-08 01:15:31 +00:00
Argyrios Kyrtzidis 8dbcfc39cd [libclang] Fix a crash when serializing a preprocessing record that contains
an #include entry that did not resolve to header file.

Part of rdar://11007039

llvm-svn: 152275
2012-03-08 01:08:28 +00:00
Douglas Gregor 0cf55e99c6 Streamline BalancedDelimiterTracker, by eliminating the duplicate
paren/brace/bracket tracking (the Consume* functions already did it),
removing the use of ConsumeAnyToken(), and moving the hot paths inline
with the error paths out-of-line.

llvm-svn: 152274
2012-03-08 01:00:17 +00:00
Fariborz Jahanian 80f8b4e7cb improve on diagnostic when block captures uninitialized
block variable. // rdar://10817031

llvm-svn: 152273
2012-03-08 00:52:24 +00:00
Anna Zaks c000e7ed3d Add a basic CallGraph to Analysis.
The final graph contains a single root node, which is a parent of all externally available functions(and 'main'). As well as a list of Parentless/Unreachable functions, which are either truly unreachable or are unreachable due to our analyses imprecision.

The analyzer checkers debug.DumpCallGraph or debug.ViewGraph can be used to look at the produced graph.

Currently, the graph is not very precise, for example, it entirely skips edges resulted from ObjC method calls.

llvm-svn: 152272
2012-03-08 00:42:23 +00:00
Fariborz Jahanian 429fadb8e2 improve on diagnostic and provide a fixit hint when
an uninitialized block variable is being called inside the
block literal. // rdar://10817031

llvm-svn: 152271
2012-03-08 00:22:50 +00:00
Argyrios Kyrtzidis bfb2425c71 [libclang] Enhance clang_getOverriddenCursors.
Basically the current design is:
-for an implementation method, show as overridden the interface method.
  This is not useful, and is inconsistent with the C++ side
-for an interface method, show as overridden the protocols methods (this is desirable)
  and the methods from the categories; methods from categories are not useful
  since they are considered the same method (same USR).
-If there is a protocol method or category method reported, it does not check the
  super class for overridden methods. This is really problematic since
  overridden methods from super class is what we want to give back.

Change clang_getOverriddenCursors to show as overridden any method in the class's
base class, its protocols, or its categories' protocols, that has the same
selector and is of the same kind (class or instance).
If no such method exists, the search continues to the class's superclass,
its protocols, and its categories, and so on. A method from an Objective-C
implementation is considered to override the same methods as its
corresponding method in the interface.

rdar://10967206

llvm-svn: 152270
2012-03-08 00:20:03 +00:00
Bob Wilson f2a23a99db Workaround module test failures by removing the version info from module hashes.
PR12196: The module hash strings are not actually hashing the compiler version
string; the entire version string is being included in the hash.  Depending on
the module cache directory name, that can lead to failures where the path
names become too long.  As a temporary workaround, just remove the version
string from the hash.

llvm-svn: 152266
2012-03-07 23:50:05 +00:00
Richard Trieu 3933f6f6ca Remove unnecessary include in ExprObjC.h
llvm-svn: 152239
2012-03-07 17:47:10 +00:00
Sebastian Redl e0691eae7d Be smarter in discovering list-initialization of temporaries. Fixes PR12182.
llvm-svn: 152231
2012-03-07 16:10:45 +00:00
Richard Smith 1e3c1d38f2 Correct the documentation to give a legal example of a raw string literal.
llvm-svn: 152216
2012-03-07 08:57:31 +00:00
Richard Smith c67fdd4eb9 AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this
representation.

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.

llvm-svn: 152211
2012-03-07 08:35:16 +00:00
Richard Smith a269ac0bca Test fix-it added in r152198.
llvm-svn: 152199
2012-03-07 03:18:34 +00:00
Richard Smith 3e4a60a2cd Add -Wc++11-compat warning for string and character literals followed by
identifiers, in cases where those identifiers would be treated as
user-defined literal suffixes in C++11.

llvm-svn: 152198
2012-03-07 03:13:00 +00:00
Richard Smith 8c029611a6 Don't even try to directly emit the value of a DeclRefExpr if that declaration
is not usable in a constant expression. ~2.5% speedup on 403.gcc / combine.c.

llvm-svn: 152193
2012-03-07 01:58:44 +00:00
Argyrios Kyrtzidis 4a280ff48f [PCH] Mark a PCH file with a flag to indicate if the serialized AST had
compiler errors or not.

-Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time.
By default, such a PCH file will be rejected with an error when trying to load it.

[libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors
occurred.
-Have libclang API calls accept a PCH that had compiler errors.

The general idea is that we want libclang to stay functional even if a PCH had a compiler error.
rdar://10976363.

llvm-svn: 152192
2012-03-07 01:51:17 +00:00
Eli Friedman 9b2ab81a0c Correct test from r152189.
llvm-svn: 152191
2012-03-07 01:13:38 +00:00
Eli Friedman 205a429891 Make sure we consistently canonicalize types when canonicalizing TemplateTemplateParmDecls. PR12179.
llvm-svn: 152189
2012-03-07 01:09:33 +00:00
Fariborz Jahanian d6cb4a858d objective-c lldb support: don't perform ivar access control check
when debugging. // rdar://10997647

llvm-svn: 152187
2012-03-07 00:58:41 +00:00
Andrew Trick 9179e8a4a3 More git-svn compatible version string, by request.
If you're using git-svn, the clang and llvm repository will typically
map to a different revision.

Before we had:
clang version 3.1 (trunk 152167 trunk 152162)

After this change:
clang version 3.1 (trunk 152167) (llvm/trunk 152162)

So it's self-descriptive with an extra parens group. Which is more
compatible with version string parsers is probably debatable, but this
style was requested.

llvm-svn: 152183
2012-03-07 00:44:24 +00:00
Richard Smith ecc124733a The constant folder's diagnosic mechanism is irrelevant for C; don't bother
producing a C-only diagnostic.

llvm-svn: 152181
2012-03-07 00:30:44 +00:00
Chad Rosier bee5a1df03 [driver] Don't try to generate diagnostic information for linker crashes.
rdar://10993648

llvm-svn: 152180
2012-03-07 00:30:40 +00:00
Benjamin Kramer e6a4affcc5 Silence unused variable warnings.
llvm-svn: 152170
2012-03-07 00:14:40 +00:00
Michael Han 4a04517329 Refactor Clang sema attribute handling.
This submission improves Clang sema handling by using Clang tablegen
to generate common boilerplate code. As a start, it implements AttributeList
enumerator generation and case statements for AttributeList::getKind.

A new field "SemaHandler" is introduced in Attr.td and by default set to 1
as most of attributes in Attr.td have semantic checking in Sema. For a small
number of attributes that don't appear in Sema, the value is set to 0.

Also there are a small number of attributes that only appear in Sema but not
in Attr.td. Currently these attributes are still hardcoded in Sema AttributeList.

Reviewed by Delesley Hutchins.

llvm-svn: 152169
2012-03-07 00:12:16 +00:00
Dylan Noblesmith bb8c7dabed AST: fix build since r152060
The declarations of the operators no longer matched.
The definitions in ASTContext.h had 'throw()' removed,
but it was still present in Attr.h.

Somehow the buildbots missed this. clang merely warns about
a missing 'throw()' specification and suggested a Fix-It adding
it back, but gcc 4.5 is not so forgiving and gives an error.

llvm-svn: 152167
2012-03-07 00:01:18 +00:00
Daniel Dunbar 082c62d943 [AST] VarDecl::hasDefinition() - Early exit if we find a strong definition.
llvm-svn: 152166
2012-03-06 23:52:46 +00:00
Daniel Dunbar 304314d739 [AST] FunctionDecl::getBuiltinID() - Eliminate spurious calls to getASTContext
-- which is very much not free -- in the common case.

llvm-svn: 152165
2012-03-06 23:52:37 +00:00
Ted Kremenek 5022f1dffe Fix horrific CFG bug where '@autoreleasepool' would be put in a dangling block in the CFG.
llvm-svn: 152163
2012-03-06 23:40:47 +00:00
Chad Rosier 909c47ba70 Missing period.
llvm-svn: 152160
2012-03-06 23:19:26 +00:00
Chad Rosier 1aeb15adf5 Whitespace.
llvm-svn: 152159
2012-03-06 23:14:35 +00:00
Sean Callanan 2db103c0ea Cleanup (style). Thanks to Argyrios for catching
this.

llvm-svn: 152158
2012-03-06 23:12:57 +00:00
Michael Han c222ced7dd commit access verified, revert change
llvm-svn: 152156
2012-03-06 22:55:51 +00:00
Michael Han b9929bdb91 test commit access
llvm-svn: 152155
2012-03-06 22:53:15 +00:00
NAKAMURA Takumi 66a7e43363 CMake: Fix build to add clangEdit to USED_LIBS.
llvm-svn: 152154
2012-03-06 22:32:32 +00:00
Argyrios Kyrtzidis 5652716a7a [objcmt] Add a triple to test/ARCMT/objcmt-subscripting-literals.m
llvm-svn: 152151
2012-03-06 22:03:39 +00:00
Sean Callanan 1249511024 Extended the UnknownAnyTy resolver to handle
blocks with unknown return types.  This allows
LLDB to call blocks even when their return types
aren't provided in the debug information.

llvm-svn: 152147
2012-03-06 21:34:12 +00:00
Fariborz Jahanian 461b7bb9e6 get rid of an unsued variable warning.
llvm-svn: 152146
2012-03-06 21:18:56 +00:00
Chad Rosier 64d6be979f [driver] What was implemented in r152130 was actually -fno-inline-functions, not
-fno-inline.
Part of rdar://10972766

llvm-svn: 152145
2012-03-06 21:17:19 +00:00
Benjamin Kramer ce80ce5fd8 Just use memcpy directly, uninitialized_copy requires an <algorithm> include.
Newer libstdc++s don't include it transitively everywhere.

llvm-svn: 152142
2012-03-06 20:39:11 +00:00
Ted Kremenek f7639e1b4a Add new code migrator support for migrating existing Objective-C code to use
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.

This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator.  We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.

llvm-svn: 152141
2012-03-06 20:06:33 +00:00
Ted Kremenek d151dde0e6 Enable default @synthesize by default.
llvm-svn: 152140
2012-03-06 20:06:15 +00:00
Ted Kremenek 415287d943 Add static analyzer support for new NSArray/NSDictionary/NSNumber literals.
llvm-svn: 152139
2012-03-06 20:06:12 +00:00
Ted Kremenek 77006f6875 And libclang cursor/indexing support for new Objective-C NSArray/NSDictionary/NSNumber literals.
llvm-svn: 152138
2012-03-06 20:06:06 +00:00
Ted Kremenek e65b086e07 Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals.  This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch.  It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

llvm-svn: 152137
2012-03-06 20:05:56 +00:00
Chad Rosier 9a099ea3eb Whitespace.
llvm-svn: 152134
2012-03-06 19:14:53 +00:00
Chad Rosier 94bdf697b2 Minor fix for r152130. Put -fno-inline in f_Group.
llvm-svn: 152132
2012-03-06 19:02:54 +00:00
Chad Rosier 806031896d [driver] Add support for -fno-inline.
rdar://10972766

llvm-svn: 152130
2012-03-06 18:49:20 +00:00
Fariborz Jahanian 197c68c856 Undo patch for // rdar://10735698
llvm-svn: 152128
2012-03-06 18:41:35 +00:00
Daniel Dunbar 492488271f AST: Move several Type::is...Type() functions to be inline.
- These functions are both (a) very commonly called and (b) excellent
   candidates for CSE in the callers in which they are commonly used.
 - That isHalfType() is hot makes me sad, but it is trivially when inlined (and
   a huge waste of time when not!!!).
 - The extra IsEnumDeclComplete() function is a hack to break the cycle between
   Type.h and Decl.h, I'm not sure of how to do this more cleanly, but am open
   to ideas.

llvm-svn: 152126
2012-03-06 18:20:20 +00:00
Benjamin Kramer d78f1ec183 NamespaceDecl: Call non-virtual method inside virtual method, not the other way round.
Moves the virtual call out of a hot path during lookup, no other functionality change.

llvm-svn: 152124
2012-03-06 18:07:25 +00:00
Fariborz Jahanian d7a3261dfb objective-c modern translator. Don't ignore unnamed bitfields
when rewriting.

llvm-svn: 152123
2012-03-06 17:16:27 +00:00
Argyrios Kyrtzidis 70b0878c46 Use newly introduced const-goodness of TinyPtrVector.
llvm-svn: 152108
2012-03-06 07:15:06 +00:00
Richard Smith d67aea28f6 User-defined literals: reject string and character UDLs in all places where the
grammar requires a string-literal and not a user-defined-string-literal. The
two constructs are still represented by the same TokenKind, in order to prevent
a combinatorial explosion of different kinds of token. A flag on Token tracks
whether a ud-suffix is present, in order to prevent clients from needing to look
at the token's spelling.

llvm-svn: 152098
2012-03-06 03:21:47 +00:00
Argyrios Kyrtzidis 735f9d4805 Use TinyPtrVector instead of UsuallyTinyPtrVector.
The latter is just a worse version of the former.

llvm-svn: 152096
2012-03-06 03:00:11 +00:00
Argyrios Kyrtzidis 04bd4321b9 Move clang/Basic/UsuallyTinyPtrVector.h to llvm/ADT/UsuallyTinyPtrVector.h.
Depends on llvm commit r152090.

llvm-svn: 152091
2012-03-06 02:09:28 +00:00
Ted Kremenek 04e860df2c [analyzer] add a diagnostic event when entering a call via inlining, within the callee, and add an edge.
llvm-svn: 152086
2012-03-06 01:25:01 +00:00
Ted Kremenek 024ba20bef [analyzer] 'Looping back to the head of the loop' diagnostics are prunable.
llvm-svn: 152083
2012-03-06 01:00:36 +00:00
Argyrios Kyrtzidis 840497dd81 Move include/clang/AST/UsuallyTinyPtrVector.h -> include/clang/Basic/UsuallyTinyPtrVector.h
and add an erase method to it.

Patch by Andrew Craik!

llvm-svn: 152082
2012-03-06 00:49:28 +00:00
Jordy Rose 330de22fe0 [analyzer] Remove now-unused constant. No functionality change.
llvm-svn: 152080
2012-03-06 00:33:35 +00:00
Jordy Rose 0accc6ae7b [analyzer] Fix unnecessary dyn_cast_or_null. No functionality change.
llvm-svn: 152078
2012-03-06 00:28:20 +00:00
Argyrios Kyrtzidis b5e420f707 Add some doxygen comments.
llvm-svn: 152075
2012-03-06 00:16:36 +00:00
Argyrios Kyrtzidis 87acf19a5c [tablegen] Make sure that the code that is determining the order of warning groups
is shared to avoid any "misalignment" if indices.

llvm-svn: 152074
2012-03-06 00:00:38 +00:00
Ted Kremenek 6762a94040 Teak CallAndMessageChecker to only warn about uninitialized struct fields in call arguments
when the called function is never inlined.

Fixes <rdar://problem/10977037>.

llvm-svn: 152073
2012-03-05 23:57:14 +00:00
Anna Zaks a5b86343f5 [analyzer] Bump up the size of the functions that should be
considered for inlining to 200 BBs.

Setting the max to 10 BBs introduced several false negatives, we'll
reevaluate the setting later on along with other inlining heuristics.

llvm-svn: 152072
2012-03-05 23:54:55 +00:00
Fariborz Jahanian d3ba40b90f Minor refactoring for previous patch for // rdar://10735698
llvm-svn: 152071
2012-03-05 23:38:41 +00:00
Richard Smith f506eaf36d static_assert: Allow any string-literal as the message, not just a character
string literal, and adjust the diagnostic code to match. This also causes us
to escape any control characters in the message.

llvm-svn: 152069
2012-03-05 23:20:05 +00:00
Ted Kremenek 9d96f843b8 Teach SimpleSValBuilder that (in the absence of more information) stack memory doesn't alias symbolic memory. This is a heuristic/hack, but works well in practice. Fixes <rdar://problem/10978247>.
llvm-svn: 152065
2012-03-05 23:06:19 +00:00
Daniel Dunbar 6290557872 AST/stats: Don't effectively use an out-of-line function to return a static
bool. Ugh.

llvm-svn: 152062
2012-03-05 21:42:49 +00:00
Daniel Dunbar e5617c79e4 ASTContext: Don't use nothrow specifications on the new operators for allocating
from the ASTContext.
 - Doing so requires the compiler to generate null checks against the returned
   result, but the BumpPtrAllocator never returns null pointers.
 - The optimizer can usually eliminate such checks, but not always, so this
   gives us tighter codegen in some places.
 - It would be really nice if we could just use __builtin_unreachable or
   something to tell the optimizer that the allocator never returns null, but
   LLVM isn't currently that smart.

llvm-svn: 152060
2012-03-05 21:02:05 +00:00
Anna Zaks 9bd4be9657 [analyzer] Time the execution (per each TU) with -analyzer-stats.
llvm-svn: 152059
2012-03-05 20:53:59 +00:00
Daniel Dunbar e8092cabeb build/compiler-rt: Stop forcing off -integrated-as for compiler-rt builds.
llvm-svn: 152054
2012-03-05 20:19:03 +00:00
Sebastian Redl 249dee5433 If the element type of an initializer list has a destructor, make sure we check it. Fixes PR12178.
llvm-svn: 152048
2012-03-05 19:35:43 +00:00
Fariborz Jahanian b0d7ce1b78 patch to optionally warn for block implementations without explicit
return types that return non-void values. // rdar://10735698

llvm-svn: 152047
2012-03-05 19:34:00 +00:00
Jim Grosbach 6c258a891f Add MCRegisterInfo to the MCInstPrinter factory function interface.
llvm-svn: 152046
2012-03-05 19:33:41 +00:00
Anna Zaks 53a0b6c161 [analyzer] False positive in SelfInit - teach the checker about method
calls with self as a parameter.

llvm-svn: 152039
2012-03-05 18:58:25 +00:00
Anna Zaks 12a8b90a36 [analyzer] Malloc should assume that ownership is transfered when
calling an ObjC method ending with 'NoCopy'.

llvm-svn: 152037
2012-03-05 17:42:10 +00:00
Benjamin Kramer 73ecd70d38 Avoid double lookup.
llvm-svn: 152033
2012-03-05 17:20:04 +00:00
Peter Collingbourne 15d48ec46f Properly handle non-canonical underlying types in
ASTContext::getUnaryTransformType.  This can happen if, for example,
an enumeration's underlying type is a typedef.

llvm-svn: 152031
2012-03-05 16:02:06 +00:00
Nico Weber b3ec7308b0 Fix a -Wstring-plus-int warning.
Patch from Sean Silva <silvas@purdue.edu>!

llvm-svn: 152030
2012-03-05 15:48:34 +00:00
Benjamin Kramer 27402c61c8 TargetInfo: create less temporary strings.
llvm-svn: 152029
2012-03-05 15:10:44 +00:00
Rafael Espindola 189fa748ec Fix a small difference in sema and codegen views of what needs to be output.
In the included testcase, soma thinks that we already have a definition after we
see the out of line decl. Codegen puts it in a deferred list, to be output if
a use is seen. This would break when we saw an explicit template instantiation
definition, since codegen would not be notified.

This patch adds a method to the consumer interface so that soma can notify
codegen that this decl is now required.

llvm-svn: 152024
2012-03-05 10:54:55 +00:00
James Molloy 7583ccdc1f Fix a bug in the mangler where in 'namespace std { extern "C" {X;} }', X would not be seen to be in ::std::.
Migrate two other places where the same logic is used to use the helper function that already exists.

llvm-svn: 152022
2012-03-05 09:59:43 +00:00
Argyrios Kyrtzidis afdc66f4fa [arcmt]
-Make sure we don't change to '__weak' a __block variable used as output.
-Make sure we don't apply __weak twice.

Fixes rdar://10520757&10521362

llvm-svn: 152020
2012-03-05 08:46:24 +00:00
Argyrios Kyrtzidis 647dcd80f0 [preprocessor] Enhance PreprocessingRecord to keep track of locations of conditional directives.
Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns
true if a given range intersects with a conditional directive block.

llvm-svn: 152018
2012-03-05 05:48:17 +00:00
Argyrios Kyrtzidis c793a61355 [preprocessor] Enhance the preprocessor callbacks:
-Add location parameter for the directives callbacks
-Skip callbacks if the directive is inside a skipped range.
-Make sure the directive callbacks are invoked in source order.

llvm-svn: 152017
2012-03-05 05:48:09 +00:00
Richard Smith 2a1b1c68f3 More tests for r152012.
llvm-svn: 152013
2012-03-05 04:06:25 +00:00
Richard Smith e18f0faff2 Lexing support for user-defined literals. Currently these lex as the same token
kinds as the underlying string literals, and we silently drop the ud-suffix;
those issues will be fixed by subsequent patches.

llvm-svn: 152012
2012-03-05 04:02:15 +00:00
Gregory Szorc 74226d3597 [clang.py] Return bool from Cursor.__eq__
llvm-svn: 152011
2012-03-05 00:42:15 +00:00
Erik Verbruggen 8c738bc98a Remove a recursive visitation in ExprEngine that is no longer needed because the CFG is fully linearized.
llvm-svn: 152007
2012-03-04 18:12:21 +00:00
Chandler Carruth 52b6ac2a78 Silence a GCC warning about a set-but-not-used variable in release builds.
llvm-svn: 152005
2012-03-04 12:16:40 +00:00
Richard Smith 72eebee0cb Add tests for [over.literal]. Fix a few bugs which were exposed by the tests.
llvm-svn: 151997
2012-03-04 09:41:16 +00:00
Chris Lattner 332673d39d From his comment in PR12168, Eli seems confused about the alignment assumptions
we're making.  We only ignore implicit casts.  Add a testcase showing that
we get the right behavior with explicit casts.

llvm-svn: 151994
2012-03-04 00:56:24 +00:00
Chris Lattner aaa18fad7d add a testcase for PR12094 and fix a crash on pointer to incomplete type,
reported by Richard Smith.

llvm-svn: 151993
2012-03-04 00:52:12 +00:00
Richard Smith 522fa53703 Add a pile of tests for unrestricted unions, and advertise support for them.
llvm-svn: 151992
2012-03-03 23:51:05 +00:00
Richard Smith 2e312c8738 constexpr: Remove APValue/CCValue distinction. It is no longer useful given the
resolution of core issue 1454.

llvm-svn: 151991
2012-03-03 22:46:17 +00:00
Benjamin Kramer 15ceed9a9e Remove unused variable.
llvm-svn: 151989
2012-03-03 21:52:22 +00:00
Jean-Daniel Dupas 999892f0d0 Fix Typo in 'objc changes' anchor.
llvm-svn: 151978
2012-03-03 13:37:22 +00:00
Eli Friedman 5358a0ab5a Avoid an unnecessary recursive loop between type canonicalization and NNS canonicalization which would (rarely) lead to memory corruption. While I'm here, simplify. Fixes PR12166. Not committing a testcase because it's impossible to reduce it.
llvm-svn: 151967
2012-03-03 04:09:56 +00:00
Ted Kremenek 868dbda367 [analyzer] do not warn about returning stack-allocated memory when it comes from an ancestor stack frame.
llvm-svn: 151964
2012-03-03 01:22:03 +00:00
Richard Smith 906ccc167c Factor bitfields of LangOptions out into a base class in order to make them
trivially-copyable. 50KiB reduction in clang binary size.

llvm-svn: 151963
2012-03-03 00:52:40 +00:00
Daniel Dunbar ae77b3dfad Frontend: Default to creating output files using temporary files + rename.
- This is a more reliable default, as it behaves better on failure and also
   ensures that we create *new* files (instead of reusing existing inodes). This
   is useful for other applications (like lldb) which want to cache inode's to
   know when a file has been rewritten.

llvm-svn: 151961
2012-03-03 00:36:06 +00:00
Daniel Dunbar b9c62c0773 Frontend: Don't automatically create missing directories when using temporary files with createOutputFile()
- This would otherwise happen as a side effect of llvm::sys::fs::unique_file creating parent directories.

llvm-svn: 151960
2012-03-03 00:36:02 +00:00
DeLesley Hutchins e2a3f75a12 Thread safety analysis: expand set of expressions that can be used to denote locks.
llvm-svn: 151956
2012-03-02 23:36:05 +00:00
Richard Smith bc638767f8 Reinstate r151879, r151880, reverted in r151922, along with a bugfix for
scalar emission of DeclRefExprs to const bools: emit scalar bools as i1,
not as i8.

In addition to the extra unit testing, this has successfully bootstrapped.

llvm-svn: 151955
2012-03-02 23:27:11 +00:00
Anna Zaks b8b21e9b56 Unbreak the CMake builds following the CallGraph change.
llvm-svn: 151952
2012-03-02 23:18:45 +00:00
Nico Weber 9b9ebfc090 Add a test for the -Wstring-plus-int fixit note.
llvm-svn: 151951
2012-03-02 23:01:20 +00:00
Anna Zaks fc5dfe9f7c [analyzer] Rename clang::CallGraph into clang::idx::CallGraph + rename
the corresponding files to avoid confusion.

This is a preparation to adding an AST-based call graph to Analysis. The
existing call graph works with indexer entries. We might be able to
refactor it to use the AST based graph in the future.

(Minimal testing here as the only example that uses the API has been
completely broken, does not compile.)

llvm-svn: 151950
2012-03-02 22:54:36 +00:00
Aaron Ballman 611306eae6 Adding support for #pragma include_alias in MS compatibility mode. This implements PR 10705.
llvm-svn: 151949
2012-03-02 22:51:54 +00:00
DeLesley Hutchins 71d6103295 Issue warning when late-parsed attributes have no declaration.
llvm-svn: 151947
2012-03-02 22:29:50 +00:00
DeLesley Hutchins bd2ee13e78 Make late-parsed attributes follow the conventions of ordinary
GNU attributes to a better extent, by allowing them in more
places on a declator.

llvm-svn: 151945
2012-03-02 22:12:59 +00:00
DeLesley Hutchins a2587ef26d Thread safety analysis: handle CFG blocks which call functions marked as noreturn.
llvm-svn: 151944
2012-03-02 22:02:58 +00:00
Nico Weber ccec40d9b7 Add -Wstring-plus-int, which warns on "str" + int and int + "str".
It doesn't warn if the integer is known at compile time and within
the bounds of the string.

Discussion: http://comments.gmane.org/gmane.comp.compilers.clang.scm/47203
llvm-svn: 151943
2012-03-02 22:01:22 +00:00
Fariborz Jahanian 7923ef41e1 objc: When issue diagnostic about deprecated method, also
issue the note if it is because message is sent to a forward class
declaration in delayed diagnostic. // rdar://10290322

llvm-svn: 151942
2012-03-02 21:50:02 +00:00
Ted Kremenek aa1f96add5 [analyzer diagnostics] flush locations *before* popping the current path when visiting a CallEnter.
Fixes <rdar://problem/10967815>

llvm-svn: 151938
2012-03-02 21:16:22 +00:00
Hal Finkel 2690838227 Fix an ABI problem with ptrdiff_t and intptr_t on PPC32
ptrdiff_t on PPC32 on Linux, etc. should be int not long.
This does not matter for C, but it does matter for C++ because of
name mangling.

The preprocessor test has been changed accordingly.

llvm-svn: 151935
2012-03-02 20:54:36 +00:00
Nico Weber 99c07bc822 Move int<->pointer conversion warnings behind -Wint-conversions.
This is consistent with -Wbool-conversion. Let me know if you prefer
a different flag name.

llvm-svn: 151934
2012-03-02 20:23:08 +00:00
Argyrios Kyrtzidis 4af2cb3355 [Sema] Fix crash-on-invalid-code issue:
@class I;
@implementation I(cat) // crashes here
@end

rdar://10968158

llvm-svn: 151931
2012-03-02 19:14:29 +00:00
Anna Zaks 265087721a [analyzer] Bound the size of the functions being inlined + provide
command line options for inlining tuning.

This adds the option for stack depth bound as well as function size
bound. 

+ minor doxygenification

llvm-svn: 151930
2012-03-02 19:05:03 +00:00
Jay Foad b0f3344b10 PR12094: Set the alignment of memory intrinsic instructions based on the
types of the pointer arguments.

llvm-svn: 151927
2012-03-02 18:34:30 +00:00
Fariborz Jahanian bf48281c25 Change diagnostic test for my last patch.
// rdar://10961370

llvm-svn: 151923
2012-03-02 17:05:03 +00:00
Daniel Dunbar d01281fe0d Revert r151879, r151880, "PR12145: Avoid emitting loads of constexpr variables in contexts where there" and "Fix buildbot: make this test less dependent on the value names in the produced IR."
They broke bootstrap.

llvm-svn: 151922
2012-03-02 16:24:25 +00:00
Benjamin Kramer 8fe5fc8521 Use tabs instead of spaces.
No, really, make doesn't work with spaces.

llvm-svn: 151920
2012-03-02 16:06:37 +00:00
Jia Liu 5c302484e9 clang -v support for separate clang.git and llvm.git, patch by Andrew Trick.
llvm-svn: 151910
2012-03-02 14:37:41 +00:00
David Chisnall e04307e47c Add the Solaris support directory to the header search when using libc++.
Unconditionally define __C99FEATURES__ when using C++ on Solaris.  This is a
(hopefully temporary) work around for libc++ exposing C99-but-not-C++98
features in C++98 mode.

llvm-svn: 151889
2012-03-02 10:49:52 +00:00
Richard Smith 35ecb36fcd Ensure that we instantiate static reference data members of class templates
early, since their values can be used in constant expressions in C++11. For
odr-use checking, the opposite change is required, since references are
odr-used whether or not they satisfy the requirements for appearing in a
constant expression.

llvm-svn: 151881
2012-03-02 04:14:40 +00:00
Richard Smith 545f38c3d2 Fix buildbot: make this test less dependent on the value names in the produced IR.
llvm-svn: 151880
2012-03-02 03:22:38 +00:00
Richard Smith a541a3bbee PR12145: Avoid emitting loads of constexpr variables in contexts where there
is no odr-use of the variable. Go slightly beyond what the standard requires
for variables of reference type.

llvm-svn: 151879
2012-03-02 03:16:32 +00:00
Ted Kremenek f9e9d33019 [analyzer diagnostics] Change CompactPathDiagnostic to recursively compact diagnostics in calls into macro pieces.
Also fix handling of macros within calls in the HTMLDiagnostics.

This also adds a test case for r151774.

llvm-svn: 151872
2012-03-02 01:27:31 +00:00
Fariborz Jahanian 3854a55a17 c/objc: problem originally reported as an objective-c bug.
But it is in the underlying c part of clang. clang crashes
in IRGen when passing an incomplete type argument to 
variadic function (instead of diagnosing the bug).
// rdar://10961370

llvm-svn: 151862
2012-03-01 23:42:00 +00:00
Kostya Serebryany b187449435 add documentation for -f[no-]thread-sanitizer and -f[no-]address-sanitizer to docs/UsersManual.html
llvm-svn: 151858
2012-03-01 23:14:19 +00:00
Ted Kremenek 57207d6074 Teach the analyzer to just ignore CXXBindTemporaryExpr. There's nothing special to do with it, since destructors are represented explicitly in the CFG.
llvm-svn: 151856
2012-03-01 23:06:04 +00:00
Ted Kremenek 9466603322 Moving tagging of '__experimental_modules_import' IdentifierInfo out of
IndentifierTable::get() and into IdentifierTable's constructor.

This gets a 0.7% reducing on lexing time for Cocoa.h, and
about the same for PCH generation.

llvm-svn: 151854
2012-03-01 22:53:32 +00:00
Eli Friedman c4e5d0ccda Make CodeGenFunction::EmitBlockCopyAndAutorelease actually do what its name says.
llvm-svn: 151853
2012-03-01 22:52:28 +00:00
Eric Christopher 5bc1f47b00 Update test for llvm assembly output change. Also add a fixme that this
shouldn't be relying on assembly emission.

For the record we should check the metadata output from the front
end and then check in the backend that such a thing emits a pubtypes
entry.

llvm-svn: 151851
2012-03-01 22:49:10 +00:00
Anna Zaks d5c3027473 [analyzer] Turn inlining on by default for better testing exposure.
Fix a test, which was most likely an unintended recursive call.

llvm-svn: 151848
2012-03-01 22:37:46 +00:00
Kostya Serebryany 28a7a1198b Add a flag -fthread-sanitizer.
This flag enables ThreadSanitizer instrumentation committed to llvm as r150423.
The patch includes one test for -fthread-sanitizer and one similar test for -faddress-sanitizer.
This patch does not modify the linker flags (as we do it for -faddress-sanitizer) because the run-time library is not yet
committed and it's structure in compiler-rt is not 100% clear.
The users manual wil be changed in a separate commit.

llvm-svn: 151846
2012-03-01 22:27:08 +00:00
Ted Kremenek c1e4dd0e8e Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.

llvm-svn: 151841
2012-03-01 22:07:04 +00:00
Anna Zaks 8dc53af5dc [analyzer] Fix a regression introduced in malloc with
attributes, introduced in r151188.

+ the test to catch it.

Thanks to Ahmed Charles for pointing this out.

llvm-svn: 151840
2012-03-01 22:06:06 +00:00
Eric Christopher 4b6753cf10 Reapply r151702 with a small fix for a failure to cut and paste
correctly.

Still rdar://10900684

llvm-svn: 151838
2012-03-01 21:36:52 +00:00
Eli Friedman 23b1be991e Fix the isReferenced bit on parameters in a couple of edge cases. PR12153.
llvm-svn: 151837
2012-03-01 21:32:56 +00:00
Argyrios Kyrtzidis 888d4a62fa Remove test/Sema/many-logical-ops.c since it fails in linux variants.
Will bring it up once the issue is fixed properely.

llvm-svn: 151830
2012-03-01 19:47:26 +00:00
Argyrios Kyrtzidis 981a961d03 Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.
Needs llvm update.

llvm-svn: 151829
2012-03-01 19:45:56 +00:00
Jean-Daniel Dupas 7598fadd78 Merge __has_attribute tests. Patch by Jonathan Sauer!
llvm-svn: 151819
2012-03-01 17:45:53 +00:00
Peter Collingbourne cdb9f302d0 StmtProfiler: Add a null check for child statements.
llvm-svn: 151812
2012-03-01 16:34:31 +00:00
Jean-Daniel Dupas 908f130d58 Implement double underscore names support in __has_attribute
llvm-svn: 151809
2012-03-01 14:53:16 +00:00
Richard Smith ebcd2357fb Avoid examining the AST from the parser, and simplify somewhat.
llvm-svn: 151805
2012-03-01 07:10:06 +00:00
Richard Smith ead9a05596 Revert r151800, which was committed without review and has correctness issues.
llvm-svn: 151804
2012-03-01 06:49:39 +00:00
Aaron Ballman 4fd4e6d75b Fixing a buildbot complaint about nested templates.
llvm-svn: 151803
2012-03-01 04:55:54 +00:00
Aaron Ballman cd5092dfba Implements support for #pragma include_alias in ms compatibility mode. Fixes PR10705.
llvm-svn: 151800
2012-03-01 04:18:49 +00:00
Aaron Ballman 9ecff02a45 Added support for parsing declspecs on enumerations. Fixes PR8783
llvm-svn: 151798
2012-03-01 04:09:28 +00:00
Eli Friedman 98b01edc8c Implement "optimization" for lambda-to-block conversion which inlines the generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap.
Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal.  With ARC, the effect is much less obvious because the lifetime of blocks is already managed.

llvm-svn: 151797
2012-03-01 04:01:32 +00:00
Richard Smith 5e0cac784a Reject 'a = {0} = {0}' rather than parsing it as '(a = {0}) = {0}'. Also
improve the diagnostics for some attempts to use initializer lists in
expressions.

llvm-svn: 151794
2012-03-01 02:59:17 +00:00
Richard Smith d18cd186d0 Correct an example of a feature name to actually use a feature name rather
than an attribute name. Patch by Michel Morin!

llvm-svn: 151791
2012-03-01 02:12:07 +00:00
Ted Kremenek 05e916bc95 Fix regression from llvm-gcc where we should NOT emit a warning about __attribute__((NSObject)) on a property declaration. This is needed to have retain properties for non-object pointers. Fixes <rdar://problem/10930507>.
llvm-svn: 151786
2012-03-01 01:40:32 +00:00
Anna Zaks ec9c4e487c [analyzer] Diagnostics - do not try to cleanup the path with macros, it
will be done by the general cleanup later on.
A Patch by Ted.

llvm-svn: 151784
2012-03-01 01:30:58 +00:00
Eli Friedman 2fb8512888 Tighten type-checking a bit to make it clearer how BuildCXXMemberCallExpr is used.
llvm-svn: 151783
2012-03-01 01:30:04 +00:00
Nico Weber 2c21c449d9 Move suport for redefining operator keywords from -fms-extensions to -fms-compatibility.
llvm-svn: 151776
2012-03-01 00:13:46 +00:00
Ted Kremenek 0a8e00d493 Change if...else if...else if... to a switch.
llvm-svn: 151775
2012-03-01 00:05:06 +00:00
Ted Kremenek 0f0cc35935 [analyzer] when scanning FIDs in a PathDiagnostic, correctly recurse calls and macros.
llvm-svn: 151774
2012-02-29 23:59:20 +00:00
Nico Weber 2e686205e8 Allow operator keywords to be #defined in ms-ext mode.
Fixes PR10606.

I'm not sure if this is the best way to go about it, but
I locally enabled this code path without the msext conditional,
and all tests pass, except for test/Preprocessor/cxx_oper_keyword.cpp
which explicitly checks that operator keywords can't be redefined.

I also parsed chromium/win with a clang with and without this patch.
It introduced no new errors, but removes 43 existing errors.

llvm-svn: 151768
2012-02-29 22:54:43 +00:00
Fariborz Jahanian 203ea38085 Test for my last patch. // rdar://10267155.
llvm-svn: 151767
2012-02-29 22:21:36 +00:00
Fariborz Jahanian 86c2f5cc70 objective-c: provide fixit hint when atomic property does not
have matching user defined setter/getter and a warning is issued. 
In this case, a fixit note is displayed. // rdar://10267155

llvm-svn: 151766
2012-02-29 22:18:55 +00:00
Eli Friedman 381f431e28 Fix a couple -Wuninitialized warnings from gcc. Reported by David Greene.
llvm-svn: 151754
2012-02-29 20:59:56 +00:00
Daniel Dunbar 9a96386e6d Serialization: Switch over to using the native SmallVector based BitstreamWriter
ctor.

llvm-svn: 151752
2012-02-29 20:31:23 +00:00
Chad Rosier ff3f99bf0a I referenced the incorrect rdar in my previous commit (r151745). Add the
correct radar number to the test case for tracking purposes.
rdar://10551066

llvm-svn: 151746
2012-02-29 20:18:57 +00:00
Chad Rosier b1cfc6864f Allocate TargetLibraryInfo for the CodeGen passes. Otherwise, it's instantiated
by the BAA pass, which uses the default TargetLibraryInfo constructor.
Unfortunately, the default TargetLibraryInfo constructor assumes all library
calls are available and thus ignores -fno-builtin.
rdar://10947759

llvm-svn: 151745
2012-02-29 20:14:59 +00:00
Jason W Kim 4ee2957629 Reverting test commit
llvm-svn: 151739
2012-02-29 19:12:10 +00:00
Jason W Kim 5beed97f67 Test commit. Please ignore
llvm-svn: 151738
2012-02-29 19:08:25 +00:00
Anna Zaks e0c03cab58 [analyzer] Malloc: A pointer might escape through CFContainers APIs,
funopen, setvbuf.

Teach the checker and the engine about these APIs to resolve malloc
false positives. As I am adding more of these APIs, it is clear that all
this should be factored out into a separate callback (for example,
region escapes). Malloc, KeyChainAPI and RetainRelease checkers could
all use it.

llvm-svn: 151737
2012-02-29 18:42:47 +00:00
Daniel Dunbar c2f9dc91c1 Revert r151702, "Add support for handling captured variables in lambda debug
info.", which broke some -O0 -g tests.

llvm-svn: 151730
2012-02-29 16:28:29 +00:00
David Chisnall 272a071d65 Add -C when linking on Solaris so that the error messages are understandable by actual humans.
llvm-svn: 151726
2012-02-29 15:06:12 +00:00
Sebastian Redl c7b718eb53 Tentatively fix PR12117. The test case from the bug now passes, and all existing tests still pass, but there may still be corner cases.
llvm-svn: 151716
2012-02-29 12:47:43 +00:00
James Molloy 6f8780bed1 Reapply r151638 and r151641.
The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation.

These are now fixed, with regression tests added to catch them both (not Darwin-specific).

Original log:
====================

Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h

Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

====================

llvm-svn: 151712
2012-02-29 10:24:19 +00:00
Erik Verbruggen 64aea6524d Remove a recursive visitiation in ExprEngine that is no longer needed
because the CFG is fully linearized.

llvm-svn: 151711
2012-02-29 08:42:57 +00:00
Ted Kremenek ef5c554df4 [analyzer] Tweak the UnreachableCode checker to not warning about unreachable default blocks. Patch by Cyril Roelandt!
llvm-svn: 151709
2012-02-29 06:05:28 +00:00
Eli Friedman e4f22dfa95 A couple minor bug-fixes for template instantiation for expressions which are sometimes potentially evaluated.
llvm-svn: 151707
2012-02-29 04:03:55 +00:00
Argyrios Kyrtzidis 3dbeb55874 [driver] Emit an error when trying to use ARC on macosx earlier than 10.6
rdar://10459258

llvm-svn: 151706
2012-02-29 03:43:52 +00:00
Eric Christopher 3203f6b9da Add support for handling captured variables in lambda debug info.
This currently doesn't handle capturing the 'this' pointer for any
enclosing class.

Steal the lambda-expressions.cpp testcase and debugify it and try
to use more variables to proof it against random changes.

Part of rdar://10900684

llvm-svn: 151702
2012-02-29 03:25:30 +00:00
Eric Christopher b0177eba7c Add some iterators for grabbing lambda expression contexts.
llvm-svn: 151701
2012-02-29 03:25:27 +00:00
Eric Christopher d47e0862b2 Formatting.
llvm-svn: 151700
2012-02-29 03:25:18 +00:00
Eli Friedman c6237c6e05 Make the odr-use logic work correctly for constant-expressions. PR12006.
llvm-svn: 151699
2012-02-29 03:16:56 +00:00
Daniel Dunbar d6d74c37ec Sema/ObjC: Override search can generate a large search list, bump the base size
of the SmallPtrSet way up to avoid commonly reallocating the buffer size.
 - I didn't see a good argument against it, so I bumped the limit to cover the
   max size we see during parsing Cocoa.h.

llvm-svn: 151698
2012-02-29 03:04:05 +00:00
Daniel Dunbar a5acaa3ca8 ASTWriter: Cache some DenseMaps we use repeatedly.
- This reduces our total # of allocations building a PCH for Cocoa.h by almost
   a whopping 50%.
 - A SmallPtrMap would be cleaner, but since we don't have one yet...

llvm-svn: 151697
2012-02-29 02:39:13 +00:00
NAKAMURA Takumi 10cea170d2 clang/test/Analysis/stats.c: Fix up r151656.
llvm-svn: 151695
2012-02-29 02:04:39 +00:00
NAKAMURA Takumi f1801d65e7 clang/test/Analysis/stats.c: Mark this as XFAIL: mingw32.
FIXME: Could we guarantee not to get stack overflow also on mingw?
llvm-svn: 151692
2012-02-29 01:50:38 +00:00
Daniel Dunbar 340cf24be1 Parse: Change PragmaPackHandler to use the preprocessor allocator.
llvm-svn: 151689
2012-02-29 01:38:22 +00:00
Fariborz Jahanian 1dc712f7cc objective-c modern translator. Fixes misc. bug in writing
the ivar offset symbol.

llvm-svn: 151683
2012-02-29 00:26:20 +00:00
Daniel Dunbar 0b4b32433c Remove stray semi-colon.
llvm-svn: 151682
2012-02-29 00:20:42 +00:00
Eli Friedman 576cbd03b4 Make sure list-initialization of arrays works correctly in explicit type conversions. PR12121.
llvm-svn: 151674
2012-02-29 00:00:28 +00:00
Argyrios Kyrtzidis fcbfdee5df [libclang] Add a test I forgot to commit.
llvm-svn: 151669
2012-02-28 23:39:24 +00:00
Argyrios Kyrtzidis 5cb4760aed [PCH] Include a darwin-only PCH test on Cocoa.h.
llvm-svn: 151668
2012-02-28 23:39:20 +00:00
Argyrios Kyrtzidis 5929ef2ee7 Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h
Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

llvm-svn: 151667
2012-02-28 23:39:14 +00:00
Sebastian Redl 12edeb0899 Single- and zero-element initializer lists to scalars are list-initializations. Fixes PR12118.
llvm-svn: 151666
2012-02-28 23:36:38 +00:00
Ted Kremenek 0f70a6f51e [analyzer diagnostics] Refactor filtration for PathDiagnosticConsumers that don't support cross-file diagnostics
into a common place.  Currently enable this filtration for Plist diagnostics as well.

llvm-svn: 151664
2012-02-28 23:27:39 +00:00
Ted Kremenek 2429c6ffe7 [analyzer diagnostics] start prototyping stripping PathDiagnostics of unnecessary cruft caused by path inlining.
This introduces a concept of a "prunable" PathDiagnosticEvent.  Currently this is a flag, but
we may evolve the concept to make this more dynamically inferred.

llvm-svn: 151663
2012-02-28 23:06:21 +00:00
Fariborz Jahanian 265a421dd9 Modern objective-c translator. rewriting ivars of aggregate type.
llvm-svn: 151662
2012-02-28 22:45:07 +00:00
Anna Zaks 75de32322a [analyzer] Leaks should be uniqued by the allocation point in the
closest function context (RetainCountChecker).

llvm-svn: 151661
2012-02-28 22:39:22 +00:00
Eli Friedman 8754926feb Prefer bitcast+GEP over ptrtoint+sub+inttoptr: it's semantically equivalent here, and generally nicer to the optimizer.
llvm-svn: 151659
2012-02-28 22:07:56 +00:00
Anna Zaks 16f3831064 [analyzer] Retain release: drop the line number info from the leak
message.

llvm-svn: 151657
2012-02-28 21:49:08 +00:00
Anna Zaks b6e2854f68 [analyzer] Stats: Add the stats about remove dead bindings, correct the
test.

llvm-svn: 151656
2012-02-28 21:49:04 +00:00
Chad Rosier 2ad368fce3 [driver] Add support for -g2 and -ggdb debug flags.
rdar://10947759

llvm-svn: 151654
2012-02-28 20:49:04 +00:00
David Chisnall c73fb894af Add -lm by default on Solaris.
llvm-svn: 151653
2012-02-28 20:06:45 +00:00
David Chisnall e0a7c28627 It turns out -fno-cxa-atexit just produces broken code, so disable it on Solaris and we'll ship a __cxa_atexit implementation...
llvm-svn: 151648
2012-02-28 19:15:06 +00:00
James Molloy ecd2edf50c Un-break clang based on r151638 - What was meant to be a trivial variable name change went horribly wrong and I forgot to retest afterwards.
llvm-svn: 151641
2012-02-28 18:23:49 +00:00
James Molloy 051390fffa Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
  return 0;
}

This finally fixes PR5464 and PR5477.

llvm-svn: 151638
2012-02-28 18:12:11 +00:00
Argyrios Kyrtzidis 3460880674 [AST] When we @synthesize a property with a user-defined ivar name,
make sure to record the source location of the ivar name.
[libclang] When indexing @synthesized objc methods, report the @implementation
as the lexical container.

Fixes rdar://10905472

llvm-svn: 151635
2012-02-28 17:50:39 +00:00
Argyrios Kyrtzidis 93db2923da [libclang] When indexing an objc property, also provide information about
the getter/setter objc method entities that the property is associated with.

rdar://10244558

llvm-svn: 151634
2012-02-28 17:50:33 +00:00
Argyrios Kyrtzidis ceeb19cf18 [AST] Associate the getter/setter methods to a property of a objc class extension.
[libclang] Index the getter/setter methods of a property of a objc class extension.

Fixes rdar://10907597

llvm-svn: 151633
2012-02-28 17:50:28 +00:00
David Chisnall 0c52c0f0fd Some more Solaris fixes. Now successfully building libc++ on Solaris with clang (and linking clang against it).
llvm-svn: 151632
2012-02-28 17:10:04 +00:00
Daniel Dunbar f3d3b0134d Remove stray semi-colons.
llvm-svn: 151631
2012-02-28 15:36:15 +00:00
Eli Friedman 7dff8a68df Basic coverage test for conversion-to-block-pointer for lambda expressions.
llvm-svn: 151616
2012-02-28 03:32:48 +00:00
Anna Zaks 6ca4fd5b88 [analyzer] Leaks should be uniqued by the allocation point in the
closest function context (Keychain API).

llvm-svn: 151613
2012-02-28 03:07:06 +00:00
Anna Zaks 06a77fc1b9 [analyzer] Fix Malloc False Positive (PR 12100)
When allocated buffer is passed to CF/NS..NoCopy functions, the
ownership is transfered unless the deallocator argument is set to
'kCFAllocatorNull'.

llvm-svn: 151608
2012-02-28 01:54:22 +00:00
Eli Friedman ec75fec805 Implement IRGen for the retain-autorelease in the lambda conversion-to-block-pointer outside of ARC. Testcases coming up soon.
llvm-svn: 151603
2012-02-28 01:08:45 +00:00
Ted Kremenek 3bc5372fae [analyzer] teach analyzer about ObjC literals, thus trimming out a false positive with the malloc() checker involving
comparing literal addresses to nil.

Fixes <rdar://problem/10579586>

llvm-svn: 151602
2012-02-28 00:56:05 +00:00
Jim Grosbach 2e16624291 Re-enable the Darwin ARM integrated assembler.
All known nightly-test failures are fixed.

llvm-svn: 151595
2012-02-27 23:55:25 +00:00
Anna Zaks 43ffba2676 [analyzer] Leaks should be uniqued by the allocation point in the
closest function context. 

This prevents us from uniqueing all leaks from the same allocation
helper. radar://10932226

llvm-svn: 151592
2012-02-27 23:40:55 +00:00
Richard Trieu 9cd797aa3e Fix a test case that was added in r151570. The redirect of output was broken
so no testing was actually done.  Further, the commands produce no output.
The redirection has been fixed and the test has been disabled.

llvm-svn: 151591
2012-02-27 23:40:41 +00:00
Ted Kremenek e0bce93e14 [analyzer] Don't generate an explicit ExplodedNode for StringLiterals; have the SVal lazily generated from Environment::getSVal().
llvm-svn: 151589
2012-02-27 23:34:19 +00:00
Sebastian Redl a235e2d8ad Hack in a loud error for PR12086. Better than a silent miscompile.
llvm-svn: 151586
2012-02-27 23:20:01 +00:00
Argyrios Kyrtzidis 465e137558 When evaluating integer expressions include a check for sub-expressions
depth and error if we exceed a max value, to make sure we avoid a stack overflow.

This is a hacky temporary fix. rdar://10913206.

llvm-svn: 151585
2012-02-27 23:18:37 +00:00
Ted Kremenek 59b10db2bc After numerous requests, have Objective-C 'method declared here' notes mention the actual method. This looks better within an IDE, where text isn't always regurgitated in the presentation of a warning. Fixes radar 10914035.
llvm-svn: 151579
2012-02-27 22:55:11 +00:00
Sebastian Redl aa6feaa7ea Implement a FIXME for conversion sequence distinction. Should fix PR12092.
llvm-svn: 151577
2012-02-27 22:38:26 +00:00
Ted Kremenek 205fbeb54a Fix documentation typo.
llvm-svn: 151573
2012-02-27 21:40:10 +00:00
Anna Zaks b028654031 [analyzer] Add -analyzer-stats, which hooks up LLVM stats tracking.
As in http://llvm.org/docs/ProgrammersManual.html#Statistic

llvm-svn: 151570
2012-02-27 21:33:16 +00:00
Eli Friedman 84e6e5cd1a Fix a couple bugs in the way we handle array indexes in array bounds checking. Specifically, make sure we don't ignore explicit casts in indexes, and make sure we use unsigned extension/comparisons on indexes. Fixes <rdar://problem/10916006>.
llvm-svn: 151569
2012-02-27 21:21:40 +00:00
Argyrios Kyrtzidis bb5abc7b49 Move "clang/Analysis/Support/SaveAndRestore.h" to "llvm/ADT/SaveAndRestore.h"
to make it more widely available.

Depends on llvm commit r151564

llvm-svn: 151566
2012-02-27 21:09:45 +00:00
Sebastian Redl 6776673f09 Convert initializer lists to temporaries in CreateBuiltinBinOp. Allows assignment of init lists to built-in types and resolves PR12088.
llvm-svn: 151551
2012-02-27 20:34:02 +00:00
Eli Friedman afa84ae85b Add missing code for compound literals of complex type. <rdar://problem/10938628>
llvm-svn: 151549
2012-02-27 20:26:13 +00:00
Argyrios Kyrtzidis 91d0098dc8 Revert testing code I committed by mistake in r151464.
llvm-svn: 151548
2012-02-27 20:21:34 +00:00
Benjamin Kramer 5e8636f36e Just drop the bitfield from ExtProtoInfo, this struct isn't even heap allocated so it doesn't hurt.
MSVC < 10 still has the signed enum bitfield bug, making the top bit unusable.

llvm-svn: 151545
2012-02-27 20:04:30 +00:00
Richard Smith fb09968e60 Speculatively attempt to work around a hypothetical but unreproduced MSVC issue
in r151494.

llvm-svn: 151544
2012-02-27 19:56:34 +00:00
Chad Rosier d6a56db7b6 Test case for r151429/r151430, which ensures llvm.lifetime intrinsics are not
being emitted at -O0, but are emitted when optimizations are enabled.

llvm-svn: 151533
2012-02-27 18:45:03 +00:00
Benjamin Kramer 169f436870 Serialize InitListExpr's initializesStdInitializerList bit, so it's not left uninitialized.
Found by valgrind.

llvm-svn: 151527
2012-02-27 13:20:39 +00:00
Eric Christopher 7a5fdd8746 ObjcInterfaceTypes are also complete types for the type cache.
Fixes rdar://10934887

llvm-svn: 151519
2012-02-27 08:23:23 +00:00
Eric Christopher 5bd52c1b3e Make this test a bit more robust for debug info changes.
llvm-svn: 151518
2012-02-27 08:22:57 +00:00
Richard Smith 619ecdc80f Ensure that we delete default constructors in the right cases. Don't delete the
default constructor of a union if it has a const member with no user-provided
default constructor.

llvm-svn: 151516
2012-02-27 06:07:25 +00:00
Richard Smith fa933d1225 Fix decltype crash-on-invalid, if we don't find a matching ')' for an ill-formed
decltype expression.

llvm-svn: 151515
2012-02-27 05:24:00 +00:00
Richard Smith 2fbb3d84a2 Tests for r151508.
llvm-svn: 151509
2012-02-26 23:49:01 +00:00
Richard Smith 9a6403a9de Half of PR12088: parse braced-init-lists on the RHS of assignment operators.
If the assignment operator is a scalar type, we continue to incorrectly reject
the initializer, but semantic analysis (and codegen) is correct for overloaded
operators.

llvm-svn: 151508
2012-02-26 23:40:27 +00:00
Gregory Szorc 5b4173912f [clang.py] Test Cursor.__ne__
llvm-svn: 151504
2012-02-26 21:56:32 +00:00
Benjamin Kramer b73f76b642 Reorder members to save padding.
There's more potential here, but these Exprs aren't used that often so I don't feel like doing heroic bit packing right now.

-8 bytes on every class changed (x86_64).

llvm-svn: 151501
2012-02-26 20:37:14 +00:00
Benjamin Kramer 8d550863cb Move CharacterLiteral, FloatingLiteral and UnaryExprOrTypeTraitExpr flags over into Stmt.
Apply the inheritance-padding trick to FloatingLiteral.
Shrinks CharacterLiteral from 32 to 24 bytes and the other two from 40 to 32 bytes (x86_64).

llvm-svn: 151500
2012-02-26 19:47:25 +00:00
Benjamin Kramer 441607ddcb Make clever use of padding to shrink IntegerLiterals.
Inheritance allows us to use padding across classes.
40 -> 32 bytes on x86_64.

llvm-svn: 151499
2012-02-26 18:34:12 +00:00
Benjamin Kramer 74f011db76 Bit pack StringLiteral.
48 -> 40 bytes on x86_64.

llvm-svn: 151498
2012-02-26 18:34:07 +00:00
Benjamin Kramer 3f8e0ec333 Reduce padding in MemberExpr.
56 -> 48 bytes on x86_64.

llvm-svn: 151497
2012-02-26 18:34:02 +00:00
Benjamin Kramer 7e11d9c4c2 CompoundLiteralExpr: Pair a bool with a pointer.
48 -> 40 bytes on x86_64.

llvm-svn: 151496
2012-02-26 18:33:56 +00:00
Benjamin Kramer 14926606a4 Shuffle members of DesignatedInitExpr to avoid padding.
40 -> 32 bytes on x86_64.

llvm-svn: 151495
2012-02-26 17:31:32 +00:00
Benjamin Kramer 6864c519c2 Bit pack ExtProtoInfo.
llvm-svn: 151494
2012-02-26 16:55:55 +00:00
Benjamin Kramer e60db7b86a Move FullSourceLoc::dump into the .cpp file, the used attribute made us emit this into every TU that includes SourceLocation.h.
llvm-svn: 151493
2012-02-26 16:55:50 +00:00
Benjamin Kramer 6b2dc73d48 Okay, makes sense to change all the occurences to match clang.EXE.
llvm-svn: 151491
2012-02-26 14:55:10 +00:00
Benjamin Kramer 1c45c9c8b0 Allow any file extension for the clang binary in the linux-header-search test.
Turns out this can be .exe or .EXE, depending on the build system.

llvm-svn: 151490
2012-02-26 14:50:31 +00:00
Richard Smith 8e1c932ffb Don't assert when trying to diagnose why a class with a constructor template is
non-trivial.

llvm-svn: 151486
2012-02-26 10:50:32 +00:00
Chandler Carruth df8ae4b949 Add the critical crtbegin.o files necessary for any of the tests in
r151482 and r151484 to work. Sorry about the fallout...

llvm-svn: 151485
2012-02-26 10:46:17 +00:00
Chandler Carruth 2e9d731761 A follow-up to r151482 which added support for powerpc and powerpc64
Debian multiarch libraries, this should in theory add support for those
platform's header search rules. I don't have a system to check this
with, so review appreciated. I've added the corresponding tests
referring to the debian multiarch tree.

We are starting to have a relatively completely tested Linux platform
for header search and library search, with several interesting
peculiarities. We should point people at the debian_multiarch_tree when
suggesting new tests. Folks with Debian systems that can check this for
correctness, it would be much appreciated. The missing chunks I know of
are testing bi-arch peudo-cross-compiling toolchains betwen 32-bit and
64-bit variants of platforms, and the MIPS and ARM Debian toolchains.

llvm-svn: 151484
2012-02-26 09:21:43 +00:00
Richard Smith 921bd20ddd Ensure that we delete destructors in the right cases. Specifically:
- variant members with nontrivial destructors make the containing class's
   destructor deleted
 - check for a virtual destructor after checking for overridden methods in the
   base class(es)
 - check for an inaccessible operator delete for a class with a virtual
   destructor.

Do not try to call an anonymous union field's destructor from the destructor of
the containing class.

llvm-svn: 151483
2012-02-26 09:11:52 +00:00
Chandler Carruth af3c2090b4 Add support for PPC and PPC64 multiarch toolchains on Debain.
Patch from Michel Dänzer, sent our way via Jeremy Huddleston who added
64-bit support. I just added one other place where powerpc64-linux-gnu
was missing (we only had powerpc64-unknown-linux-gnu).

I've also added a tree to test out the debian multiarch stuff. I don't
use debian regularly, so I'm not certain this is entirely accurate. If
anyone wants to check it against a debian system and fix any
inaccuracies, fire away. This way at least folks can see how this is
*supposed* to be tested.

It'd be particularly good to get the Debian MIPS toolchains tested in
this way.

llvm-svn: 151482
2012-02-26 09:03:21 +00:00
Richard Smith 273c4e9d82 Make sure we don't try to produce a definition of an implicitly-deleted function
llvm-svn: 151478
2012-02-26 07:51:39 +00:00
Richard Smith 2dc867f4e3 Update release notes and language extensions pages to note that support for
generalized initializers is available.

llvm-svn: 151477
2012-02-26 07:09:21 +00:00
Richard Smith 0d1f3cb1b5 Special members which are defaulted or deleted on their first declaration are
trivial if the implicit declaration would be. Don't forget to set the Trivial
flag on the special member as well as on the class. It doesn't seem ideal that
we have two separate mechanisms for storing this information, but this patch
does not attempt to address that.

This leaves us in an interesting position where the has_trivial_X trait for a
class says 'yes' for a deleted but trivial X, but is_trivially_Xable says 'no'.
This seems to be what the standard requires.

llvm-svn: 151465
2012-02-26 00:31:33 +00:00
Argyrios Kyrtzidis 8d4677ad26 Revert r151460 as it is not enough to address the issue.
Original log:
When evaluating integer expressions handle logical operators outside
VisitBinaryOperator() to reduce stack pressure for source with huge number
of logical operators.

Fixes rdar://10913206.

llvm-svn: 151464
2012-02-25 23:21:37 +00:00
Sebastian Redl aeac3ff82a Richard Smith pointed out that there already is a proposal for init list mangling.
llvm-svn: 151462
2012-02-25 22:59:28 +00:00
Argyrios Kyrtzidis 70f9eb571e When evaluating integer expressions handle logical operators outside
VisitBinaryOperator() to reduce stack pressure for source with huge number
of logical operators.

Fixes rdar://10913206.

llvm-svn: 151460
2012-02-25 21:38:16 +00:00
Sebastian Redl d89c218a2b Initializer lists are now supported.
llvm-svn: 151458
2012-02-25 20:51:27 +00:00
Sebastian Redl 4a7eab2545 CodeGen support for global variables of type std::initializer_list<X>.
This emits a backing array with internal linkage and fills it with data,
then has the initializer_list point at the array. Dynamic initialization
and global destructors are correctly supported.

What doesn't work is nested initializer_lists. I have no idea how to
get them to work, either. However, these should be very rare, and so
I'll just call it a known bug and declare generalized initializers
DONE!

llvm-svn: 151457
2012-02-25 20:51:20 +00:00
Sebastian Redl f2e0a3077c Fix crashers on unexpected std::initializer_list layouts. Found by inspection.
llvm-svn: 151456
2012-02-25 20:51:13 +00:00
Sebastian Redl dadc06494d Better mangling for new-expressions. Also, although we can't mangle arbitrary initializer lists yet (we will need this), turn the crash into a controlled error.
llvm-svn: 151455
2012-02-25 20:51:07 +00:00
Chad Rosier 4c5c8ccf40 Temporarily revert r151288:
ARM: enable the integrated assembler by default for Darwin. 

llvm-svn: 151454
2012-02-25 20:32:43 +00:00
NAKAMURA Takumi a3534f5c9a CMake: install libclang.dll to $CMAKE_INSTALL_PREFIX/bin.
Patch by Joe Groff.

llvm-svn: 151448
2012-02-25 16:46:50 +00:00
Ahmed Charles b24b9aa298 ArrayRef'ize various functions in the AST/Parser/Sema.
llvm-svn: 151447
2012-02-25 11:00:22 +00:00
Richard Smith 2cca7b5ca9 Accept __has_feature(__feature__) as a synonym for __has_feature(feature) (and
likewise for __has_extension). Patch by Jonathan Sauer!

llvm-svn: 151445
2012-02-25 10:41:10 +00:00
Richard Smith 2a986117e9 Fix r151443 to only apply C++11's exception for non-static data member access
in cases where we would otherwise disallow the access, and add a -Wc++98-compat
diagnostic for this C++11 feature.

llvm-svn: 151444
2012-02-25 10:20:59 +00:00
Richard Smith eae99680e3 PR11956: C++11's special exception for accessing non-static data members from
unevaluated operands applies within member functions, too.

llvm-svn: 151443
2012-02-25 10:04:07 +00:00
Richard Smith 978cc7306c Fix assertion (too few Diag arguments) when diagnosing a deleted operator delete
llvm-svn: 151442
2012-02-25 09:42:26 +00:00
Richard Smith 561fb15801 Teach CXXRecordDecl::hasIrrelevantDestructor to check the base classes and
data members for deleted or user-provided destructors.

Now it's computed in advance, serialize it, and in passing fix all the other
record DefinitionData flags whose serialization was missing.

llvm-svn: 151441
2012-02-25 07:33:38 +00:00
Richard Smith e06a2c1893 Fix a regression from r151117: ADL requires that we attempt to complete any
associated classes, since it can find friend functions declared within them,
but overload resolution does not otherwise require argument types to be
complete.

llvm-svn: 151434
2012-02-25 06:24:24 +00:00
Chad Rosier e2c4506979 Prevent llvm.lifetime intrinsics from being emitted at -O0.
rdar://10921594

llvm-svn: 151430
2012-02-25 02:56:13 +00:00
Eli Friedman 2495ab08fc Work-in-progress for lambda conversion-to-block operator. Still need to implement the retain+autorelease outside of ARC, and there's a bug that causes the generated code to crash in ARC (which I think is unrelated to my code, although I'm not completely sure).
llvm-svn: 151428
2012-02-25 02:48:22 +00:00
Argyrios Kyrtzidis 335c5a42e9 Don't record nested macro expansions in the preprocessing record,
it can only bring pain when dealing with preprocessor abuse (see: boost).

rdar://10898986

llvm-svn: 151427
2012-02-25 02:41:16 +00:00
Ted Kremenek ef31f376bb RetainCountChecker: don't adjust the retain count when analyzing a ReturnStmt unless we are in the top-level call frame. We can do more later, but this makes the checker self-consistent (and fixes a crash).
llvm-svn: 151426
2012-02-25 02:09:09 +00:00
Argyrios Kyrtzidis 01c047e003 [arcmt] GC migrator: don't try to remove redundant __strong, it does
more harm than good.

Fixes rdar://10522805&10521433

llvm-svn: 151424
2012-02-25 01:57:42 +00:00
Eli Friedman 8a78a58188 Improve the diagnostic in ARC mode when a conditional with an Objective-C type and void* is used. <rdar://problem/10486347>.
llvm-svn: 151416
2012-02-25 00:23:44 +00:00
Douglas Gregor 4a71b12a4e Trying to increase my Ohloh ranking with trivial tweaks
llvm-svn: 151414
2012-02-25 00:16:17 +00:00
DeLesley Hutchins 5b330db270 Bugfix: bogus warning -- "invalid use of non-static data member",
when a class is forward declared, and the reference to the data
member in question does not occur within a method body.

llvm-svn: 151413
2012-02-25 00:11:55 +00:00
Douglas Gregor 78e72f08ec Simplify check per Eli's comment
llvm-svn: 151412
2012-02-25 00:06:47 +00:00
Douglas Gregor f8ab049f17 Add test for C++ DR899.
llvm-svn: 151411
2012-02-24 23:57:42 +00:00
Anna Zaks 7ac344a48a [analyzer] Malloc: reason about the ObjC messages and C++.
Assume none of the ObjC messages defined in system headers free memory,
except for the ones containing 'freeWhenDone' selector. Currently, just
assume that the region escapes to the messages with 'freeWhenDone'
(ideally, we want to treat it as 'free()').

For now, always assume that regions escape when passed to C++ methods.

llvm-svn: 151410
2012-02-24 23:56:53 +00:00
Douglas Gregor 6073dcab38 Implement C++11 [over.match.copy]p1b2, which allows the use of
explicit conversion functions to initialize the argument to a
copy/move constructor that itself is the subject of direct
initialization. Since we don't have that much context in overload
resolution, we end up threading more flags :(.

Fixes <rdar://problem/10903741> / PR10456. 

llvm-svn: 151409
2012-02-24 23:56:31 +00:00
Eli Friedman cb3785e450 Fix a stupid mistake in r151133. Reported to me by Joerg Sonnenberger.
llvm-svn: 151407
2012-02-24 23:53:49 +00:00
Richard Smith 5e1148e31d Remove FIXME: as Eli points out, the behavior here is now correct.
llvm-svn: 151405
2012-02-24 23:21:24 +00:00
Douglas Gregor 4f283c8b20 For the purposes of building LLVM types, a forward-declared
enumeration type with a fixed underlying type is complete. Fixes
<rdar://problem/10916155>.

llvm-svn: 151403
2012-02-24 22:40:36 +00:00
Richard Smith 324df5564e Back out __decltype warning from r151377: we should either warn on all the GNU
__keywords or none of them.

llvm-svn: 151401
2012-02-24 22:30:04 +00:00
Benjamin Kramer 5f640e35e3 Make helper static.
llvm-svn: 151400
2012-02-24 22:19:42 +00:00
Richard Smith 6365c9138e When checking whether a reference to a variable is an ICE, look at the type of
the declaration, not at the type of the DeclRefExpr, since within a lambda the
DeclRefExpr can be more const than the declaration is.

llvm-svn: 151399
2012-02-24 22:12:32 +00:00
Fariborz Jahanian 0ed6cb75a7 Minor modern rewriter bug showed up during testing
against a large project.

llvm-svn: 151395
2012-02-24 21:42:38 +00:00
Douglas Gregor 232ee49c7b C++11 [class.ctor]p5 says that
A defaulted default constructor for a class X is defined as deleted if [...]
    -  X is a union and all of its variant members are of const-qualified type.

A pedantic reading therefore says that

 union X { };

has a deleted default constructor, which is both silly and almost
certainly unintended. Pretend as if this this read

    - X is a union with one or more variant members, and all of its
      variant members are of const-qualified type. 

llvm-svn: 151394
2012-02-24 21:25:53 +00:00
Dmitri Gribenko 85e8764254 Fix comment: correct predicate name, reformat comment.
llvm-svn: 151389
2012-02-24 20:03:35 +00:00
Argyrios Kyrtzidis e1bc99e1ff Change the text of a FIXME.
llvm-svn: 151387
2012-02-24 19:45:46 +00:00
Argyrios Kyrtzidis f0fc594be5 [libclang] Add a triple to the test.
llvm-svn: 151386
2012-02-24 19:45:42 +00:00
Richard Smith 18743deb21 cxx_status: Consistently refer to C++11 as "C++11", not as "C++'11" nor as
"C++0x". Use "C++98" to refer to C++98, not "C++". Add heading for C++98
support section.

llvm-svn: 151381
2012-02-24 18:42:08 +00:00
Richard Smith 4e8376279d cxx_status: extended sizeof has been essentially complete for some time. As
agreed on IRC, any remaining issues are best dealt with as bugs.

We have no __has_feature check for this; please shout if you'd like one. This
feature seems too small to be worth its own release notes bullet (again, please
shout if you disagree).

llvm-svn: 151380
2012-02-24 18:37:14 +00:00
Fariborz Jahanian 7e75de84bd test for writing modern ivar of struct type.
llvm-svn: 151378
2012-02-24 18:17:50 +00:00
Richard Smith fd3da9358f __decltype is a GNU extension, not a C++11 extension.
llvm-svn: 151377
2012-02-24 18:10:23 +00:00
Fariborz Jahanian 5e6842bfea more objective-c modern translator ivar tests.
llvm-svn: 151376
2012-02-24 18:03:42 +00:00
Douglas Gregor 3a08c1cd3b Two minor, related fixes for template instantiation with blocks:
- Make sure that the block expression is instantiation-dependent if the
    block is in a dependent context
  - Make sure that the C++ 'this' expression gets captured even if we
  don't rebuild the AST node during template instantiation. This would
  also have manifested as a bug for lambdas.

Fixes <rdar://problem/10832617>.

llvm-svn: 151372
2012-02-24 17:41:38 +00:00
Fariborz Jahanian dd5a59baed objc modern translator. Fixes writing of block pointer ivar access.
llvm-svn: 151371
2012-02-24 17:35:35 +00:00
Anna Zaks 18de54b1a6 [analyzer] Run remove dead bindings before each call.
This ensures that we report the bugs associated with symbols going
out of scope in the correct function context.

llvm-svn: 151369
2012-02-24 16:49:46 +00:00
Anna Zaks cdf24a9a5e [analyzer] We were silently stopping exploring the path after
visiting 'return;' statement!

This most likely caused us to skip a bunch of code when analyzing with
inlining.

llvm-svn: 151368
2012-02-24 16:49:41 +00:00
Rafael Espindola 1a16f49858 Use -no-integrated-as only on ARM. The X86 and X86-64 integrated as have been
the default for clang for some time now and can handle compiler-rt.

llvm-svn: 151367
2012-02-24 16:22:39 +00:00
Nick Lewycky 4ed840421d Revert r151357. That unreachable is reachable...
llvm-svn: 151359
2012-02-24 09:07:53 +00:00
Nick Lewycky e51b944fd7 Silence gcc warnings pointing out that CharByteWidth could be used
uninitialized. While there, restyle this function! No functionality change.

llvm-svn: 151357
2012-02-24 08:58:14 +00:00
Matt Beaumont-Gay 47ff1221b1 Sink variable into assert
llvm-svn: 151356
2012-02-24 08:37:56 +00:00
Douglas Gregor 093d4be550 Remove some trivial uses of hasTrivialCopyConstructor() and
hasTrivialMoveConstructor().

llvm-svn: 151354
2012-02-24 07:55:51 +00:00
Douglas Gregor f704aded6b Kill a spurious use of hasTrivialDefaultConstructor()
llvm-svn: 151353
2012-02-24 07:48:37 +00:00
Douglas Gregor 29c42f2a25 Implement a new type trait __is_trivially_constructible(T, Args...)
that provides the behavior of the C++11 library trait
std::is_trivially_constructible<T, Args...>, which can't be
implemented purely as a library.

Since __is_trivially_constructible can have zero or more arguments, I
needed to add Yet Another Type Trait Expression Class, this one
handling arbitrary arguments. The next step will be to migrate
UnaryTypeTrait and BinaryTypeTrait over to this new, more general
TypeTrait class.

Fixes the Clang side of <rdar://problem/10895483> / PR12038.

llvm-svn: 151352
2012-02-24 07:38:34 +00:00
Ted Kremenek 1bf3b04726 Make PathDiagnosticBuilder sensitive to varying LocationContexts, thus fixing a bug in the inlining diagnostics where the wrong location could be used.
llvm-svn: 151349
2012-02-24 07:12:52 +00:00
Ted Kremenek 29cebb377d Remove stray path in test file.
llvm-svn: 151347
2012-02-24 06:01:01 +00:00
Ted Kremenek 60a7820ffe Reapply r151317, but when computing the PathDiagnostic profile and size keep into account the nested structure. Also fix a problem with how
inlining impacted Plist diagnostics, and adjust some ranges in the Plist output due to richer information.

llvm-svn: 151346
2012-02-24 06:00:00 +00:00
David Blaikie b260a2ea2a Fix test for non-block-default platforms.
llvm-svn: 151343
2012-02-24 04:20:32 +00:00
Chad Rosier c0ea158a2b Revert r151317 - Rework PathDiagnostics creation.. - to appease buildbots.
llvm-svn: 151338
2012-02-24 02:06:33 +00:00
Argyrios Kyrtzidis ffe055a86f [PCH] When keeping track of top-level decls for "targeted deserialization"
make sure we don't mistake ParmVarDecls for top-level decls.

Fixes rdar://10920009.

llvm-svn: 151330
2012-02-24 01:12:38 +00:00
Ted Kremenek f2131e7d95 Rework PathDiagnostic creation so that call stacks are captured by a nested PathDiagnosticCallPiece.
llvm-svn: 151317
2012-02-24 00:38:56 +00:00
Fariborz Jahanian eee9bca03d Add an ivar test for modern objc abi translator.
llvm-svn: 151316
2012-02-24 00:34:58 +00:00
Fariborz Jahanian 77a9255329 Make test works with FileCheck.
llvm-svn: 151314
2012-02-24 00:29:20 +00:00
Chad Rosier f62290a19b Reapply r151172 - Unwind path cleanup for array new list initializers - with a
test case that only runs on debug builds.

llvm-svn: 151311
2012-02-24 00:13:55 +00:00
Eli Friedman ec52f92db3 Handle "#pragma GCC visibility" in a few more places. Switch over "#pragma pack" to use the same handling that gcc does. Fixes <rdar://problem/10871094> and <rdar://problem/10893316>.
(Hopefully, common usage of these pragmas isn't irregular enough to break our current handling.  Doug has ideas for a more crazy approach if necessary.)

llvm-svn: 151307
2012-02-23 23:47:16 +00:00
Eli Friedman 8195ad7b87 Modernize some code which processes CastExprs to use CastKinds. No intended functional change.
llvm-svn: 151298
2012-02-23 23:04:32 +00:00
Anna Zaks 4b062cb904 [analyzer] KeyChainAPI: unique the leaks by allocation site.
(Very similar to the previous change in malloc.)

llvm-svn: 151297
2012-02-23 22:53:29 +00:00
Fariborz Jahanian 86f8266b9f objective-c++: Type of an objc string literal is NSString, not 'id'.
// rdar://10907410

llvm-svn: 151296
2012-02-23 22:51:36 +00:00
Aaron Ballman 0c84ebb539 Turned on support for __declspecs: noreturn, noinline, nothrow and naked in MS compatibility mode.
llvm-svn: 151295
2012-02-23 22:46:33 +00:00
Douglas Gregor 2d5aea0f25 Pull the OpaqueValueExpr's source expression into its constructor, so
that we can correctly compute value-dependence of the OVE.

llvm-svn: 151291
2012-02-23 22:17:26 +00:00
Jim Grosbach ce398aa03b Update test for r151288
llvm-svn: 151290
2012-02-23 22:12:53 +00:00
Jim Grosbach 1d43ca99e2 ARM: enable the integrated assembler by default for Darwin.
llvm-svn: 151288
2012-02-23 21:55:04 +00:00
Anna Zaks df901a4419 [analyzer] Malloc: unique leak reports by allocation site.
When we find two leak reports with the same allocation site, report only
one of them.

Provide a helper method to BugReporter to facilitate this.

llvm-svn: 151287
2012-02-23 21:38:21 +00:00
Anna Zaks fa31b8ef10 [analyzer] Add CString checks to the release notes.
llvm-svn: 151286
2012-02-23 21:38:14 +00:00
Argyrios Kyrtzidis 2e85c5f297 [libclang] Make sure that all top-level decls in a @implementation are
marked as such.

Previously we missed tag declarations; fixes rdar://10902015

llvm-svn: 151283
2012-02-23 21:11:20 +00:00
Fariborz Jahanian e5d9b0b8c8 Test is fixed.
llvm-svn: 151280
2012-02-23 20:43:56 +00:00
Fariborz Jahanian 1e2303379d XFAIL test until I figure out how to make test pass on different platforms.
llvm-svn: 151277
2012-02-23 20:22:21 +00:00
Howard Hinnant ebab2b0660 * tgmath_logb.patch implements the missing logb function (see C99 standard 7.22, paragraph 5). * tgmath_fabs_complex.patch corrects the return types for the complex fabs functions. These must be non-complex float/double/long double (see C99 standard 7.22, paragraph 4 and 7.3.8.1). Patch contributed by Kristof Beyls.
llvm-svn: 151276
2012-02-23 20:22:10 +00:00
Fariborz Jahanian 7cef65a3b6 Change test again so it passes in build-bot until I can figure out what is
going on.

llvm-svn: 151275
2012-02-23 20:07:38 +00:00