Commit Graph

593 Commits

Author SHA1 Message Date
Nuno Lopes 24241d249e add gentoo x86 2009.1 (gcc 4.3.4) include paths
llvm-svn: 84371
2009-10-17 23:11:14 +00:00
Daniel Dunbar 283ccf4342 Use StringExtra's HashString instead of BernsteinHash.
llvm-svn: 84360
2009-10-17 20:43:58 +00:00
Douglas Gregor 4505315726 Write the preprocessor block after we write out types + declarations,
so that we catch any macros used within the declarations and types. 

Also, properly store a NULL selector.

llvm-svn: 84334
2009-10-17 17:25:45 +00:00
Daniel Dunbar a80c07e8e6 Add Ubuntu 9.04 C++ search path.
llvm-svn: 84301
2009-10-17 03:19:56 +00:00
Ted Kremenek 8bcb1c6883 Add 'UseBumpPtrAllocator' flag to ASTUnit::LoadFromPCHFile() to cause the created ASTContext to use
its own BumpPtrAllocator to allocate ASTs.

Change clang_createTranslationUnit (CIndex) to pass 'UseBumpPtrAllocator = true' to
ASTUnit::LoadFromPCHFile().

llvm-svn: 84296
2009-10-17 00:34:24 +00:00
Douglas Gregor 12bfa3859d Merge the "types" and "declarations" blocks in the precompiled header
format, so that we don't end up with multiple declaration and types
blocks. Also, fix a few obscure bugs with PCH loading and generation:

  - If the DeclIDs DenseMap reallocates while we are writing a
    declaration (due to recursively writing other declarations), we
    could end up writing a bad ID to ExternalDefinitions.
  - When loading an ArrayLoc (part of DeclaratorInfo), we need to set
    the size expression to NULL if no size expression was provided.

PCH -> AST rewriting is still partly broken, unfortunately.

llvm-svn: 84293
2009-10-17 00:13:19 +00:00
Douglas Gregor 8655e88603 While writing source-location entries to a PCH file, go through an
interface that can load those source-location entries on demand (from
another PCH file).

llvm-svn: 84287
2009-10-16 22:46:09 +00:00
John McCall 8f115c6b45 Factor out routines to encode/decode DeclaratorInfos and move them into the
core PCH reader/writer implementation files.

llvm-svn: 84278
2009-10-16 21:56:05 +00:00
Douglas Gregor 16bef857d9 Keep track of whether declararions were loaded from a precompiled
header or not via a new "PCHLevel" field in Decl. We currently use
this information to help CIndex filter out declarations that came from
a precompiled header (rather than from an AST file). Further down the
road, it can be used to help implement multi-level precompiled
headers.

llvm-svn: 84267
2009-10-16 20:01:17 +00:00
Douglas Gregor d2eb58abac Add support for a chain of stat caches in the FileManager, rather than
only supporting a single stat cache. The immediate benefit of this
change is that we can now generate a PCH/AST file when including
another PCH file; in the future, the chain of stat caches will likely
be useful with multiple levels of PCH files.

llvm-svn: 84263
2009-10-16 18:18:30 +00:00
John Thompson 1faca9e0fb Work-around wchar_t and __pragma problem in VC headers
llvm-svn: 84227
2009-10-16 01:12:00 +00:00
John McCall c5b8225285 Remove the ConstantArrayType subtypes. This information is preserved in the
TypeLoc records for declarations;  it should not be necessary to represent it
directly in the type system.

Please complain if you were using these classes and feel you can't replicate
previous functionality using the TypeLoc API.

llvm-svn: 84222
2009-10-16 00:14:28 +00:00
Steve Naroff 44cd60eebe Make sure temporary files get unlinked.
llvm-svn: 84208
2009-10-15 22:23:48 +00:00
Edward O'Callaghan d8712d9143 AuroraUX toolchain fixes.
llvm-svn: 84176
2009-10-15 07:44:07 +00:00
John McCall 33815690af Better living through metaprogramming. Create a base class which abstracts
most of the unsafe boilerplate out of TypeLoc.  Create a QualifiedLoc class
to represent the idea that we *might* start representing source locations
of qualifiers.  Dealing with qualifiers explicitly like this also lets us
efficiently ignore them in all the concrete cases.

This should make it obvious and easy to add new TypeLoc subclasses.

llvm-svn: 84168
2009-10-15 03:50:32 +00:00
Rafael Espindola 0a1ac331a3 Add support for having different c++ search dirs with -m32 and -m64. So far
this is only used in darwin10, 64 bit ubuntu 9.10 and 64 bit openSUSE 11.1.

llvm-svn: 84115
2009-10-14 17:09:44 +00:00
John Thompson 4334ce6bda Fixes pth.c on Windows.
llvm-svn: 84007
2009-10-13 18:51:32 +00:00
Mike Stump b9a9a7c0ad Fixup windows include paths. Patch by John Thompson.
llvm-svn: 83898
2009-10-12 20:50:45 +00:00
Edward O'Callaghan e4ab8eacf7 Typo in AddGnuCPlusPlusIncludePaths.
llvm-svn: 83847
2009-10-12 12:02:47 +00:00
Mike Stump 1ba6edb030 Efficiency refinements.
llvm-svn: 83666
2009-10-09 20:16:49 +00:00
Mike Stump e752333c66 Push all the way out to 80.
llvm-svn: 83664
2009-10-09 19:42:16 +00:00
Axel Naumann 04ca7e181f Passing const Triple& is sufficient for AddDefaultSystemIncludePaths()
llvm-svn: 83663
2009-10-09 19:37:12 +00:00
Mike Stump acdc3158b3 Add a refactor pointer...
llvm-svn: 83599
2009-10-08 23:57:53 +00:00
Mike Stump 904ad90bc8 Set up include paths for VC++ and Cygwin headers, along with the
existing MinGW headers, plus the newer 4.4.0 version.  Patch by John
Thompson.

llvm-svn: 83594
2009-10-08 23:29:47 +00:00
Douglas Gregor 01249503fe Installation of Clang libraries and headers, from Axel Naumann!
llvm-svn: 83582
2009-10-08 22:15:31 +00:00
Ted Kremenek 490b8c0f5b Remove use of std::ofstream in HTMLDiagnostics.cpp.
llvm-svn: 83560
2009-10-08 17:44:41 +00:00
Rafael Espindola c3031a9643 Refactor the c++ include path a bit.
llvm-svn: 83357
2009-10-06 01:33:02 +00:00
Douglas Gregor d54f3a1e58 Encode the Clang branch and Subversion revision into a PCH file, and
assume that PCH files from different Clang revisions are not
compatible. Addresses <rdar://problem/7266572>.

llvm-svn: 83323
2009-10-05 21:07:28 +00:00
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
Douglas Gregor 7e112b0d79 Source location information for ? and : in a ConditionalOperator, from Enea Zaffanella
llvm-svn: 80097
2009-08-26 14:37:04 +00:00
Dan Gohman a98e0e73de Update clang for raw_fd_ostream no longer requiring F_Force.
llvm-svn: 79991
2009-08-25 15:36:09 +00:00
Zhongxing Xu 342950efc5 Remove CodeDecl and CFG from GRExprEngine and GRStateManager.
Now AnalysisManager is the only place we can get CodeDecl.
This leads to an API change: GRState::bindExpr() now takes the CFG argument.

llvm-svn: 79980
2009-08-25 06:51:30 +00:00
Chris Lattner e6434cb421 normalize the CharacterLiteral::getLocation method name, patch
by Enea Zaffanella!

llvm-svn: 79924
2009-08-24 17:39:36 +00:00
Torok Edwin db7149246f Fix build of clang with gcc-4.4: #include <cstdio> was missing.
llvm-svn: 79916
2009-08-24 13:25:12 +00:00
Daniel Dunbar 8100d01ecf Switch to StringRef based BitstreamWriter APIs, where appropriate.
- There is lots of non-endian safe code in here... :/

llvm-svn: 79905
2009-08-24 09:31:37 +00:00
Daniel Dunbar 40165180f7 Switch TargetInfo to store an llvm::Triple.
- Primarily to discourage clients form making decisions based on the string.

llvm-svn: 79901
2009-08-24 09:10:05 +00:00
Chris Lattner 72bb4f602c prune #includes.
llvm-svn: 79889
2009-08-24 04:11:30 +00:00
Chris Lattner 3441b4f77e API changes to match llvm ToT.
llvm-svn: 79868
2009-08-23 22:45:33 +00:00
Benjamin Kramer 89b422c118 Replace cerr with errs().
llvm-svn: 79854
2009-08-23 12:08:50 +00:00
Chris Lattner 817b3012bc use errs() instead of cerr.
llvm-svn: 79829
2009-08-23 05:57:09 +00:00
Douglas Gregor 76d8c5725f Don't install Clang libraries.
llvm-svn: 79824
2009-08-23 05:02:18 +00:00
Chris Lattner 84cffc22d4 adjust for raw_fd_ostream api change.
llvm-svn: 79809
2009-08-23 02:59:41 +00:00
Anders Carlsson 9cedbefb24 Add a -fno-elide-constructors option to clang-cc.
llvm-svn: 79782
2009-08-22 22:30:33 +00:00
Zhongxing Xu 6be1a4e832 Tie the local check NSErrorCheck to a Decl to pave the way
to untie the ExplodedGraph from a specific Decl.

llvm-svn: 79588
2009-08-21 02:18:44 +00:00
Argyrios Kyrtzidis 6032ef1aa3 Remove TypeSpecStartLocation from VarDecl/FunctionDecl/FieldDecl, and use DeclaratorInfo to get this information.
llvm-svn: 79584
2009-08-21 00:31:54 +00:00
Douglas Gregor a8eed7dabb Make the new Objective-C "id" and "Class" redefinition types special
types that are preloaded by the PCH file. Fixes PCH breakage
introduced in r79248.

llvm-svn: 79583
2009-08-21 00:27:50 +00:00
Fariborz Jahanian 9a84665921 Using "ObjCImplicitSetterGetterRefExpr" instead of "ObjCImplctSetterGetterRefExpr".
A field rename and more comments.

llvm-svn: 79537
2009-08-20 17:02:02 +00:00
Daniel Dunbar 62c850fb8f Remove now unnecessary helper methods.
llvm-svn: 79460
2009-08-19 20:32:38 +00:00
Daniel Dunbar 58bc48c14e Switch to SmallString::str from SmallString::c_str.
- Several FIXMEs due to non-Twinification of IRBuilder.

llvm-svn: 79455
2009-08-19 20:04:03 +00:00
Daniel Dunbar dec484abfb Convert parts of Rewriter to StringRef based API.
- Please accept my sincere apologies for the gratuitous elimination of code
   duplication, manual string length counting, unnecessary strlen calls, etc.

llvm-svn: 79448
2009-08-19 19:10:30 +00:00
Argyrios Kyrtzidis 560ac97bf3 Store/load type source info from/to PCH files.
llvm-svn: 79396
2009-08-19 01:28:35 +00:00