Commit Graph

11550 Commits

Author SHA1 Message Date
Douglas Gregor 7210063126 Move the type specifier location for elaborated-type-specifiers from
the tag kind (union, struct, class, enum) over to the name of the tag,
if there is a name, since most clients want to point at the name.

llvm-svn: 94424
2010-01-25 16:33:23 +00:00
Benjamin Kramer ea9f3f240c Update C++ include paths for Exherbo, by Ingmar Vanhassel.
llvm-svn: 94420
2010-01-25 12:20:15 +00:00
Ted Kremenek 0a4546b6fc Add missing file.
llvm-svn: 94407
2010-01-25 04:48:38 +00:00
Ted Kremenek d6b8708643 Split libAnalysis into two libraries: libAnalysis and libChecker.
(1) libAnalysis is a generic analysis library that can be used by
    Sema.  It defines the CFG, basic dataflow analysis primitives, and
    inexpensive flow-sensitive analyses (e.g. LiveVariables).

(2) libChecker contains the guts of the static analyzer, incuding the
    path-sensitive analysis engine and domain-specific checks.

Now any clients that want to use the frontend to build their own tools
don't need to link in the entire static analyzer.

This change exposes various obvious cleanups that can be made to the
layout of files and headers in libChecker.  More changes pending.  :)

This change also exposed a layering violation between AnalysisContext
and MemRegion.  BlockInvocationContext shouldn't explicitly know about
BlockDataRegions.  For now I've removed the BlockDataRegion* from
BlockInvocationContext (removing context-sensitivity; although this
wasn't used yet).  We need to have a better way to extend
BlockInvocationContext (and any LocationContext) to add
context-sensitivty.

llvm-svn: 94406
2010-01-25 04:41:41 +00:00
Chris Lattner 83b0dd16c3 fix rdar://7556129 a crash in blocks debug info codegen.
llvm-svn: 94402
2010-01-25 03:34:56 +00:00
Chris Lattner bf78478d35 simplify code.
llvm-svn: 94401
2010-01-25 03:29:35 +00:00
Daniel Dunbar fcf2d428e4 ASTUnit: Don't check that input files exist when parsing ASTs from the command
line -- they may be remapped (fake) files. This is useful for testing parsing
entirely from memory.

llvm-svn: 94395
2010-01-25 00:44:02 +00:00
Chris Lattner 0bcc858a2b -fno-rtti is now the default.
llvm-svn: 94379
2010-01-24 20:43:31 +00:00
Anders Carlsson 77babdb99a Implement [dcl.fct.spec]p6.
llvm-svn: 94365
2010-01-24 16:49:46 +00:00
Anders Carlsson aaeef07280 Implement instantiation of AsmStmts (Crazy, I know)
llvm-svn: 94361
2010-01-24 05:50:09 +00:00
Alexis Hunt aecc45cb3c Mangle static variables with an extra name to distinguish them from non-static variables in the same TU.
Fixes PR5966 for real this time; also reverts r92911, which had a incorrect fix.

llvm-svn: 94352
2010-01-24 03:04:27 +00:00
Chris Lattner 8fd2d01118 fix PR6034, a crash on invalid where the switch stack would get
unbalanced.

llvm-svn: 94347
2010-01-24 01:50:29 +00:00
Anders Carlsson 60ddba67a8 Fix a nasty bug where temporaries weren't marked as being conditional in some cases.
llvm-svn: 94341
2010-01-24 00:20:05 +00:00
Anders Carlsson 0bd52403d4 Use new initialization code when dealing with [dcl.init.aggr]p12. This fixes the bug where array elements and member initializers weren't copied correctly.
llvm-svn: 94340
2010-01-24 00:19:41 +00:00
Anders Carlsson 6cabf318c9 Change all InitializedEntity pointers over to be references.
llvm-svn: 94335
2010-01-23 23:23:01 +00:00
Anders Carlsson 3fa93b7e54 Start passing InitializedEntity to CheckDesignatedInitializer.
llvm-svn: 94334
2010-01-23 22:49:02 +00:00
John McCall f9b528c7cf Preserve access for enum constants during template instantiation.
llvm-svn: 94333
2010-01-23 22:37:59 +00:00
Anders Carlsson dbb25a38b9 More init work, adding more entity parameters.
llvm-svn: 94332
2010-01-23 20:47:59 +00:00
Anders Carlsson 73eb7cd351 Use the new init code for member subobjects.
llvm-svn: 94329
2010-01-23 20:20:40 +00:00
Anders Carlsson 0cf999b663 Switch some array initialization over to the new init code.
llvm-svn: 94327
2010-01-23 20:13:41 +00:00
Anders Carlsson d0849254de Baby steps towards migrating the InitListChecker over to the new initialization code. Pass an InitializedEntity pointer through to most init checker functions. Right now, it's ignored everywhere except when initializing vectors in C++.
llvm-svn: 94325
2010-01-23 19:55:29 +00:00
Anders Carlsson 3cc795ae8d When an InitializedEntity is passed to CheckSingleInitializer, call the new Sema::PerformCopyInitialization overload.
llvm-svn: 94324
2010-01-23 19:22:30 +00:00
Eli Friedman d6ef69a7db Add bzero builtin; this should help codegen quality for code using this
function.

llvm-svn: 94320
2010-01-23 19:00:10 +00:00
Anders Carlsson 26d0564fd1 Change CheckSingleInitializer to take/return OwningExprResults instead. No functionality change.
llvm-svn: 94316
2010-01-23 18:35:41 +00:00
Benjamin Kramer 12a6ce7cad Simplify code with StringRef.
llvm-svn: 94314
2010-01-23 18:16:35 +00:00
Benjamin Kramer 8f8f405c71 No need to terminate this buffer.
llvm-svn: 94313
2010-01-23 18:16:07 +00:00
John McCall 6d174646dd Produce a special diagnostic when users call a function with an argument of
incomplete type (or a pointer/reference to such).

The causes of this problem are different enough to justify a different "design"
for the diagnostic.  Most notably, it doesn't give an operand index:
it's usually pretty obvious which operand is the problem, it adds a lot of
clutter to mention it, and the fix is usually in a different part of the file
anyway.

This is yet another diagnostic that should really have an analogue in the
non-overloaded case --- which should be much easier to write because of
the weaker space constraints.

llvm-svn: 94303
2010-01-23 08:10:49 +00:00
Anders Carlsson 8e01dcf6f6 Fix the EntityKind order so that all entity kinds that can be copied (using copy constructors) come first. Also, fix a bug where EK_New was left out of the err_init_conversion_failed diagnostic (It is now reported as 'new value'). Please review Doug :)
llvm-svn: 94289
2010-01-23 05:47:27 +00:00
John McCall fe796ddd5a During overload resolution diagnostics, sort non-viable candidates by the quality of their
conversions.  To make this work, fill out all conversions for all candidates
(but only when diagnosing overload failure).  Split out a few cases from
ovl_fail_bad_conversion which didn't actually involve a failed argument
conversion.

I'm pretty sure this is not a well-founded ordering, but I'm not sure it matters.

llvm-svn: 94283
2010-01-23 05:17:32 +00:00
Anders Carlsson ed8d80d72b Separate EK_ArrayOrVectorElement into EK_ArrayElement and EK_VectorElement; arrays and vectors are pretty different beasts in C++. Doug, please review/comment.
llvm-svn: 94279
2010-01-23 04:34:47 +00:00
David Chisnall 481e3a87fe Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.
llvm-svn: 94274
2010-01-23 02:40:42 +00:00
Ted Kremenek 4c0df3dc1d Rename getClangFullVendorVersion() to getClangFullVersion().
llvm-svn: 94273
2010-01-23 02:11:34 +00:00
John McCall 553c0796ee Implement elementary access control.
llvm-svn: 94268
2010-01-23 00:46:32 +00:00
Douglas Gregor aa98ed9a07 Extend clang_createTranslationUnitFromSourceFile() to support creating
translation units that include unsaved files.

llvm-svn: 94258
2010-01-23 00:14:00 +00:00
Fariborz Jahanian 935f041243 outside a method, 'super' should resolve in a normal name look up
to mimic gcc's behavior. Fixes radar 7400691.

llvm-svn: 94246
2010-01-22 23:04:44 +00:00
Ted Kremenek c0f3f72fa4 Add 'clang_getClangVersion()' function to CIndex. This exposes the full Clang version string through the CIndex API.
llvm-svn: 94242
2010-01-22 22:44:15 +00:00
Ted Kremenek 51b8bc93f8 Move version string generation (e.g., "clang 1.1 ...") to libBasic/Version.cpp, getClangFullVendorVersion().
llvm-svn: 94235
2010-01-22 22:29:50 +00:00
Ted Kremenek 18e066f6a9 (1) Rename getClangSubversionRevision() to getClangRevision(), and
have it return a StringRef instead of an integer (to be more VCS
    agnostic).

(2) Add getClangFullRepositoryVersion(), which contains an
    amalgamation of the repository name and the revision.

(3) Change PCH to only emit the string returned by
    getClangFullRepositoryVersion() instead of also emitting the value
    of getClangSubversionRevision() (which has been removed).  This is
    functionally equivalent.

More cleanup to version string generation pending...

llvm-svn: 94231
2010-01-22 22:12:47 +00:00
Fariborz Jahanian 8c6c0b6a1f ui64, etc. are valid VS suffixes.
Fixes radar 7562363.

llvm-svn: 94224
2010-01-22 21:36:53 +00:00
Ted Kremenek 17437130e9 Rename pch::SVN_BRANCH_REVISION to pch::VERSION_CONTROL_BRANCH_REVISION.
llvm-svn: 94214
2010-01-22 20:59:36 +00:00
Ted Kremenek 2377a0e0ea Rename getClangSubversionPath() -> getClangRepositoryPath() and have it return a StringRef.
llvm-svn: 94213
2010-01-22 20:55:35 +00:00
Mike Stump 0a2754ed8a Be sure to select primary bases among the nearly empties in preorder,
not just among the direct bases.  Before we where missing nearly
empties that were bases of virtual base classes.

llvm-svn: 94208
2010-01-22 20:27:17 +00:00
Douglas Gregor 562c1f9365 Teach CIndex's cursor visitor to restrict its traversal to a specific
region of interest (if provided). Implement clang_getCursor() in terms
of this traversal rather than using the Index library; the unified
cursor visitor is more complete, and will be The Way Forward.

Minor other tweaks needed to make this work:
  - Extend Preprocessor::getLocForEndOfToken() to accept an offset
  from the end, making it easy to move to the last character in the
  token (rather than just past the end of the token).
  - In Lexer::MeasureTokenLength(), the length of whitespace is zero.

llvm-svn: 94200
2010-01-22 19:49:59 +00:00
Mike Stump 1f49d65235 Finish off fixing up debug information.
llvm-svn: 94193
2010-01-22 18:48:47 +00:00
Fariborz Jahanian 53967e2abd Patch fixes a lookup bug in c++'s anonymous union member
lookup. Fixes radar 7562438.

llvm-svn: 94191
2010-01-22 18:30:17 +00:00
Anders Carlsson 7caa4cb87a No need to canonicalize the type and use dyn_cast. Also, correctly diagnose trying to override a function returning an lvalue reference with a function overriding an rvalue reference.
llvm-svn: 94183
2010-01-22 17:37:20 +00:00
Douglas Gregor 0599df16a6 Eliminate some Clang warnings
llvm-svn: 94177
2010-01-22 15:41:14 +00:00
Benjamin Kramer d6b28fc6ad Simplify code.
llvm-svn: 94175
2010-01-22 13:59:13 +00:00
Chandler Carruth df7fd5f8d5 Fix an obvious goof that caused us to only see the top level of return types
when checking for covariance. Added some fun test cases, fixes PR6110.

This felt obvious enough to just commit. ;] Let me know if anything needs
tweaking.

llvm-svn: 94173
2010-01-22 13:07:41 +00:00
Mike Stump 9eb76d47f2 Ensure we output all non-virtual base vtables. Fixes PR5890.
llvm-svn: 94163
2010-01-22 06:45:05 +00:00
Zhongxing Xu a1293a67cd Process cast according to the cast kind. Prepare for more specific cast
handling (for C++). No functionality change for now.

llvm-svn: 94153
2010-01-22 04:30:00 +00:00
Daniel Dunbar 7cde09ac8a Driver/Darwin: Update tool chain to use static clang_rt libraries provided by
compiler-rt. This tool chain now works on x86 and ARM, but isn't the x86 default
yet. 

This drastically cleans up the linker invocation, old invocation:
--
"/Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-weak_reference_mismatches" "non-weak" "-o" "a.out" "-lcrt1.10.6.o" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.." "t.o" "-lSystem" "-lgcc"
--

New invocation:
--
# For 10.6:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-o" "a.out" "-lcrt1.10.6.o" "t.o" "-lSystem"
# For 10.4:
 "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.4" "-o" "a.out" "-lcrt1.o" "t.o" "-lSystem" "-lgcc_s.10.4" "/Volumes/Data/ddunbar/llvm.obj.64/Debug/lib/clang/1.1/lib/darwin/libclang_rt.10.4.a"
--

llvm-svn: 94150
2010-01-22 03:38:14 +00:00
Daniel Dunbar 93d7acfcf2 Driver/Darwin/ld: Fix refacto, -force_cpusubtype_ALL should only be forwarded,
not always added.

llvm-svn: 94149
2010-01-22 03:37:33 +00:00
Mike Stump d2808449e4 Update debugging code.
llvm-svn: 94145
2010-01-22 02:51:26 +00:00
Daniel Dunbar dcc3b657f2 Driver/Darwin/ld: Factor out getDarwinArchName, for getting the "Darwin" arch
name being used in an driver invocation.

llvm-svn: 94139
2010-01-22 02:04:58 +00:00
Daniel Dunbar a48823fdbe Driver/Darwin/ld: Eliminate AddDarwinSubArch, our linker invocation is going to
diverge from gcc anyway.

llvm-svn: 94138
2010-01-22 02:04:52 +00:00
Daniel Dunbar 42e3df065e Use raw_ostream instead of cstdio.
llvm-svn: 94136
2010-01-22 02:04:41 +00:00
John McCall f7b2fb51d1 Create function, block, and template parameters in the context of the
translation unit.  This is temporary for function and block parameters;
template parameters can just stay this way, since Templates aren't
DeclContexts.  This gives us the nice property that everything created
in a record DC should have access in C++.

llvm-svn: 94122
2010-01-22 00:28:27 +00:00
Chris Lattner fde85356c6 revert my patch for rdar://7520940 that warns when a published header
is #included with "foo.h" style syntax instead of framework syntax.
It produced too much noise.

llvm-svn: 94120
2010-01-22 00:14:44 +00:00
Mike Stump 6cbe36fe5a Wire up the new range reporting for unreachable code.
llvm-svn: 94118
2010-01-21 23:49:01 +00:00
Mike Stump 60dbeebee8 Improve unreachable code warnings with respect to dead member and
dead array references.

llvm-svn: 94115
2010-01-21 23:15:53 +00:00
Mike Stump fcd6f94ba7 Improve unreachable code warnings for with respect to dead functional casts in C++.
llvm-svn: 94106
2010-01-21 22:12:18 +00:00
Mike Stump d12e495f17 Improve unreachable code warnings for with respect to c-style casts.
llvm-svn: 94094
2010-01-21 19:51:34 +00:00
Mike Stump c18c403670 Improve unreachable code warnings for with respect to ? :.
llvm-svn: 94093
2010-01-21 19:44:04 +00:00
Ted Kremenek 819e873791 Allocate the 'Protocols' array in ObjCInterfaceType and
ObjCObjectPointerType using the allocator associated with ASTContext.
Not only does this fix a memory leak, but it also makes these arrays
BumpPtrAllocated (in the typical case).

llvm-svn: 94090
2010-01-21 19:22:34 +00:00
Fariborz Jahanian da8ec2bc9e Patch to implement rewriting of properties.
Fixes radar 7562952.

llvm-svn: 94087
2010-01-21 17:36:00 +00:00
Mike Stump 14781509fd Improve unreachable code warnings for with respect to compound
assignments.

llvm-svn: 94086
2010-01-21 17:31:41 +00:00
Mike Stump cc3a853df7 Improve unreachable code warnings with respect to dead binary and
unary operators.

llvm-svn: 94084
2010-01-21 17:21:23 +00:00
Daniel Dunbar ae928714df Update to use llvm/utils/GetSourceVersion to detect version number, instead of
assuming SVN. This should be fixed to not necessarily be an integer.

llvm-svn: 94081
2010-01-21 16:56:47 +00:00
Anders Carlsson f768db7775 Move the VTT related code into its own file, CGVTT.cpp
llvm-svn: 94079
2010-01-21 16:50:45 +00:00
Douglas Gregor ff59f676d0 Teach code-completion to deal with calls to functions without prototypes.
llvm-svn: 94076
2010-01-21 15:46:19 +00:00
Mike Stump 04c6851cd6 Speed up compilation by avoiding generating exceptional edges from
CallExprs as those edges help cause a n^2 explosion in the number of
destructor calls.  Other consumers, such as static analysis, that
would like to have more a more complete CFG can select the inclusion
of those edges as CFG build time.

This also fixes up the two compilation users of CFGs to be tolerant of
having or not having those edges.  All catch code is assumed be to
live if we didn't generate the exceptional edges for CallExprs.

llvm-svn: 94074
2010-01-21 15:20:48 +00:00
Mike Stump 0c2ec779cf Move some recent checking code into SemaChecking instead.
llvm-svn: 94067
2010-01-21 03:59:47 +00:00
Mike Stump 87f2f9b465 Avoid instantiating std::sort to save on compiler size.
llvm-svn: 94065
2010-01-21 03:43:13 +00:00
Mike Stump 7df27e7038 When checking for unreachable code, we can trivially avoid checking
for unreachable loops if all the blocks are already marked live by
this point.

llvm-svn: 94064
2010-01-21 03:07:51 +00:00
Mike Stump 02230ab7a6 When checking for unreachable blocks, we can trivially avoid extra
work, if we know we already marked all blocks as live.

llvm-svn: 94063
2010-01-21 02:55:37 +00:00
Mike Stump 6bf1c08e99 Add infrastructure to add base initializers and member initializers to
the CFG.  WIP.

llvm-svn: 94062
2010-01-21 02:21:40 +00:00
Fariborz Jahanian 879cc735fc Fixes comments.
llvm-svn: 94053
2010-01-21 00:08:17 +00:00
Fariborz Jahanian e4951fdc4b Also allow cast of block pointer type to
pointer to an any object. Another variation of
radar 7562285.

llvm-svn: 94052
2010-01-21 00:05:09 +00:00
Devang Patel 3f4a77e082 A Decl->getName() is not unique. However, the debug info descriptors
are uniqued. The debug info descriptor describing record's context is
necessary to keep two Decl's descriptor unique if their name match.

There is more work to do to create descriptors for DeclContext. 
As a temp. step use type's name in FwdDecl.

llvm-svn: 94050
2010-01-20 23:56:40 +00:00
Fariborz Jahanian 4efdec0677 In objective-c++ land, a block pointer is another object pointer.
So, casting a generic object pointer ('id' or 'Class') to the
block pointer is allowed. Fixes radar 7562285.

llvm-svn: 94045
2010-01-20 22:54:38 +00:00
John McCall 401982f56c First pass at collecting access-specifier information along inheritance paths.
Triggers lots of assertions about missing access information;  fix them.

Will actually consume this information soon.

llvm-svn: 94038
2010-01-20 21:53:11 +00:00
Fariborz Jahanian 4f8a57112f Settled rule on warning on unimplemented property in
category implementation when some implementations
are missing in the primary class implementation.
(fixes radar 6505200).

llvm-svn: 94014
2010-01-20 19:36:21 +00:00
Chris Lattner 6a89c50e23 reduce redundant are's
llvm-svn: 94009
2010-01-20 17:53:58 +00:00
Fariborz Jahanian b36606aa71 Improve performance of warning when not implementing a required
property of a protocol (my previous patch). No change in functionality.
(radar 7544809).

llvm-svn: 94005
2010-01-20 17:27:59 +00:00
Benjamin Kramer 9c22cc800f Make some helper functions static.
llvm-svn: 94004
2010-01-20 16:21:40 +00:00
Benjamin Kramer c1a62aa67d Don't store a Twine temporary, it's unsafe.
llvm-svn: 94003
2010-01-20 16:18:11 +00:00
Zhongxing Xu eb76a85af0 Correct comments.
llvm-svn: 93999
2010-01-20 07:57:45 +00:00
Chandler Carruth 26b29a0892 Move the MacroBuilder utilitiy to its own header. Update references.
Comments and/or improvements to the documentation are welcome.

llvm-svn: 93982
2010-01-20 06:13:02 +00:00
Daniel Dunbar 415763612a Fix an invalid Twine use spotty by abbeyj, it isn't safe to use Twine
temporaries (this is one reason I'm nervous about propagating their use beyond
particularly performance critical places).

llvm-svn: 93981
2010-01-20 06:09:53 +00:00
Chandler Carruth 5b6d9265ba Actually remove the include that r93974 made unnecessary.
llvm-svn: 93975
2010-01-20 04:09:11 +00:00
Zhongxing Xu 00c6046a81 Add a missing case for DeclContext printer.
llvm-svn: 93973
2010-01-20 03:21:28 +00:00
Daniel Dunbar 3f3e2cd820 Driver: Lift clang resource directory computation to the Driver object.
llvm-svn: 93971
2010-01-20 02:35:16 +00:00
Daniel Dunbar e2b661c26c clang/Darwin: Update for rename of 10.4 static runtime library.
llvm-svn: 93970
2010-01-20 02:35:02 +00:00
Mike Stump 06c1d87d14 Also handle CXXConstructor, CXXDestructor and CXXConversion in CFG
printing.

llvm-svn: 93968
2010-01-20 02:28:05 +00:00
Mike Stump 281d6d7745 Use the llvm coding convention for indentation for switch.
llvm-svn: 93966
2010-01-20 02:03:14 +00:00
Fariborz Jahanian 98609b3a07 Patch to implement required warnings for unimplemented
properties imported frfom protocol. Fixes radar 7544809.

llvm-svn: 93965
2010-01-20 01:51:55 +00:00
Mike Stump 845384a938 Wire up the EH context for the catch clauses to the outer EH context. WIP.
llvm-svn: 93963
2010-01-20 01:30:58 +00:00
Mike Stump 0bdba6cdd8 Add an exceptional edge from the try terminated block to the outer EH
context (try or the Exit block) when there isn't a catch (...).

Improve CFG printing for catch (...).

llvm-svn: 93962
2010-01-20 01:15:34 +00:00
John McCall ad371258aa Give UnresolvedSet the ability to store access specifiers for each declaration.
Change LookupResult to use UnresolvedSet.  Also extract UnresolvedSet into its
own header and make it templated over an inline capacity.

llvm-svn: 93959
2010-01-20 00:46:10 +00:00
Mike Stump 06b602e540 Improve CheckFallThrough analysis in the presense of the new C++ EH
support.  WIP.

llvm-svn: 93956
2010-01-20 00:34:04 +00:00
Chris Lattner e87668db26 add support for Fedora 10 x86_64, there really should be a better way to handle this.
patch by Dmitry

llvm-svn: 93948
2010-01-19 23:30:00 +00:00
Mike Stump 314825bc8a Implement goto inside of blocks.
llvm-svn: 93945
2010-01-19 23:08:01 +00:00
Eric Christopher 99469702a3 Update and move around comments.
llvm-svn: 93942
2010-01-19 22:58:35 +00:00
John McCall 5d7aa7fa0a The type of a compound literal expression is not necessarily the same as the
type which was syntactically written.  Fixes PR 6080.

llvm-svn: 93933
2010-01-19 22:33:45 +00:00
Mike Stump 92244b00c7 Add CFG support for the start and end of scopes and infrastructure for
implicit destructor calls.  WIP.

llvm-svn: 93922
2010-01-19 22:00:14 +00:00
Fariborz Jahanian f3b9b9583e Rewriteing of gnu extension __typeof in objective-c rewriter.
Fixes radar 6358225.

llvm-svn: 93917
2010-01-19 21:48:35 +00:00
Daniel Dunbar 3858ec4720 Don't try to build/install/clean compiler-rt stuff if it isn't in the projects directory.
llvm-svn: 93914
2010-01-19 21:28:04 +00:00
Daniel Dunbar 3779e1f49a Initial cut at integrating compiler-rt (on Darwin) w/ clang build.
- compiler-rt should be checked out into $LLVM_SRC_ROOT/projects/compiler-rt.

 - On Darwin, this will automatically build the runtime libraries clang needs
   into $OBJROOT/lib/clang/<version>/darwin/...

 - The mechanism can easily support other platforms, and can eventually support
   multiple platforms once clang has some kind of configure process (for
   specifying the desired targets).

 - Feedback on the approach is welcome.

llvm-svn: 93910
2010-01-19 21:12:58 +00:00
Ted Kremenek 60983dc3ad Tighten code and rework indentation of some if() branches (for readability). No functionality change.
llvm-svn: 93904
2010-01-19 20:52:05 +00:00
Ted Kremenek 1362b8bbe6 Remove extra space in uses of 'assert()'.
llvm-svn: 93903
2010-01-19 20:46:35 +00:00
Ted Kremenek b27378c82f Re-alphabetize cases in switch statement.
llvm-svn: 93902
2010-01-19 20:40:33 +00:00
Douglas Gregor 6b8232ff82 Eliminate cursor kinds used to express definitions. Instead, provide
CIndex functions that (1) map from a reference or declaration to the
corresponding definition, if available, and (2) determine whether a
given declaration cursor is also a definition. This eliminates a lot
of duplication in the cursor kinds, and maps more closely to the Clang
ASTs.

This is another API + ABI breaker with no deprecation. Yay, progress.

llvm-svn: 93893
2010-01-19 19:34:47 +00:00
Fariborz Jahanian c1d2fa5d48 Issue diagnostics (instead of crashing in code gen) when using
property dot-syntax notation to use setter/getters in objective-c. 
Fixes radar 7553050.

llvm-svn: 93883
2010-01-19 17:48:02 +00:00
Benjamin Kramer fb5f40f959 Avoid an instantiation of std::sort.
llvm-svn: 93882
2010-01-19 17:42:20 +00:00
Douglas Gregor 9abe2377e7 Teach Sema::ActOnDependentTemplateName that a dependent template name
in a member access expression referring into the current instantiation
need not be resolved at template definition *if* the current
instantiation has any dependent base classes. Fixes PR6081.

llvm-svn: 93877
2010-01-19 16:01:07 +00:00
Zhongxing Xu cd17954dbe Fix a serious bug: Tmp3 is the wrong destination set. We should create a new
intermediate destination set Tmp4.

llvm-svn: 93873
2010-01-19 09:25:53 +00:00
Douglas Gregor a3b624aa55 In a mem-initializer, a nested-name-specifier followed by an
identifier always names a type. In the case of a dependent
nested-name-specifier, build a TypenameType to describe the dependent
base type. I'd like to move more of this behavior up into the parser,
but this fixes PR6062.

llvm-svn: 93871
2010-01-19 06:46:48 +00:00
Douglas Gregor 5204248f96 When looking up enumerator names for redeclaration, use the
ForRedeclaration flag so that we don't look into base classes. 
Fixes PR6061.

llvm-svn: 93862
2010-01-19 06:06:57 +00:00
Mike Stump bbf5ba66a9 Add try/catch CFG support. Also improve throw CFG support. WIP.
llvm-svn: 93840
2010-01-19 02:20:09 +00:00
Devang Patel 5e1a83c196 Emit human readable names for operators.
llvm-svn: 93837
2010-01-19 02:02:11 +00:00
Devang Patel 7a12ad0dc1 First cut at emitting debugging information for C++ member functions.
There is lot more work to do in this area.

llvm-svn: 93836
2010-01-19 01:54:44 +00:00
Ted Kremenek bb1110a7ae Fix possible memory leak by using an OwningPtr.
llvm-svn: 93834
2010-01-19 01:29:05 +00:00
Devang Patel 757daca99c Use llvm::Function name as the linkage name, but strip off leading '01' from display name.
llvm-svn: 93822
2010-01-19 00:25:12 +00:00
Devang Patel 889ce76f41 Refactor.
llvm-svn: 93814
2010-01-19 00:00:59 +00:00
Devang Patel ddf6a57f3e llvm::Function name is the linkage name. If it has a '01' as a prefix then probably there is a reason.
llvm-svn: 93808
2010-01-18 23:27:28 +00:00
Fariborz Jahanian 42ffdb32fb Allow conversion of pointer to an objective-c pointer to
a similar pointer. Fixes radar 7552179.

llvm-svn: 93803
2010-01-18 22:59:22 +00:00
Chris Lattner 87d0208c41 allow the HandlerComment callback to push tokens into the
preprocessor.  This could be used by an OpenMP implementation
or something.  Patch by Abramo Bagnara!

llvm-svn: 93795
2010-01-18 22:35:47 +00:00
Chris Lattner f406b2402d simplify the code for skipping in a #if 0 block. The CurLexer
pointer is always non-null because the PTH case exits earlier
in the method.

llvm-svn: 93794
2010-01-18 22:33:01 +00:00
Douglas Gregor c35b54396c float, double, and long double do need extra data in the
BuiltinTypeLoc structure. Thanks, Enea!

llvm-svn: 93763
2010-01-18 20:37:56 +00:00
John McCall e15bbff98d Preserve type source information in compound literal expressions.
Patch by Enea Zaffanella!

llvm-svn: 93752
2010-01-18 19:35:47 +00:00
Douglas Gregor 9a48db1659 Print fix-it hints properly around tabs, from Christian Adåker!
llvm-svn: 93750
2010-01-18 19:28:01 +00:00
Daniel Dunbar 6bc5be24fa Remove ../libexec from clang program search path, clang-cc is dead.
llvm-svn: 93749
2010-01-18 19:16:53 +00:00
Fariborz Jahanian cdb8575c9b Mostly renaming some methods and updating comments to
reflect what these methods are actually doing. One method
template for future work. No change in functionality.

llvm-svn: 93742
2010-01-18 18:41:16 +00:00
Douglas Gregor c9b7a59b30 Improve source-location information for builtin TypeLocs, from Enea
Zaffanella (with a couple of my tweaks).

llvm-svn: 93733
2010-01-18 18:04:31 +00:00
Douglas Gregor 8c94086c90 Encoding calling conventions in the type system, from Charles Davis!
llvm-svn: 93726
2010-01-18 17:14:39 +00:00
Anders Carlsson 07894e8a0e More VTT builder fixes. With these fixes we now correctly handle the very complex VTT example from the Itanium ABI spec.
llvm-svn: 93725
2010-01-18 17:13:59 +00:00
Zhongxing Xu 228b0d4def Add support for computing size in elements for symbolic regions obtained from
malloc().

llvm-svn: 93722
2010-01-18 08:54:31 +00:00
Anders Carlsson 3d1a09552c Move some common code into BuildVTT.
llvm-svn: 93710
2010-01-18 04:45:46 +00:00
Anders Carlsson 1af3df854f Fix a bunch of VTT layout bugs, add simple tests for VTT layout.
llvm-svn: 93709
2010-01-18 04:25:18 +00:00
Zhongxing Xu e2bdb9a6e2 If the symbol has not been tracked, do not free it. This is possible when free
is called on a pointer that does not get its value directly from malloc.

llvm-svn: 93706
2010-01-18 03:27:34 +00:00
Anders Carlsson 827b245fd6 Minor VTT builder cleanup, no functionality change.
llvm-svn: 93696
2010-01-17 23:53:20 +00:00
Anders Carlsson 42f1376f35 Get the ctor vtable address points directly from the VTT builder.
llvm-svn: 93681
2010-01-17 17:10:44 +00:00
Nuno Lopes 28b40ddbe8 PR6055: fix FreeBSD c++ include path. patch by Roman Divacky
llvm-svn: 93668
2010-01-17 00:00:11 +00:00
Douglas Gregor 7f792cf329 Introduce a second queue of "local" pending implicit instantiation,
which are instantiations of the member functions of local
classes. These implicit instantiations have to occur at the same time
as---and in the same local instantiation scope as---the enclosing
function, since the member functions of the local class can refer to
locals within the enclosing function. This should really, really fix PR5764.

llvm-svn: 93666
2010-01-16 22:29:39 +00:00
Sam Weinig d01101e2d7 Add PCH support for CXXStaticCastExpr, CXXDynamicCastExpr, CXXReinterpretCastExpr, CXXConstCastExpr and CXXFunctionalCastExpr.
llvm-svn: 93658
2010-01-16 21:21:01 +00:00
Douglas Gregor edf8f39003 While determining when to parse inline member functions of a class,
distinguish between nested classes (whose member functions cannot be
parsed until the innermost non-nested class is complete) and local
classes (that are defined within a function but are not necessarily
nested). The upshot of this change, which fixes PR5764, is that the
bodies of member functions of local (non-nested) classes need to be
parsed when the local class is complete (and no later), since they may
refer to function-local static variables, typedefs, enums, etc.

llvm-svn: 93653
2010-01-16 20:52:59 +00:00
Douglas Gregor f5974fa0d5 When we are instantiating a member function of a local class, be sure
to merge the local instantiation scope with the outer local
instantiation scope, so that we can instantiate declarations from the
function owning the local class. Fixes an assert while instantiating
Boost.MPL's BOOST_MPL_ASSERT_MSG.

llvm-svn: 93651
2010-01-16 20:21:20 +00:00
Fariborz Jahanian faf85c0dbe Fix a rewriting crash and correct rewriting of __block
declaration where its initializer has a type-cast.

llvm-svn: 93650
2010-01-16 19:36:43 +00:00
Douglas Gregor e1ad8a105a Partial fix for PR6022, where we were complaining when a friend
function template declared within a class template did not match a
function in another scope. We really need to rework how
friends-in-templates are semantically checked.

llvm-svn: 93642
2010-01-16 18:09:52 +00:00
Douglas Gregor 071676f422 Improve location information for Objective-C category declarations. We
previously only had a single location (the @ in @interface); now we
know where the @ is (for the start of the declaration), where the
class name is (that's the normal "location" now for diagnostics), and
where the category name is. Also, eliminated the redundant "end"
location, since ObjCContainerDecl already has better @end information.

The only XFAIL'd test is temporary; will un-XFAIL-it once I've taught
CIndex how to use the new locations.

llvm-svn: 93639
2010-01-16 16:38:58 +00:00
Douglas Gregor 002b671055 Keep track of the source locations for each protocol reference in
Objective-C classes, protocol definitions, forward protocol
declarations, and categories. This information isn't actually used
yet; that's coming next.

llvm-svn: 93636
2010-01-16 15:02:53 +00:00
John McCall 982adb518c Fix a use of uninitialized memory in overload diagnostics.
llvm-svn: 93629
2010-01-16 03:50:16 +00:00
Tanya Lattner dbfd16014a Add codgen for BI__builtin_llvm_memory_barrier.
llvm-svn: 93611
2010-01-16 01:21:14 +00:00
Eli Friedman 8fdc2cb46a Fix crash generating debug info for constructor for anonymous struct.
llvm-svn: 93601
2010-01-16 00:43:13 +00:00
Eli Friedman 1fcf66b0dd Make the AST explicitly represent the cast of the first operand of a
pointer-to-member operator.

llvm-svn: 93592
2010-01-16 00:00:48 +00:00
Mike Stump ea409449aa Generalize handling for unreachable code warnings to all binary operators.
llvm-svn: 93584
2010-01-15 23:33:51 +00:00
John McCall 3712d9e391 Candidates with arity mismatches are extra-special non-viable and need to
stand at the back of the line.

Thanks to Oliver Hunt for reminding me to do this.

llvm-svn: 93583
2010-01-15 23:32:50 +00:00
Mike Stump d4d6fb3374 Refine location reporting for unreachable code warnings for comma expressions.
llvm-svn: 93574
2010-01-15 23:17:13 +00:00
Fariborz Jahanian f0462ff691 define __weak to null in rewritten source for
-fms-extensions as well.

llvm-svn: 93569
2010-01-15 22:29:39 +00:00
John McCall 7fe6e9c2f1 Make LookupResult::resolveKind() robust against NotFoundInCurrentInstantiation.
Fixes PR 6049.

llvm-svn: 93557
2010-01-15 21:27:01 +00:00
Eli Friedman cab014721b Fix a couple bugs in copy assignment operator synthesis.
llvm-svn: 93546
2010-01-15 20:06:11 +00:00
Douglas Gregor 082c3e69eb Add -cursor-at=file:line:column command line option to c-index-test,
to directly check the results of clang_getCursor(). Also, start
migrating some index-test tests over to c-index test [*] and some
grep-using tests over to FileCheck.

llvm-svn: 93537
2010-01-15 19:40:17 +00:00
John McCall d377e04489 Preserve type source information for C++ named casts through template
instantiation.

llvm-svn: 93533
2010-01-15 19:13:16 +00:00
John McCall ebe5474148 Don't lose type source information when rebuilding C-style cast expressions.
Also we don't need to recheck for altivec initializers, I think.

llvm-svn: 93529
2010-01-15 18:56:44 +00:00
John McCall 9751396d70 Preserve type source information in explicit cast expressions.
Patch by Enea Zaffanella.

llvm-svn: 93522
2010-01-15 18:39:57 +00:00
Fariborz Jahanian 5c26eeefdd Do not do the block-specific rewrite when there is no block literals.
Fixes radar 7546096.

llvm-svn: 93519
2010-01-15 18:14:52 +00:00
Douglas Gregor 5fcb51c09c When determining whether a DeclRefExpr is value-dependent when it
references a const variable of integral type, the initializer may be
in a different declaration than the one that name-lookup saw. Find the
initializer anyway. Fixes PR6045.

llvm-svn: 93514
2010-01-15 16:21:02 +00:00
Douglas Gregor 27b174f4c3 When determining whether the type is the current instantiation, strip
qualifiers. Fixes PR6021.

llvm-svn: 93513
2010-01-15 16:05:33 +00:00
Ken Dyck 02990837ad Convert the type of the LValue offset variable in APValue to CharUnits, moving
the LValue-related methods of APValue out of line to avoid header file leaching.

llvm-svn: 93512
2010-01-15 12:37:54 +00:00
John McCall 38836f0f39 Don't repeat lookup when instantiating resolved member expressions.
Adjust BuildMemberReferenceExpr to perform the inheritance check on implicit
member accesses, which can arise from unqualified lookups and therefore may
reference decls from enclosing class scopes.

Fixes PR 5838.

llvm-svn: 93510
2010-01-15 08:34:02 +00:00
Ted Kremenek abf6ba1612 Don't suggest the developer use 'arc4random' instead of 'rand' when that function is not available. Fixes PR 6012.
llvm-svn: 93508
2010-01-15 08:20:31 +00:00
Ted Kremenek d74cc397c8 Teach BugReporter to "escape" the occurance of '%' characters in diagnostic messages when emitted results to the standard Diagnostics output. Fixes PR 6033.
llvm-svn: 93507
2010-01-15 07:56:51 +00:00
Ted Kremenek 959990b840 Convert a few more uses of std::string& to llvm::StringRef.
llvm-svn: 93506
2010-01-15 07:43:59 +00:00
Mike Stump 6a11229dc8 Refine unreachable warnings. WIP.
llvm-svn: 93500
2010-01-15 02:06:42 +00:00
Douglas Gregor d0d2ee0e4b When performing qualified name lookup into the current instantiation,
do not look into base classes if there are any dependent base
classes. Instead, note in the lookup result that we couldn't look into
any dependent bases. Use that new result kind to detect when this case
occurs, so that we can fall back to treating the type/value/etc. as a
member of an unknown specialization.

Fixes an issue where we were resolving lookup at template definition
time and then missing an ambiguity at template instantiation time.

llvm-svn: 93497
2010-01-15 01:44:47 +00:00
Fariborz Jahanian 195ac2dfab Patch to avoid duplicate declaration of byref structs
for __block variables of same name declared in multiple scopes.
Fixes radar 7540194

llvm-svn: 93474
2010-01-14 23:05:52 +00:00
Devang Patel 2d63010a9c Emit linkage name even if it matches regular name. The code generator uses linkage name to find subprogram entry for the current function.
llvm-svn: 93461
2010-01-14 21:46:57 +00:00
Chris Lattner 0b534d5969 fix grammaro
llvm-svn: 93452
2010-01-14 21:00:58 +00:00
Anton Korobeynikov 6bedbf1039 long long is 64 bits on msp430
llvm-svn: 93451
2010-01-14 20:22:45 +00:00
John McCall 8cb7a8a39c Pre-emptive bugfixes in the diagnostics code: allow arbitrary punctuation
characters to be escaped and implement a scan-forward function which
properly respects brace nesting.

llvm-svn: 93447
2010-01-14 20:11:39 +00:00
Douglas Gregor 04b1152aac After dyn_cast'ing, it generally makes sense to check the *output* of
the dyn_cast against NULL rather than the *input*. Fixes PR6025.

llvm-svn: 93435
2010-01-14 18:13:22 +00:00
Devang Patel ea84f59f5c Add comment.
llvm-svn: 93434
2010-01-14 18:06:13 +00:00
Douglas Gregor d2e6a45722 When qualified lookup into the current instantiation fails (because it
finds nothing), and the current instantiation has dependent base
classes, treat the qualified lookup as if it referred to an unknown
specialization. Fixes PR6031.

llvm-svn: 93433
2010-01-14 17:47:39 +00:00
Douglas Gregor fc59ce1ea4 Switch a few callers of MaybeAddResult over to AddResult, when the
declarations we're adding do not need any name-hiding checks.

llvm-svn: 93431
2010-01-14 16:14:35 +00:00
Douglas Gregor 2b8162b7d0 Switch code-completion's ivar lookup over to LookupVisibleDecls,
eliminating yet one more ResultBuilder::MaybeAddResult caller.

llvm-svn: 93430
2010-01-14 16:08:12 +00:00
Douglas Gregor 78a210145b Start migrating code-completion results from
ResultBuilder::MaybeAddResult over to ResultBuilder::AddResult.

llvm-svn: 93429
2010-01-14 16:01:26 +00:00
Douglas Gregor 09bbc651f4 Switch the remaining code completions over to LookupVisibleDecls,
after adding the ability to determine whether our lookup is a
base-class lookup. Eliminate CollectMemberLookupResults, since it is
no longer used (yay).

llvm-svn: 93428
2010-01-14 15:47:35 +00:00
David Chisnall 035ead209f Made ObjC method name mangling match GCC (which does it in a stupid and broken way that can give conflicts on method names containing underscores, but is needed for gdb to work because gdb does not know how to read ObjC class tables and relies on the mangling).
llvm-svn: 93427
2010-01-14 14:08:19 +00:00
Zhongxing Xu 803ade2532 Fix pr6035.
llvm-svn: 93422
2010-01-14 03:45:06 +00:00
Douglas Gregor 200c99dd1e Move code completion for qualified name lookup (foo::) to
LookupVisibleDecls. Also, a function does not hide another function.

llvm-svn: 93421
2010-01-14 03:35:48 +00:00
John McCall 4700099719 Improve overload diagnostics some more by calling out qualifier mismatches
for special diagnostics.  Unfortunately, the non-overload diagnostics are not
this good.

llvm-svn: 93420
2010-01-14 03:28:57 +00:00
Douglas Gregor a6e2edcc3a Eliminate the code-completion-specifier CollectLookupResults in favor
of the more general LookupVisibleDecls.

llvm-svn: 93419
2010-01-14 03:27:13 +00:00
Douglas Gregor 6ae4c5278c Simplify the code-completion logic for nested-name-specifiers: rather
than traversing visible declarations twice, only perform one traversal
and recognize nested-name-specifiers as special.

llvm-svn: 93418
2010-01-14 03:21:49 +00:00
Mike Stump 0a7d9305f1 Don't assume a random access iterator, instead just use CFG::iterator.
Thanks Ted.

llvm-svn: 93413
2010-01-14 02:45:29 +00:00
Anders Carlsson 5f9a881e1e Store the address points for constructor vtables directly in the VTT builder, because that's the only time they're needed.
llvm-svn: 93412
2010-01-14 02:29:07 +00:00
Mike Stump 29ce3a3114 Avoid snowballing errors into additional warnings. To do better, we'd
need an error term for the CFG.  I suspect we'll always have to cope
with getCFG returning 0, though, I'd love to see even that possibility
removed.

llvm-svn: 93411
2010-01-14 02:26:52 +00:00
Anders Carlsson 2a4adbea96 Add a DenseMapInfo specialization for BaseSubobject.
llvm-svn: 93399
2010-01-14 01:39:42 +00:00
Douglas Gregor 69a8e083c5 When providing completions for a member access expression in C++,
provided nested-name-specifier results for base classes (only), rather
than everything that could possibly be a nested-name-specifier.

llvm-svn: 93398
2010-01-14 01:17:14 +00:00
Douglas Gregor c580c5205f Switch code-completion for ordinary names over to the new(ish)
LookupVisibleDecls, unifying the name lookup mechanisms used by code
completion and typo correction. Aside from the software-engineering
improvements, this makes code-completion see through using directives
and see ivars when performing unqualified name lookup in an
Objective-C instance method.

llvm-svn: 93397
2010-01-14 01:09:38 +00:00