Commit Graph

20725 Commits

Author SHA1 Message Date
Ted Kremenek 1ee27e6d9a Added 'AsWideChar' flag to LengthModifier.
llvm-svn: 96309
2010-02-16 01:46:47 +00:00
Douglas Gregor 4563532043 Skeleton for importing Objective-C classes
llvm-svn: 96306
2010-02-16 01:20:57 +00:00
Chris Lattner 1b78ea446f mark __builtin_longjmp noreturn, PR6312
llvm-svn: 96302
2010-02-16 00:23:21 +00:00
Douglas Gregor 9503c46a2e Don't import __va_list_tag or __builtin_va_list when merging
llvm-svn: 96299
2010-02-16 00:04:46 +00:00
Douglas Gregor b4964f7705 Cope with anonymous tags defined within declarators by structurally
comparing their types under the assumption that they are equivalent,
rather than importing the types and then checking for compatibility. A
few minor tweaks here:
  - Teach structural matching to handle compatibility between
  function types with prototypes and those without prototypes.
  - Teach structural matching that an incomplete record decl is the
  same as any other record decl with the same name.
  - Keep track of pairs of declarations that we have already checked
  (but failed to find as structurally matching), so we don't emit
  diagnostics repeatedly.
  - When importing a typedef of an anonymous tag, be sure to link the
  imported tag type to its typedef.

With these changes, we survive a repeated import of <stdlib.h> and
<stdio.h>. Alas, the ASTNodeImporter is getting a little grotty.

llvm-svn: 96298
2010-02-15 23:54:17 +00:00
Ted Kremenek d51217e968 Convert GRExprEngine's handling of ObjCMessageExprs to use a worklist
to evaluate arguments.

llvm-svn: 96293
2010-02-15 23:02:46 +00:00
Benjamin Kramer 634fc10fe1 Add Sema support for __builtin_fpclassify by extending the existing check for __builtin_isinf and friends. Part of PR6083.
llvm-svn: 96291
2010-02-15 22:42:31 +00:00
Fariborz Jahanian 8efe0ec899 Issue a bettter diagnostics for incorrect property setter name.
(radar 7647953).

llvm-svn: 96284
2010-02-15 22:20:11 +00:00
Chandler Carruth 3e0c140c50 Fix instantiation of template functions with local classes that contain virtual
methods.

llvm-svn: 96283
2010-02-15 22:12:26 +00:00
Douglas Gregor 522e22d352 Tell ASTMerge to merge every declaration it sees, rather than cherry-picking those declarations that we know will work.
llvm-svn: 96280
2010-02-15 22:05:17 +00:00
Douglas Gregor 3996e249ed Reimplement the structural-equality checks used to determine whether
two types in different AST contexts are equivalent. Rather than
transforming the type from one context into the other context, we
perform a deep structural comparison of the types. This change
addresses a serious problem with recursive data types like

  struct ListNode {
    int value;
    struct ListNode *Next;
  } xList;

llvm-svn: 96278
2010-02-15 22:01:00 +00:00
Fariborz Jahanian 30a42923d3 Class continuation now has its own property ast for
those declared in it. This is to allow duplicate
property diagnostics for properties declared in class extensions
multiple times (radar 7629420) and for future use.

llvm-svn: 96276
2010-02-15 21:55:26 +00:00
Fariborz Jahanian 06708cee8d Test to compile the rewritten file for my last patch.
(radar 7649577 related).

llvm-svn: 96274
2010-02-15 21:37:11 +00:00
Fariborz Jahanian 02d964babe Fix a broken rewritin of @implementation keyword.
(fixes radar 7649577).

llvm-svn: 96270
2010-02-15 21:11:41 +00:00
John McCall 5f5cbf5d1d Optimize the implementation of IdDeclInfo pooling in the IdentifierResolver.
llvm-svn: 96253
2010-02-15 19:38:00 +00:00
Devang Patel e8814ce0a6 Use getLocStart(), instead of getLocEnd(), to record starting location of objc method. :)
llvm-svn: 96245
2010-02-15 18:08:38 +00:00
Sanjiv Gupta 9d23f93d52 reverting back 96242 as it still causes a test failure.
llvm-svn: 96244
2010-02-15 18:02:12 +00:00
Sanjiv Gupta af56d377f1 Re-applying 96173 with corresponding changes in test.
llvm-svn: 96242
2010-02-15 17:19:13 +00:00
Duncan Sands 998f9d975b Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!

llvm-svn: 96224
2010-02-15 16:14:01 +00:00
Chandler Carruth 284bb2ec72 Defer covariance checks for dependent types. Add test cases that also ensure
they are re-checked on instantiation.

llvm-svn: 96217
2010-02-15 11:53:20 +00:00
Zhongxing Xu ec345b7ecb Simplify code. If we can reach here, the base must be virtual.
llvm-svn: 96211
2010-02-15 04:28:35 +00:00
John McCall 7538eec67b When emitting an aggregate into a temporary, make sure we set the alignment
on the alloca.

The fact that codegen makes this class of bug so wonderfully easy to make is
embarrassing.

llvm-svn: 96204
2010-02-15 01:23:36 +00:00
Ted Kremenek 4ba99bee2a clang::Attr objects should be treated as AST nodes as well by
the LLVMConventionsChecker.

llvm-svn: 96202
2010-02-14 22:58:16 +00:00
Ted Kremenek 4853131459 Add LLVM conventions check that scans for AST elements (types, stmts, decls)
that allocate heap memory.

llvm-svn: 96184
2010-02-14 19:09:13 +00:00
Ted Kremenek 988805c81e Change LLVMConventionsChecker to accept an entire translation unit instead
of operating on each code decl.  This exposes two flaws in AnalysisConsumer
that should eventually be fixed:

(1) It is not possible to associate multiple "actions" with a single
    command line argument.  This will require the notion of an
	"analysis" group, and possibly tablegen support.  (although eventually
    we want to support dynamically loading analyses as well)

(2) AnalysisConsumer may not actually be scanning the declarations in namespaces.
    We'll experiment first in LLVMConventionsChecker before changing the
    behavior in AnalysisConsumer.

llvm-svn: 96183
2010-02-14 19:09:05 +00:00
Ted Kremenek 39df94b00d Rework translation unit actions to actually take an entire translation unit
as imput.

llvm-svn: 96182
2010-02-14 19:08:51 +00:00
Ted Kremenek c968e5e9b9 For the StringRef check, also visit the children of DeclStmts.
llvm-svn: 96181
2010-02-14 19:08:43 +00:00
Ted Kremenek 4806a833a7 Place type-checking static methods at type of file (where they will congregate).
No functionality change.

llvm-svn: 96180
2010-02-14 19:08:36 +00:00
Chris Lattner d0413848cc temporarily revert 96173, it is causing test failures.
llvm-svn: 96176
2010-02-14 18:38:38 +00:00
Sanjiv Gupta 1ef8cdd29b renamed pic16 specifiic macros.
llvm-svn: 96173
2010-02-14 18:20:18 +00:00
Anders Carlsson 033d48697f Don't compute final overriders or build vtables for bases that don't need a vtable.
llvm-svn: 96171
2010-02-14 17:05:59 +00:00
Benjamin Kramer 88ab94e7a3 Pass StringRefs to InsertText/ReplaceText in RewriteObjC and remove a ton of unnecessary length arguments.
llvm-svn: 96164
2010-02-14 14:14:16 +00:00
Daniel Dunbar 02968e53cf CIndex: Switch CXSourceRange to proper half-open intervals.
- Doug, please review.

llvm-svn: 96162
2010-02-14 10:02:57 +00:00
Daniel Dunbar edeb9b87e6 CIndex: Avoid an unnecessary getLocForEndOfToken call, the region of interest
doesn't need to be a full token.
 - Doug, please review.

llvm-svn: 96161
2010-02-14 10:02:42 +00:00
Daniel Dunbar 6092d507f0 c-index-test: Unify and always print half-open extents.
llvm-svn: 96160
2010-02-14 08:32:51 +00:00
Daniel Dunbar eb27e7d999 c-index-test: Simplify file scanning code.
llvm-svn: 96159
2010-02-14 08:32:32 +00:00
Daniel Dunbar 98c07e0e23 c-index-test: Unify syntax for printing extents. Yes, there were 4.
llvm-svn: 96158
2010-02-14 08:32:24 +00:00
Daniel Dunbar 2049933196 CIndex: Simplify (remove provably dead code).
llvm-svn: 96157
2010-02-14 08:32:11 +00:00
Daniel Dunbar 2f4ba179f5 CIndex: Inline CompareRegionOfInterest(CXSourceRange) into sole caller.
llvm-svn: 96156
2010-02-14 08:32:05 +00:00
Daniel Dunbar 80daf53600 Rename translateSourceRange(CXSourceRange) translateCXSourceRange, instead of
having overloaded functions with inverse semantics.

llvm-svn: 96155
2010-02-14 08:31:57 +00:00
Zhongxing Xu be36ecbb60 Fix pr6293. If ptr is NULL, no operation is preformed.
llvm-svn: 96154
2010-02-14 06:49:48 +00:00
Ted Kremenek 184b3383bf Add new static analyzer for checking LLVM coding conventions: -analyzer-check-llvm-conventions
Currently these checks are intended to be largely syntactical, but may get more
sophisticated over time.

As an initial foray into this brave new world, emit a static analyzer warning
when binding a temporary 'std::string' to an 'llvm::StringRef' where the
lifetime of the 'std::string' does not outlive the 'llvm::StringRef'.

llvm-svn: 96147
2010-02-14 02:45:18 +00:00
Ted Kremenek eff72bb134 Two changes to AnalysisConsumer::HandleTopLevelSingleDecl():
(1) Since CXXMethodDecl subclasses FunctionDecl (and CXXDestructorDecl 
and CXXConversion subclass CXXMethodDecl), refactor switch statement 
to handle them all in one spot.

(2) Use 'DeclarationName::getAsString()' to handle all functions that
don't have simple identifiers (fixing a null dereference when scanning
for specific functions).

llvm-svn: 96146
2010-02-14 02:44:52 +00:00
Daniel Dunbar c4b4d3953c CIndex: Kill off CXSourceLocationPtr, and AtEnd arguments.
llvm-svn: 96145
2010-02-14 01:47:36 +00:00
Daniel Dunbar 474b207716 CIndex: Stop hiding magic end bit in CXSourceRange locations where clients can't
see it. Instead, translate the locations up-front when we create a
CXSourceRange.
 - This is part of a move to make CXSourceRange a pure half-open range, which is
   a more natural API for clients to deal with. More cleanups to follow.

llvm-svn: 96144
2010-02-14 01:47:29 +00:00
John McCall 38200b081a Improve the diagnostic given when referring to a tag type without a tag (in C)
or that's been hidden by a non-type (in C++).

The ideal C++ diagnostic here would note the hiding declaration, but this
is a good start.

llvm-svn: 96141
2010-02-14 01:03:10 +00:00
Anders Carlsson 073a0c88cc Build fix.
llvm-svn: 96140
2010-02-14 00:44:19 +00:00
Anders Carlsson 6a7e6a4c3c Baby steps towards teaching FinalOverriders about virtual bases.
llvm-svn: 96139
2010-02-14 00:37:35 +00:00
Anders Carlsson 1888b44988 Don't try to layout construction vtables for now.
llvm-svn: 96138
2010-02-14 00:22:59 +00:00
Anders Carlsson 258a1e35e8 Improve support for non-virtual 'this' pointer adjustments. With this, it should be possible to use the new vtable layout code for all class hierarchies that do not involve virtual bases.
llvm-svn: 96137
2010-02-14 00:16:19 +00:00
Anders Carlsson d3adb0ced9 Add basic support for simple non-virtual 'this' pointer adjustments.
llvm-svn: 96136
2010-02-13 23:40:17 +00:00
Anders Carlsson cce9ee8970 Add support for very simple non-virtual this adjustments in the FinalOverriders class.
llvm-svn: 96133
2010-02-13 23:17:31 +00:00
Anders Carlsson c809cbdc3f Cleanup; remove some duplicated code.
llvm-svn: 96131
2010-02-13 22:39:18 +00:00
Anders Carlsson a678aa1e51 Assert if we encounter this adjustments.
llvm-svn: 96125
2010-02-13 22:23:31 +00:00
Anders Carlsson e75aaa97b3 Start laying out secondary vtables.
llvm-svn: 96123
2010-02-13 22:05:23 +00:00
Anders Carlsson 3f9917de6e Merge base offsets and dump them.
llvm-svn: 96121
2010-02-13 21:33:22 +00:00
Anders Carlsson c1290adab7 Don't make return adjustments for pure virtual member functions.
llvm-svn: 96120
2010-02-13 21:16:54 +00:00
Anders Carlsson cf5a882da1 Handle virtual bases in return adjustment types.
llvm-svn: 96119
2010-02-13 21:07:32 +00:00
Anders Carlsson f3f67846c8 Handle virtual bases in ComputeBaseOffset.
llvm-svn: 96117
2010-02-13 20:41:15 +00:00
Daniel Dunbar 9ced542c8a Add newline.
llvm-svn: 96116
2010-02-13 20:24:39 +00:00
Anders Carlsson 6a6cbfc55f More work on covariant return types. We now handle non-virtual adjustments fine.
llvm-svn: 96114
2010-02-13 20:11:51 +00:00
Chris Lattner ef538b52a3 add support for t Fedora 12 (February 2010), patch by
Dyachenko Dmitry.  Our system is "not so elegant" here.

llvm-svn: 96111
2010-02-13 19:18:26 +00:00
Daniel Dunbar ae4b77d99d cindex/Python: Fix cindex-{dump,includes} examples to just pass all args
directly to Index, instead of requiring the input file to be first. This makes
the examples behave more like 'clang'.

For example,
  ddunbar@giles:tmp$ echo '#include <string>' | python ~/llvm/tools/clang/bindings/python/examples/cindex/cindex-includes.py -- -x c++ - | wc -l
     114
  ddunbar@giles:tmp$ echo '#include <stdio.h>' | python ~/llvm/tools/clang/bindings/python/examples/cindex/cindex-includes.py -- -x c - | wc -l
      10

llvm-svn: 96107
2010-02-13 18:33:28 +00:00
Daniel Dunbar 43813bf023 cindex/Python: Add TranslationUnit.get_includes, patch by Andrew Sutton!
llvm-svn: 96106
2010-02-13 18:33:18 +00:00
Daniel Dunbar 2037d4e4ea cindex/Python: Update for clang_getDiagnosticRange... API changes.
llvm-svn: 96105
2010-02-13 18:33:03 +00:00
Charles Davis 4ea31ab369 Emit the 'alignstack' LLVM function attribute when we encounter a function
marked 'force_align_arg_pointer'. Almost there; now all I need to do is finish
up the backend.

llvm-svn: 96100
2010-02-13 15:54:06 +00:00
Chandler Carruth a932bbca75 Fix think-o, attributes can't come *within* the type of the variable.
llvm-svn: 96099
2010-02-13 10:42:55 +00:00
Chandler Carruth 94eab4ad04 Silence unused variable warning in a build without assertions.
llvm-svn: 96098
2010-02-13 10:38:52 +00:00
Chandler Carruth 6b4756a224 Skip implicit instantiation of templated variables where a more recent
redeclaration provides an explicit instantiation or is invalid.

llvm-svn: 96097
2010-02-13 10:17:50 +00:00
Benjamin Kramer e047e11189 Remove dead {include, semicolon, variable}.
llvm-svn: 96087
2010-02-13 09:15:07 +00:00
Benjamin Kramer 02c673781d Use a different name for this iterator. MSVC and clang++ didn't like "I" in the same scope twice.
llvm-svn: 96086
2010-02-13 09:11:28 +00:00
Chandler Carruth dfe198b588 Silence a GCC warning about a possibly uninitialized variable. It's data flow
only flows so far it seems.

llvm-svn: 96085
2010-02-13 07:23:01 +00:00
Douglas Gregor 04922cbb46 Fix a fiendinshly fun little type-canonicalization bug, where we were
rebuilding a typename type terminating in a template-id (with
dependent template name, naturally) as a TypenameType when, because
its context could be fully resolved, we should have been building it
as a QualifiedNameType. Fixes PR6268.

llvm-svn: 96084
2010-02-13 06:05:33 +00:00
Douglas Gregor af050cb73a Permit the use of typedefs of class template specializations in
qualified declarator-ids. This patch is actually due to Cornelius;
fixes PR6179.

llvm-svn: 96082
2010-02-13 05:23:25 +00:00
John McCall bb79b5f6f3 Raise the responsibility for passing -disable-llvm-verifier in NDEBUG builds
to the driver, and support it in CodeGenOptsToArgs().  Note that this changes
the default behavior of clang -cc1 to always run the verifier.

llvm-svn: 96077
2010-02-13 03:50:24 +00:00
Anders Carlsson eee53d9c06 More work on return type adjustments in the new vtable builder.
llvm-svn: 96070
2010-02-13 02:02:03 +00:00
Ted Kremenek 1a6672a3d4 Enhance RegionStore::InvalidateRegions() to correctly invalidate bindings
by scanning through the values of LazyCompoundVals.

llvm-svn: 96067
2010-02-13 01:52:33 +00:00
John McCall ef3057c419 Switch the standard DeclarationName comparator to be a tri-valued comparator.
Use that while fixing a nasty misuse of qsort in vtable codegen which, somehow,
has not actually caused a crash.

llvm-svn: 96062
2010-02-13 01:04:05 +00:00
Ted Kremenek 7950b78430 Pull logic for visiting value bindings in InvalidateRegionsWorker into a separate method.
No functionality change.

llvm-svn: 96060
2010-02-13 00:54:03 +00:00
Eli Friedman d5c9399696 Fix for PR6274: teach constant folding to evaluate __builtin_expect.
llvm-svn: 96054
2010-02-13 00:10:10 +00:00
Eli Friedman 18c28f6cdc if-0 out printf.
llvm-svn: 96052
2010-02-13 00:03:21 +00:00
John McCall cfcb775b56 Add an option to disable the LLVM verifier pass (which is still always
disabled in NDEBUG builds).  The option applies only to -cc1 invocations and is:
  -disable_llvm_verifier

llvm-svn: 96046
2010-02-12 23:47:27 +00:00
Douglas Gregor 8cdbe64de4 Funnel changes to the ImportedDecls list in the ASTImporter through a
single Imported function, in preparation for fixing a serious design
flaw.

llvm-svn: 96044
2010-02-12 23:44:20 +00:00
Ted Kremenek 8bd0929d41 Fix bug I introduced with assinging a temporary to a StringRef.
llvm-svn: 96041
2010-02-12 23:31:14 +00:00
Ted Kremenek a3e657064b Make the following functions thread-safe but having them return an std::string that is reconstructed
every time they are called:

getClangRevision()
getClangFullRepositoryVersion()
getClangFullVersion()

llvm-svn: 96033
2010-02-12 22:54:40 +00:00
Douglas Gregor 98c1018337 Implement AST importing and merging for enumeration types and
enumerators, along with ImplicitCastExprs to make it work.

llvm-svn: 96024
2010-02-12 22:17:39 +00:00
Fariborz Jahanian 5ec502e35b Complain if block-literal expression's parameter name is
missing (in c/objc mode). Fixes radar 7528255.

llvm-svn: 96017
2010-02-12 21:53:14 +00:00
Ted Kremenek 8f8dcbaadd (1) Correctly format external Javascript link.
(2) Reformat "annotations" topics list to use a collapsable tree.

llvm-svn: 96013
2010-02-12 21:05:44 +00:00
Fariborz Jahanian e5c118f60d Don't error when setting a sub-structure variable via objc properties
in objective-c++ mode (do it for objective-c only).

llvm-svn: 96012
2010-02-12 21:02:28 +00:00
Chris Lattner 5647d3192c fix a bug in SourceManager::getInstantiationLocSlowCase, where
we'd add an offset from the spelling location space to the 
instantiation location, which doesn't make sense and would
lead up to the text diagnostics crashing when presented with
non-sensical locations.

This fixes rdar://7597492, a crash on 255.vortex.

llvm-svn: 96004
2010-02-12 19:31:35 +00:00
Fariborz Jahanian dc68f9539c Patch to fix a warning which exposed a bug in building
a qualified objective-c pointer type. Fixes radar 7638810.
(Also removes a FIXME).

llvm-svn: 96003
2010-02-12 19:27:33 +00:00
Chris Lattner fc38aa7091 restructure code a bit: there are two potential issues
worth asserting about in this code: 1) if the source range
is bogus (begin loc after end loc), and 2) if the client
is trying to highlight a range that is purely whitespace.

It is possible to just silently ignore #2, but it seems like
it is always a bug, so lets keep asserting on this condition,
but with a better assert message.

llvm-svn: 95998
2010-02-12 18:52:52 +00:00
Anders Carlsson 0760481f26 Fix a refacto that broke the clang-on-clang build.
llvm-svn: 95994
2010-02-12 18:14:46 +00:00
Fariborz Jahanian a459c4453d Fixes a rewriter bug rewriting function decl.
with block-pointer-type as one or more of its
arguments. Fixes radar 7638400.

llvm-svn: 95992
2010-02-12 17:52:31 +00:00
Douglas Gregor 5089c769bb Improve representation of tag declarations first declared or defined
within the declarator of another declaration, from Enea Zaffanella!

llvm-svn: 95991
2010-02-12 17:40:34 +00:00
Anders Carlsson 5272c2574a Start stubbing out more of the covariant thunk support.
llvm-svn: 95990
2010-02-12 17:37:14 +00:00
Douglas Gregor 925df1b529 Improve documentation for DependentTypeOfExprType, DependentDecltypeType. No functionality change.
llvm-svn: 95989
2010-02-12 17:28:41 +00:00
Douglas Gregor 56521c5e8c Simplify incomplete-array merging code in the AST importer, thanks to
Daniel's suggestion.

llvm-svn: 95987
2010-02-12 17:23:39 +00:00
Douglas Gregor 8870a49310 Fix a latent bug found by Ahmed Charles, where we were calling
ASTContext::getFunctionType with the wrong set of arguments.

llvm-svn: 95986
2010-02-12 17:17:28 +00:00
Anders Carlsson 8e661e15f2 Keep track of whether a final overrider needs a return type adjustment.
llvm-svn: 95985
2010-02-12 17:13:23 +00:00
Anders Carlsson 136bd19224 Move overrider out into a separate struct.
llvm-svn: 95984
2010-02-12 16:55:34 +00:00
Chris Lattner aa1cccbbef Fix PR6282: the include guard optimization cannot happen if the
guard macro is already defined for the first occurrence of the
header.  If it is, the body will be skipped and not be properly
analyzed for the include guard optimization.

llvm-svn: 95972
2010-02-12 08:03:27 +00:00
Anders Carlsson e8a9756e63 Keep track of the address points for all primary bases, and add the ability to dump multiple address points for a single offset.
llvm-svn: 95970
2010-02-12 07:43:48 +00:00
Douglas Gregor f40863caff Work around an annoying, non-standard optimization in the glibc
headers, where malloc (and many other libc functions) are declared
with empty throw specifications, e.g.,  

  extern void *malloc (__SIZE_TYPE__ __size) throw () __attribute__
  ((__malloc__)) ;

The C++ standard doesn't seem to allow this, and redeclaring malloc as
the standard permits (as follows) resulted in Clang (rightfully!)
complaining about mis-matched exception specifications.

  void *malloc(size_t size);

We work around this by silently propagating an empty throw
specification "throw()" from a function with C linkage declared in a
system header to a redeclaration that has no throw specifier.

Ick.

llvm-svn: 95969
2010-02-12 07:32:17 +00:00
John McCall 84c416b9f6 Fix a bug causing an assertion when a covariant return type differed from
an overriden type only by reduced qualification.

llvm-svn: 95968
2010-02-12 06:15:07 +00:00
Douglas Gregor 87b4b4184c Improve a test slightly
llvm-svn: 95967
2010-02-12 06:08:51 +00:00
Douglas Gregor d3a5918742 In C++, allow builtins to be referred to via qualified name lookup, e.g.,
::__builtin_va_copy

Fixes one of the Firefox issues in PR5511.

llvm-svn: 95966
2010-02-12 05:48:04 +00:00
Anders Carlsson 65b4978f7f More work on vtable layout. We can now layout vtables with primary bases.
llvm-svn: 95965
2010-02-12 05:25:12 +00:00
John McCall 62d5d64ce9 Waste two bits in every clang::Type so that the type class can be read
in a single byte-load rather than some crazy bitmunging operation.

llvm-svn: 95964
2010-02-12 03:41:30 +00:00
Anders Carlsson 09da3372b6 When dumping vtables, dump whether a virtual member function is pure or not.
llvm-svn: 95963
2010-02-12 02:38:13 +00:00
Anders Carlsson 9fbf6d95f6 More work on the final overriders.
llvm-svn: 95954
2010-02-12 01:40:03 +00:00
Devang Patel f4df65cf60 Do not ignore anonymous records.
llvm-svn: 95953
2010-02-12 01:31:06 +00:00
Devang Patel e003dd1721 Cache new compile unit.
llvm-svn: 95952
2010-02-12 01:30:31 +00:00
Ted Kremenek e9711db487 Two changes to scan-build:
(1) When no 'clang' is found with 'scan-build', remember the one from
the path as scan-build sees it, not the build system.  This prevents
us from finding different clangs during the build.

(2) Don't set LDPLUSPLUS when running xcodebuild; instead rely on the
clang driver to do the right thing.

llvm-svn: 95943
2010-02-12 00:12:25 +00:00
Ted Kremenek 14015de619 Add comments.
llvm-svn: 95942
2010-02-12 00:10:34 +00:00
Douglas Gregor 2579105c4e Handle AST merges of incomplete class types.
llvm-svn: 95941
2010-02-12 00:09:27 +00:00
Tanya Lattner 90073804fb Implementing unused function warning.
llvm-svn: 95940
2010-02-12 00:07:30 +00:00
Charles Davis a90f7ca591 Warn about using the new force_align_arg_pointer attribute on a function
pointer. If you don't like the new warning, you can turn it off with
-Wno-force-align-arg-pointer.

llvm-svn: 95939
2010-02-11 23:57:08 +00:00
Fariborz Jahanian 4c4ca5a9d3 Fixes a rewriting bug where order of constructor expression arguments did not match
order of constructor arguments (all block API specific). This was exposed only in 
a large block literal expression in a large file where PtrSet container size 
execceded its limit and required reallocation.  Fixes radar 7638294

llvm-svn: 95936
2010-02-11 23:35:57 +00:00
Douglas Gregor 50dc219e8b When we have a dependent direct initializer but not a dependent
variable type, we can (and should) still check for completeness of the
variable's type. Do so, to work around an assertion that shows up in
Boost's shared_ptr.

llvm-svn: 95934
2010-02-11 22:55:30 +00:00
Ted Kremenek 9d6eb40ce7 Fix leak in CXXNewExpr where the SubExprs array would get allocated directly using 'new[]' instead of the allocator associated with ASTContext.
llvm-svn: 95933
2010-02-11 22:51:03 +00:00
John McCall 81472e34b2 Make this test not rely on the system <limits.h>. Hopefully fixes the
MSVC build.

llvm-svn: 95932
2010-02-11 22:45:16 +00:00
Ted Kremenek 9c8a6f5a8e Fix re-allocation in AttrWithString::ReplaceString() to use the allocator assosciated with ASTContext.
llvm-svn: 95931
2010-02-11 22:44:22 +00:00
Ted Kremenek 2c809308ca Allocate the SubExprs array in ObjCMessageExpr using the allocator associated with ASTContext. This fixes yet another leak (<rdar://problem/7639260>).
llvm-svn: 95930
2010-02-11 22:41:21 +00:00
Anders Carlsson e8ac42ad5c Stub out the final overriders class.
llvm-svn: 95922
2010-02-11 21:24:32 +00:00
Anders Carlsson dd27b5d7bb Use getAs instead of cast/dyn_cast on types. (I'm sure Doug will appreciate this).
llvm-svn: 95911
2010-02-11 19:45:15 +00:00
Anders Carlsson 727ffb14a1 Move two functions to the top. No functionality change.
llvm-svn: 95908
2010-02-11 19:39:49 +00:00
Ted Kremenek 23a26d244d Uncomment lines I never meant to have left commented in a commit.
llvm-svn: 95906
2010-02-11 19:37:25 +00:00
Douglas Gregor 7eeb59752a When AST merging for record declarations fails, warn about the
incompatibility and show where the structural differences are. For
example:

struct1.c:36:8: warning: type 'struct S7' has incompatible definitions
in different translation units
struct S7 { int i : 8; unsigned j : 8; } x7;
       ^
struct1.c:36:33: note: bit-field 'j' with type 'unsigned int' and length 8 here
struct S7 { int i : 8; unsigned j : 8; } x7;
                                ^
struct2.c:33:33: note: bit-field 'j' with type 'unsigned int' and length 16 here
struct S7 { int i : 8; unsigned j : 16; } x7;
                                ^

There are a few changes to make this work:
  - ASTImporter now has only a single Diagnostic object, not multiple
  diagnostic objects. Otherwise, having a warning/error printed via
  one Diagnostic and its note printed on the other Diagnostic could
  cause the note to be suppressed.
  - Implemented import functionality for IntegerLiteral (along with
  general support for statements and expressions)

llvm-svn: 95900
2010-02-11 19:21:55 +00:00
Eli Friedman f5d476efb2 Add builtins from PR5255. Implementations coming soon.
llvm-svn: 95894
2010-02-11 19:02:42 +00:00
John McCall 739908faf6 Test case for warnings with carets inside macro instantiations.
llvm-svn: 95893
2010-02-11 18:52:49 +00:00
Anders Carlsson 48ea217fbf Add virtual operator= example.
llvm-svn: 95888
2010-02-11 18:21:49 +00:00
Anders Carlsson 5bd8d19291 More vtable layout dumper improvements. Handle destructors, dump the complete function type of the member functions (using PredefinedExpr::ComputeName.
llvm-svn: 95887
2010-02-11 18:20:28 +00:00
Douglas Gregor 69837bed2f Add missing test cases for AST merging of structures.
llvm-svn: 95886
2010-02-11 18:18:11 +00:00
Daniel Dunbar bcd554f908 Driver: Fix clang -ccc-no-clang -x c++-header foo.h on Darwin.
llvm-svn: 95876
2010-02-11 17:33:45 +00:00
Anders Carlsson 932c2f2a9a Keep track of, and dump, vtable address points.
llvm-svn: 95874
2010-02-11 17:18:51 +00:00
Benjamin Kramer 15d8225b59 Remove noisy semicolon.
llvm-svn: 95872
2010-02-11 11:33:47 +00:00
John McCall be089fa86b Suppress warnings if their instantiation location is in a system header, not
their spelling location.  This prevents warnings from being swallowed just
because the caret is on the first parenthesis in, say, NULL.

This is an experiment;  the risk is that there might be a substantial number
of system headers which #define symbols to expressions which inherently cause
warnings.  My theory is that that's rare enough that it can be worked
around case-by-case, and that producing useful warnings around NULL is worth 
it.  But I'm willing to accept that I might be empirically wrong.

llvm-svn: 95870
2010-02-11 10:04:29 +00:00
Ted Kremenek d31b2637ab Patch by Cristian Draghici:
Enhance the printf format string checking when using the format
specifier flags ' ', '0', '+' with the 'p' or 's' conversions (since
they are nonsensical and undefined).  This is similar to GCC's
checking.

Also warning when a precision is used with the 'p' conversin
specifier, since it has no meaning.

llvm-svn: 95869
2010-02-11 09:27:41 +00:00
Anders Carlsson 5d40c6f658 Check in the beginnings of my new vtable layout builder idea.
Right now, it's off by default but can be tested by passing -fdump-vtable-layouts to clang -cc1. This option will cause all vtables that will normally be emitted as part of codegen to also be dumped using the new layout code.

I've also added a very simple new vtable layout test case.

llvm-svn: 95865
2010-02-11 08:02:13 +00:00
Ted Kremenek 50228be0f3 Attempt to always dispose of the CXIndex object in c-index-test.
llvm-svn: 95864
2010-02-11 07:41:25 +00:00
Ted Kremenek 510ee2594e Use the allocator associated with ASTContext to allocate the args
array associated with NonNullAttr.  This fixes yet another leak when
ASTContext uses a BumpPtrAllocator.

Fixes: <rdar://problem/7637150>
llvm-svn: 95863
2010-02-11 07:31:47 +00:00
Ted Kremenek da4e0d350c Have ~ASTContext() delete StoredDeclsMap (internal to DeclContext) by
storing the set of StoredDeclsMaps in an internal vector of void*.
This isn't an ideal solution, but for the time being this fixes a
major memory leak with these DenseMaps not being freed.

Fixes: <rdar://problem/7634755>
llvm-svn: 95861
2010-02-11 07:12:28 +00:00
Ted Kremenek 7f4945aa9c Remove use of 'std::string' from Attr objects, using instead a byte
array allocated using the allocator in ASTContext.  This addresses
these strings getting leaked when using a BumpPtrAllocator (in
ASTContext).

Fixes: <rdar://problem/7636765>
llvm-svn: 95853
2010-02-11 05:28:37 +00:00
Daniel Dunbar aeea8ac3d8 Driver: Add -rewrite-objc, which is an interface to clang -cc1 -rewrite-objc.
llvm-svn: 95849
2010-02-11 03:16:21 +00:00
Daniel Dunbar 84f22f9da1 Driver: Fix infinite loop and wrong message on invalid -ccc-clang-arch argument.
llvm-svn: 95848
2010-02-11 03:16:07 +00:00
Ted Kremenek c162e8e193 Clean up ownership of 'AttributeList' objects in Parser. Apparently
we would just leak them all over the place, with no clear ownership of
these objects at all.  AttributeList objects would get leaked on both
error and non-error paths.

Note: I introduced the usage of llvm::OwningPtr<AttributeList> to
manage these objects, which is particularly useful for methods with
multiple return sites.  In at least one method I used them even when
they weren't strictly necessary because it clarified the ownership
semantics and made the code easier to read.  Should the excessive
'take()' and 'reset()' calls become a performance issue we can always
re-evaluate.

Note+1: I believe I have not introduced any double-frees, but it would
be nice for someone to review this.

This fixes <rdar://problem/7635046>.

llvm-svn: 95847
2010-02-11 02:19:13 +00:00
John McCall 4f7ced69ff Strip attributes and 'inline' off the "previous declaration" of a
template explicit specialization.  Complete an apparently stalled refactor
towards using CheckSpecializationInstantiationRedecl().

llvm-svn: 95845
2010-02-11 01:33:53 +00:00
Douglas Gregor 4a62bdfb2a Remove another redundant ASTContext parameter
llvm-svn: 95843
2010-02-11 01:30:34 +00:00
Douglas Gregor d505812422 Eliminate a bunch of unnecessary ASTContexts from members functions of
Decl subclasses. No functionality change.

llvm-svn: 95841
2010-02-11 01:19:42 +00:00