Граф коммитов

515 Коммитов

Автор SHA1 Сообщение Дата
Rafael Espindola f759df06d9 Move the "needs exception support" logic to clang. This also fixes
-fno-exceptions in C++ code. We used to always define __EXCEPTIONS in
C++.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83199 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 13:33:33 +00:00
Argyrios Kyrtzidis 0c411806d5 Pull TypeLocVisitor into its own header file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 21:27:32 +00:00
Argyrios Kyrtzidis eb66759e9a Introduce ObjCInterfaceLoc which provides type source information for ObjC interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 19:45:22 +00:00
Argyrios Kyrtzidis f352bddf01 Introduce ObjCProtocolListLoc for keeping source location information for protocol references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 19:43:35 +00:00
Argyrios Kyrtzidis 24fab41057 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83093 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 19:42:55 +00:00
Dan Gohman b8d42397aa 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82857 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 15:06:14 +00:00
Ted Kremenek 74e3c92aa3 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82846 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 04:15:09 +00:00
Anders Carlsson 4f5bf3b095 Don't try to dump invalid decls or forward decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 01:02:04 +00:00
Anders Carlsson a4c6081abd 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82746 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 01:54:38 +00:00
Anders Carlsson 8fdccd95fc Improve the record layout dumper.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 23:50:42 +00:00
John McCall 0953e767ff 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 19:53:00 +00:00
Anders Carlsson 78762ebb9a Add a -dump-record-layouts argument to clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 18:54:49 +00:00
Daniel Dunbar 7f8b57aa35 Update PCH serialization of FunctionDecl flags.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 05:38:14 +00:00
Daniel Dunbar f3c740eb2c Allow PCH files to be read from stdin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82525 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 05:38:01 +00:00
Daniel Dunbar b648023da2 Add StringLiteral::getString -> StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82514 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 03:27:33 +00:00
John McCall 183700f494 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 23:43:11 +00:00
Daniel Dunbar ab8e281b32 Add missing PCH support for -fstack-protector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82435 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 04:16:19 +00:00
Daniel Dunbar d5b6126389 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82431 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:03:47 +00:00
Daniel Dunbar 31b87d8006 Change ASTUnit to take the Diagnostic as an argument, the client should have control of this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82430 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:03:39 +00:00
Ted Kremenek 75d03cffe2 Fix regression introduced by r82198 that caused functions/methods with invalid CFGs to get analyzed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 22:29:35 +00:00
Ted Kremenek 6a19832d08 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 05:37:41 +00:00
Daniel Dunbar e24d38f692 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:06:51 +00:00
Daniel Dunbar 04a0b50e19 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:06:44 +00:00
Mike Stump 197c8d9ef0 Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 20:41:09 +00:00
Douglas Gregor 1fc09a92d0 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81670 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-13 07:46:26 +00:00
Douglas Gregor af3280fadb Eliminate FunctionDecl::getBodyIfAvailable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-12 00:08:48 +00:00
Daniel Dunbar a4d3282683 Update prototype.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 06:34:14 +00:00
Zhongxing Xu 66847a2826 Start to add a new transfer function that inlines callee. To be continued.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 04:13:42 +00:00
Fariborz Jahanian d9a1db3a4d Non fragile ABI for GNU runtime. Patch bu David Chisnall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-10 21:48:21 +00:00
Zhongxing Xu b317f8f5ca Make AnalysisManager stateless. Now other analyzer components only depends on
local node information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-10 05:44:00 +00:00
Douglas Gregor 39da0b8145 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81394 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 23:08:42 +00:00
Mike Stump 1eb4433ac4 Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Chris Lattner 63d65f873f 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81236 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 18:19:27 +00:00
Daniel Dunbar cbff0dc7fe Remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81169 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-07 23:07:56 +00:00
Benjamin Kramer 05c73c5f28 More <sstream> removal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-07 12:33:46 +00:00
Benjamin Kramer 458fb10ef5 Replace some instances of std::string with StringRefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81079 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-05 09:49:39 +00:00
John McCall 7da2431c23 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-05 00:15:47 +00:00
Steve Naroff 9efa767be8 Implement accessors clang_getCursorKind(), clang_getCursorDecl().
Implement clang_getCursor() - wired up to Argiris's work.
Implement callbacks for CXCursor_ObjCProtocolRef.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 15:44:05 +00:00
Daniel Dunbar b8b844b925 Don't use '%ll', this doesn't workin on Win32.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 19:23:49 +00:00
Steve Naroff 77accc11f0 Add ASTUnit::getOriginalSourceFileName() and use in clang_getTranslationUnitSpelling().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 18:19:54 +00:00
Douglas Gregor 972d954bd2 Save/load POSIXThreads flag for PCH
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80916 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 14:36:33 +00:00
Daniel Dunbar bce6f62ae7 Revert "Visit function/method bodies and issue callback for parameters and local
variables.", this is breaking x86_64-apple-darwin10 and Linux tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 05:59:50 +00:00
Daniel Dunbar cc318939da 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80895 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 05:59:35 +00:00
Daniel Dunbar 5345c391c6 Add basic support for -pthread.
- Patch by David Chisnall, with PCH and Darwin support mixed in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 04:54:28 +00:00
Steve Naroff bbff6990ac Remove redundant local variable (use newly created instance data).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80861 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 00:43:52 +00:00
Steve Naroff 23d8bea705 Visit function/method bodies and issue callback for parameters and local variables.
Add clang_getTranslationUnitSpelling().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 00:32:06 +00:00
Douglas Gregor c4bf26fbdf Preliminary AST representation and semantic analysis for
explicitly-specified template argument lists in member reference
expressions, e.g.,

  x->f<int>()



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-01 00:37:14 +00:00
Douglas Gregor 303e6d7554 Remember to write the qualifier of a MemberExpr to the PCH file when we get to C++ PCH
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80643 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 23:44:04 +00:00
Eli Friedman 666479b24b Define _GNU_SOURCE in C++ mode so that clang works with GNU libstdc++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80289 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 22:01:41 +00:00
Mike Stump 1feade8e52 Regularize the case and sort.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 22:31:08 +00:00