Commit Graph

515 Commits

Author SHA1 Message Date
Rafael Espindola 00a665751d Move the "needs exception support" logic to clang. This also fixes
-fno-exceptions in C++ code. We used to always define __EXCEPTIONS in
C++.

llvm-svn: 83199
2009-10-01 13:33:33 +00:00
Argyrios Kyrtzidis 8da9ce6328 Pull TypeLocVisitor into its own header file.
llvm-svn: 83112
2009-09-29 21:27:32 +00:00
Argyrios Kyrtzidis 0643e333a3 Introduce ObjCInterfaceLoc which provides type source information for ObjC interfaces.
llvm-svn: 83097
2009-09-29 19:45:22 +00:00
Argyrios Kyrtzidis 73360e1bbb Introduce ObjCProtocolListLoc for keeping source location information for protocol references.
llvm-svn: 83094
2009-09-29 19:43:35 +00:00
Argyrios Kyrtzidis a7a36dfdb6 Introduce ObjCProtocolListType type subclass.
This is used only for keeping detailed type source information for protocol references,
it should not participate in the semantics of the type system.

Its protocol list is not canonicalized.

llvm-svn: 83093
2009-09-29 19:42:55 +00:00
Dan Gohman 0b3cfab288 Pass the formatted_raw_ostream to createPrintModulePass and
createBitcodeWriterPass instead of the underlying raw_ostream. This
avoids trouble with formatted_raw_ostream's behavior of setting the
underlying stream to be unbuffered, which resulted in
clang -emit-llvm -S using unbuffered output.

llvm-svn: 82857
2009-09-26 15:06:14 +00:00
Ted Kremenek 9a4e5663d2 Hoist some branches in AnalysisManager::HandleTranslationUnit so we
avoid scanning for an "entry point" FunctionDecl if we (a) have no
translation unit actions and (b) no entry point function has been
specified.

llvm-svn: 82846
2009-09-26 04:15:09 +00:00
Anders Carlsson 294616a74c Don't try to dump invalid decls or forward decls.
llvm-svn: 82827
2009-09-26 01:02:04 +00:00
Anders Carlsson e1883100a3 Who would have thought that empty classes were so tricky? Handle cases where an empty virtual base class needs to be moved aside because it conflicts with the first field.
llvm-svn: 82746
2009-09-25 01:54:38 +00:00
Anders Carlsson 6d2b6f49ce Improve the record layout dumper.
llvm-svn: 82733
2009-09-24 23:50:42 +00:00
John McCall 8ccfcb51ee Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy.  Demote 'volatile' to extended-qualifier status.  Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right;  many more remain.

llvm-svn: 82705
2009-09-24 19:53:00 +00:00
Anders Carlsson d934010557 Add a -dump-record-layouts argument to clang-cc.
llvm-svn: 82703
2009-09-24 18:54:49 +00:00
Daniel Dunbar b45012dcde Update PCH serialization of FunctionDecl flags.
llvm-svn: 82526
2009-09-22 05:38:14 +00:00
Daniel Dunbar 2d925ebd0a Allow PCH files to be read from stdin.
llvm-svn: 82525
2009-09-22 05:38:01 +00:00
Daniel Dunbar 362178883c Add StringLiteral::getString -> StringRef.
llvm-svn: 82514
2009-09-22 03:27:33 +00:00
John McCall 9dd450bb78 Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely.  Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.

llvm-svn: 82501
2009-09-21 23:43:11 +00:00
Daniel Dunbar 143021e0ca Add missing PCH support for -fstack-protector.
llvm-svn: 82435
2009-09-21 04:16:19 +00:00
Daniel Dunbar b7bbfdd9e6 Change ASTUnit to only initialize the predefines buffer to the suggested predefines.
- It isn't really clear what to do with the preprocessor here, but this is more sensible.

llvm-svn: 82431
2009-09-21 03:03:47 +00:00
Daniel Dunbar 7cd285f0fe Change ASTUnit to take the Diagnostic as an argument, the client should have control of this.
llvm-svn: 82430
2009-09-21 03:03:39 +00:00
Ted Kremenek 1e7f988f5e Fix regression introduced by r82198 that caused functions/methods with invalid CFGs to get analyzed.
llvm-svn: 82297
2009-09-18 22:29:35 +00:00
Ted Kremenek 82f7f9c080 Introduce caching of diagnostics in BugReporter. This provides extra
pruning of diagnostics that may be emitted multiple times.  This is
accomplished by adding FoldingSet profiling support to PathDiagnostic,
and then having BugReporter record what diagnostics have been issued.

This was motived to a serious bug introduced by moving the
'divide-by-zero' checking outside of GRExprEngine into a separate
'Checker' class.  When analyzing code using the '-fobjc-gc' option, a
given function would be analyzed twice, but the second time various
"internal checks" would be disabled to avoid emitting multiple
diagnostics (e.g., "null dereference") for the same issue.  The
problem is that such checks also effect path pruning and don't just
emit diagnostics.  This resulted in an assertion failure involving a
real divide-by-zero in some analyzed code where we would get an
assertion failure in APInt because the 'DivZero' check was disabled
and didn't prune the logic that resulted in the divide-by-zero in the
analyzer.

The implemented solution is somewhat of a hack, and may not perform
extremely well.  This will need to be cleaned up over time.

As a regression test, 'misc-ps.m' has been modified so that its tests
are run using -fobjc-gc to test this diagnostic pruning behavior.

llvm-svn: 82198
2009-09-18 05:37:41 +00:00
Daniel Dunbar 5bb5ec5b07 PCH: When writing PCH files, tweak the predicate function deciding whether to mark a decl as "external" to be closer to reality.
This still isn't perfect, but I believe it is conservatively accurate at marking decls which IRgen needs to see, while still keeping the "deserialization footprint" on Cocoa.h.

llvm-svn: 82112
2009-09-17 03:06:51 +00:00
Daniel Dunbar 865c2a7f23 PCH: When deserializing an explicit "external definition", don't pass it to HandleTopLevelDecl -- this is already being done inside the reader.
This is something of a hack, since whether the reader actually did this depends on the "isConsumerInterestedIn" predicate. I think we need to rework how this works, but I need to discuss with Doug.

llvm-svn: 82111
2009-09-17 03:06:44 +00:00
Mike Stump d611ebaa5e Fix spelling.
llvm-svn: 82078
2009-09-16 20:41:09 +00:00
Douglas Gregor 299d76e901 Rework the way we determine whether an externally visible symbol is
generated for an inline function definition, taking into account C99
and GNU inline/extern inline semantics. This solution is simpler,
cleaner, and fixes PR4536.

llvm-svn: 81670
2009-09-13 07:46:26 +00:00
Douglas Gregor e2350a3b97 Eliminate FunctionDecl::getBodyIfAvailable
llvm-svn: 81588
2009-09-12 00:08:48 +00:00
Daniel Dunbar ea1c037177 Update prototype.
llvm-svn: 81510
2009-09-11 06:34:14 +00:00
Zhongxing Xu dc299bc481 Start to add a new transfer function that inlines callee. To be continued.
llvm-svn: 81501
2009-09-11 04:13:42 +00:00
Fariborz Jahanian 2cde203392 Non fragile ABI for GNU runtime. Patch bu David Chisnall.
llvm-svn: 81462
2009-09-10 21:48:21 +00:00
Zhongxing Xu 7e3431b5cf Make AnalysisManager stateless. Now other analyzer components only depends on
local node information.

llvm-svn: 81433
2009-09-10 05:44:00 +00:00
Douglas Gregor 5d3507d39c Improve handling of initialization by constructor, by ensuring that
such initializations properly convert constructor arguments and fill
in default arguments where necessary. This also makes the ownership
model more clear.

llvm-svn: 81394
2009-09-09 23:08:42 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Chris Lattner 0c79736553 Fix PR4922, where Sema would complete tentative definitions in nondeterminstic
order because it was doing so while iterating over a densemap.

There are still similar problems in other places, for example 
WeakUndeclaredIdentifiers is still written to the PCH file in a nondeterminstic
order, and we emit warnings about #pragma weak in nondeterminstic order.

llvm-svn: 81236
2009-09-08 18:19:27 +00:00
Daniel Dunbar 49f0e80fdd Remove trailing whitespace.
llvm-svn: 81169
2009-09-07 23:07:56 +00:00
Benjamin Kramer 635444bcea More <sstream> removal.
llvm-svn: 81150
2009-09-07 12:33:46 +00:00
Benjamin Kramer 26db6481c5 Replace some instances of std::string with StringRefs.
llvm-svn: 81079
2009-09-05 09:49:39 +00:00
John McCall fcc33b074b Basic support for representing elaborated type specifiers
directly in the AST.  The current thinking is to create these
only in C++ mode for efficiency.  But for now, they're not being
created at all; patch to follow.

This will let us do things like verify that tags match during
template instantation, as well as signal that an elaborated type
specifier was used for clients that actually care.

Optimally, the TypeLoc hierarchy should be adjusted to carry tag
location information as well.

llvm-svn: 81057
2009-09-05 00:15:47 +00:00
Steve Naroff ef9618b75f Implement accessors clang_getCursorKind(), clang_getCursorDecl().
Implement clang_getCursor() - wired up to Argiris's work.
Implement callbacks for CXCursor_ObjCProtocolRef.

llvm-svn: 81004
2009-09-04 15:44:05 +00:00
Daniel Dunbar fe07aecd37 Don't use '%ll', this doesn't workin on Win32.
llvm-svn: 80933
2009-09-03 19:23:49 +00:00
Steve Naroff c0683b909a Add ASTUnit::getOriginalSourceFileName() and use in clang_getTranslationUnitSpelling().
llvm-svn: 80932
2009-09-03 18:19:54 +00:00
Douglas Gregor b3286fe685 Save/load POSIXThreads flag for PCH
llvm-svn: 80916
2009-09-03 14:36:33 +00:00
Daniel Dunbar 3a0637b06b Revert "Visit function/method bodies and issue callback for parameters and local
variables.", this is breaking x86_64-apple-darwin10 and Linux tests.

llvm-svn: 80896
2009-09-03 05:59:50 +00:00
Daniel Dunbar 2d9c740cc5 Revert "Remove redundant local variable (use newly created instance data).", the
previous commit this depends on is breaking x86_64-apple-darwin10 and Linux tests.

llvm-svn: 80895
2009-09-03 05:59:35 +00:00
Daniel Dunbar a77eaeb1e6 Add basic support for -pthread.
- Patch by David Chisnall, with PCH and Darwin support mixed in.

llvm-svn: 80883
2009-09-03 04:54:28 +00:00
Steve Naroff 517ea46e2e Remove redundant local variable (use newly created instance data).
llvm-svn: 80861
2009-09-03 00:43:52 +00:00
Steve Naroff ef3cf2a576 Visit function/method bodies and issue callback for parameters and local variables.
Add clang_getTranslationUnitSpelling().

llvm-svn: 80859
2009-09-03 00:32:06 +00:00
Douglas Gregor 84f14dd674 Preliminary AST representation and semantic analysis for
explicitly-specified template argument lists in member reference
expressions, e.g.,

  x->f<int>()

llvm-svn: 80646
2009-09-01 00:37:14 +00:00
Douglas Gregor f4b34ba326 Remember to write the qualifier of a MemberExpr to the PCH file when we get to C++ PCH
llvm-svn: 80643
2009-08-31 23:44:04 +00:00
Eli Friedman 80110179f4 Define _GNU_SOURCE in C++ mode so that clang works with GNU libstdc++.
llvm-svn: 80289
2009-08-27 22:01:41 +00:00
Mike Stump 3722f5896c Regularize the case and sort.
llvm-svn: 80163
2009-08-26 22:31:08 +00:00