Commit Graph

31729 Commits

Author SHA1 Message Date
Richard Trieu aee9e76722 The current warning in -Wnull-arithmetic for comparisons between NULL and non-pointers is not very helpful. This patch will update the wording to be more helpful to users.
Old warning:

warning: use of NULL in arithmetic operation [-Wnull-arithmetic]
  return 10 <= NULL;
            ^  ~~~~

New warning:

warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
  return 10 <= NULL;
         ~~ ^  ~~~~
llvm-svn: 137377
2011-08-11 22:38:21 +00:00
Douglas Gregor aa8a827f08 When initializing a context from a particular AST file, check whether
either "special" type has already been initialized. Previously, we did
this check based on just the first special type (__builtin_va_list),
but now we have some NULL special type entries to content with.

llvm-svn: 137373
2011-08-11 22:18:49 +00:00
Ted Kremenek 228b5fefbb Add diagtool-based test where we enforce that no additional warnings can be added to Clang without a -W flag.
llvm-svn: 137369
2011-08-11 22:06:55 +00:00
Douglas Gregor 09c4aa8177 The AST reader and writer don't need accessors for poking at the predefined Objective-C types
llvm-svn: 137366
2011-08-11 22:04:35 +00:00
Douglas Gregor 9767347b11 Encapsulate the Objective-C id/Class/SEL "redefinition" types in
ASTContext with accessors/mutators. The only functional change is that
the AST writer won't bother writing the id/Class/SEL redefinition type
if it hasn't been explicitly set; previously, it ended up being
written as a synonym for the built-in id/Class/SEL.

llvm-svn: 137349
2011-08-11 20:58:55 +00:00
Sean Callanan da6df8a186 Extended the AST importer to support ParenTypes.
This is necessary to support importing certain
function pointer types.

llvm-svn: 137311
2011-08-11 16:56:07 +00:00
Anna Zaks 22a9d0f316 Analyzer Core: Adding support for user-defined symbol dependencies. (For example, the allocated resource symbol only needs to be freed if no error has been returned by the allocator, so a checker might want to make the lifespan of the error code symbol depend on the allocated resource symbol.) Note, by default, the map that holds the dependencies will get destroyed along with the SymbolManager at the end of function exploration.
llvm-svn: 137309
2011-08-11 16:43:28 +00:00
Craig Topper 6d64a738fa Add tests for string literal concatenation.
llvm-svn: 137302
2011-08-11 05:57:09 +00:00
Craig Topper 5265bb211d Raw string followup. Pass a couple StringRefs by value.
llvm-svn: 137301
2011-08-11 05:10:55 +00:00
Craig Topper 93b3e848de Update C++0x status page to reflect support for raw string literals.
llvm-svn: 137299
2011-08-11 04:09:26 +00:00
Craig Topper 54edccafc5 Add support for C++0x raw string literals.
llvm-svn: 137298
2011-08-11 04:06:15 +00:00
John McCall 8e4c74bb7c Simplify EH control flow by observing that EH scopes form a simple
hierarchy of delegation, and that EH selector values are meaningful
function-wide (good thing, too, or inlining wouldn't work).
2,3d
1a
hierarchy of delegation and that EH selector values have the same
meaning everywhere in the function instead of being meaningful only
in the context of a specific selector.

This removes the need for routing edges through EH cleanups,
since a cleanup simply always branches to its enclosing scope.

llvm-svn: 137293
2011-08-11 02:22:43 +00:00
Anna Zaks e6d0c86297 Make SymbolManager comments doxygen friendly.
llvm-svn: 137290
2011-08-11 01:03:22 +00:00
Anna Zaks 173864b36c Cleanup: remove CleanedSate member and GetState() wrapper from StmtNodeBuilder, not needed as of r137273.
llvm-svn: 137284
2011-08-11 00:11:21 +00:00
Anna Zaks e309e05603 Cleanup: remove GetState() wrapper from ExprEngine, not needed as of r137273.
llvm-svn: 137279
2011-08-10 23:34:53 +00:00
Anna Zaks 5a56a6653f Analyzer Core: In checkDeadSymbols checker callback, provide the state in which the symbols are not yet deleted so that checkers could inspect them. Since we are now always creating a transition in ProcessStmt(), remove the logic for adding a transition when none was generated. TODO: the extra transitions will have to be removed; more cleanups; a checker that tests teh new fucntionality.
llvm-svn: 137273
2011-08-10 23:14:54 +00:00
Richard Trieu 73088053f5 Refactoring of DiagnoseBitwisePrecedence() in SemaExpr.cpp to reduce code duplication.
llvm-svn: 137259
2011-08-10 22:41:34 +00:00
Douglas Gregor de0a43f772 When performing the lookup in the current scope for a member access to
a member template, e.g.,

  x.f<int>

if we have found a template in the type of x, but the lookup in the
current scope is ambiguous, just ignore the lookup in the current
scope.  Fixes <rdar://problem/9915664>.

llvm-svn: 137255
2011-08-10 21:59:45 +00:00
Argyrios Kyrtzidis 93db2277e6 [arcmt] When checking whether properties needs to be strong or not, take into account
that assigning result of -retain means it should be strong. rdar://9931757.

llvm-svn: 137252
2011-08-10 21:46:48 +00:00
Argyrios Kyrtzidis 5431380dd4 [libclang] When pointing at an objc property don't return a cursor that points at the
synthesized method for the property. rdar://9771715

llvm-svn: 137248
2011-08-10 21:12:04 +00:00
Kaelyn Uhrain 3b74063a8c Add the new unit test that I managed to leave out of r136997 :/
llvm-svn: 137242
2011-08-10 19:49:27 +00:00
Kaelyn Uhrain 0fb0bb179a Add a test case for the divide-by-zero fix in r137234
llvm-svn: 137240
2011-08-10 19:47:25 +00:00
Kaelyn Uhrain e535376b14 Make sure ptrarith_typesize is at least 1 to avoid division by zero
llvm-svn: 137234
2011-08-10 18:49:28 +00:00
Richard Smith 111af8ddb9 Renamings to consistently use 'Constexpr' not 'ConstExpr' when referring to the C++0x 'constexpr' keyword.
llvm-svn: 137230
2011-08-10 18:11:37 +00:00
Fariborz Jahanian 3c12dd7675 objective-c: Using existing infrastructure for finding
overridden  methods to diagnose their type mismatch.
This is a general solution for previous fixes
for // rdar://6191214 and // rdar://9352731
and removes lots of duplicate code.

llvm-svn: 137222
2011-08-10 17:16:30 +00:00
Douglas Gregor 9996c8fe01 Expand test of C++0x [class.copymove]p15 to make sure we're actually calling the copy constructor of a base/member from an explicitly-defaulted copy constructor, rather than the default constructor
llvm-svn: 137220
2011-08-10 16:59:20 +00:00
Douglas Gregor 5c076db18e When adding the base and member initializers for an implicitly-defined
special member function, make sure to classify an explicitly-defaulted
copy constructor as a "copy" operation. Fixes PR10622.

llvm-svn: 137219
2011-08-10 16:51:53 +00:00
Douglas Gregor 349c403b46 Switch a C-style cast over to a const_cast. No functionality change
llvm-svn: 137218
2011-08-10 16:34:38 +00:00
Douglas Gregor 05a51ae0cf Update a comment to match the recently-changed code
llvm-svn: 137216
2011-08-10 16:09:55 +00:00
Douglas Gregor 6f47e5cabf For the availability attribute, allow a declaration to be deprecated
in the same version that it is introduced. Stuff happens.

llvm-svn: 137214
2011-08-10 15:31:35 +00:00
Douglas Gregor 493627ba8b Rewrite default initialization of anonymous structs/unions within a
constructor. Previously, we did some bogus recursion into the fields
of anonymous structs (recursively), which ended up building invalid
ASTs that would cause CodeGen to crash due to invalid GEPs.

Now, we instead build the default initializations based on the
indirect field declarations at the top level, which properly generates
the sequence of GEPs needed to initialize the proper member. Fixes
PR10512 and <rdar://problem/9924046>.

llvm-svn: 137212
2011-08-10 15:22:55 +00:00
John McCall 9a877fef91 Change an assert into a check. I'm pretty sure there was a point
in time when this assert was valid, but it's not valid now.
Also teach this code to correctly introduce function-to-pointer
decay.

llvm-svn: 137201
2011-08-10 04:12:23 +00:00
John McCall a3654e327b Formatting.
llvm-svn: 137200
2011-08-10 04:11:11 +00:00
Eli Friedman f5dfb31df0 Revert bad change. (It may look equivalent, but it isn't.)
llvm-svn: 137132
2011-08-09 18:16:09 +00:00
Caitlin Sadowski 4b1e8399c2 Thread Safety: Added basic argument parsing for all new attributes.
This patch special cases the parser for thread safety attributes so that all
attribute arguments are put in the argument list (instead of a special
parameter) since arguments may not otherwise resolve correctly without two-token
lookahead.

This patch also adds checks to make sure that attribute arguments are
lockable objects.

llvm-svn: 137130
2011-08-09 17:59:31 +00:00
Eli Friedman f481ccafd8 Cleanup; no functionality change.
llvm-svn: 137126
2011-08-09 17:38:12 +00:00
Douglas Gregor 636e200675 Move the creation of the record type for the state of Objective-C fast
enumerations from the ASTContext into CodeGen, so that we don't need
to serialize it to AST files. This appears to be the last of the
low-hanging fruit for SpecialTypes.

llvm-svn: 137124
2011-08-09 17:23:49 +00:00
Douglas Gregor 7874310ba1 Don't serialize the block descriptor or block extended descriptor
types to AST files; they're only used by debug info generation anyway,
and shouldn't ever exist in the AST anyway.

llvm-svn: 137122
2011-08-09 16:24:26 +00:00
Douglas Gregor abf4e0dfcd Move the construction of the RecordDecl representing the runtime
layout of a constant NSString from the ASTContext over to CodeGen,
since this is solely CodeGen's responsibility. Eliminates one of the
unnecessary "special" types that we serialize.

llvm-svn: 137121
2011-08-09 15:54:21 +00:00
Douglas Gregor eda8e12e86 Migrate the serialization of ASTContext's AutoDeduceTy and
AutoRRefDeductTy from the "special types" block to predefined
types. The latter behaves better when loading multiple AST files.

llvm-svn: 137120
2011-08-09 15:13:55 +00:00
Ted Kremenek 1b46951f9f Place back previous order of add_subdirectory()'s to reflect build depedencies.
llvm-svn: 137117
2011-08-09 14:55:12 +00:00
Ted Kremenek 5c8daf1ee1 Add libsupport to list of libraries to link into diagtool
llvm-svn: 137110
2011-08-09 03:41:03 +00:00
Ted Kremenek f88d335ca7 Add 'diagtool' to the 'tools/' directory. diagtool is a new tool (WIP) for analyzing and working with clang diagnostics.
Some interesting stats from 'diagtool list-warnings' on the current version of clang:

  Percentage of warnings with flags: 48.79%
  Number of unique flags: 148
  Average number of diagnostics per flag: 2.041

llvm-svn: 137109
2011-08-09 03:39:19 +00:00
Ted Kremenek 309e288e01 Provide diag_iterator for iterating over the built-in diagnostic IDs/names in the internal table of DiagnosticIDs.
llvm-svn: 137108
2011-08-09 03:39:14 +00:00
Ted Kremenek 454651adb5 Sort CMakeLists.txt.
llvm-svn: 137107
2011-08-09 03:39:10 +00:00
Douglas Gregor 3d63a9e501 Make sure to canonicalize the argument type of a non-type template
argument of enumeration type when checking template arguments. Fixes PR10579.

llvm-svn: 137101
2011-08-09 01:55:14 +00:00
Douglas Gregor 34f6c6db26 Hand materialization of temporary expressions when emitting a scalar
expression. Fxies PR10592.

llvm-svn: 137086
2011-08-09 00:37:14 +00:00
Fariborz Jahanian c1a151bed9 Don't emit memcpy for copying fields of arrays of volatile elements.
Use the the path that generates a loop. This fixes
bogus error that clang puts out. // rdar://9894548

llvm-svn: 137080
2011-08-09 00:26:11 +00:00
Chad Rosier 53ea71674c If no -miphoneos-version-min specified, see if we can set the default based on
-isysroot.
rdar://9837120

llvm-svn: 137075
2011-08-08 23:39:34 +00:00
Ted Kremenek a0cdf58b0c Fix another -Wuninitialized assertion failure (this one involving bit casts) resulting from the recent -Wuninitialized changes.
llvm-svn: 137068
2011-08-08 21:43:08 +00:00