Commit Graph

22501 Commits

Author SHA1 Message Date
John McCall 0b66eb38c7 It turns out that basically every caller to RequireCompleteDeclContext
already knows what context it's looking in.  Just pass that context in
instead of (questionably) recalculating it.

llvm-svn: 102818
2010-05-01 00:40:08 +00:00
Daniel Dunbar 832fc4a098 Fix NON_ANSI_COMPILE_FLAGS setting, for MSVC.
llvm-svn: 102811
2010-05-01 00:06:42 +00:00
Ted Kremenek bc1416dcad Add null check in CFGBuilder::VisitStmt() to make CFG construction
more resilient to bad code.

llvm-svn: 102793
2010-04-30 22:25:53 +00:00
Daniel Dunbar d5a2a073a0 Rename 'CIndex' to 'libclang', since it has basically become our stable public
(C) API, and will likely grow further in this direction in the future.

llvm-svn: 102779
2010-04-30 21:51:10 +00:00
Ted Kremenek b802192a7e Don't perform AnalysisBasedWarnings in Sema or run the static analyzer when a
fatal error has occurred.

llvm-svn: 102778
2010-04-30 21:49:25 +00:00
Douglas Gregor fabf95d066 After substituting a template argument for a non-type template
parameter with pointer-to-member type, we may have to perform a
qualification conversion, since the pointee type of the parameter
might be more qualified than the pointee type of the argument we form
from the declaration. Fixes PR6986.

llvm-svn: 102777
2010-04-30 21:46:38 +00:00
John McCall 4d4dcc8ed7 When synthesizing Objective C records, give the synthetic fields public
access.  Fixes an assertion.

Fixes rdar://problem/7927811.  Too lazy to reduce a test case.

llvm-svn: 102776
2010-04-30 21:35:41 +00:00
Douglas Gregor 0be628ff64 Fix a thinko that caused us not to compute __builtin_offset as a
constant expression in C. 

llvm-svn: 102762
2010-04-30 20:35:01 +00:00
Douglas Gregor 0925fbc3fd Teach clang_getLocation() to cope with a NULL file argument.
llvm-svn: 102748
2010-04-30 19:45:53 +00:00
Anders Carlsson d6c5391cd9 Remove an unnecessary parameter from EmitClassCopyAssignment.
llvm-svn: 102747
2010-04-30 19:45:28 +00:00
Douglas Gregor 14cf752486 Clean up our handling of local instantiation scopes, which keep track
of the mapping from local declarations to their instantiated
counterparts during template instantiation. Previously, we tried to do
some unholy merging of local instantiation scopes that involved
storing a single hash table along with an "undo" list on the
side... which was ugly, and never handled function parameters
properly.

Now, we just keep separate hash tables for each local instantiation
scope, and "combining" two scopes means that we'll look in each of the
combined hash tables. The combined scope stack is rarely deep, and
this makes it easy to avoid the "undo" issues we were hitting. Also,
I've simplified the logic for function parameters: if we're declaring
a function and we need the function parameters to live longer, we just
push them back into the local instantiation scope where we need them. 

Fixes PR6990.

llvm-svn: 102732
2010-04-30 18:55:50 +00:00
Daniel Dunbar 9f84c7b600 Move include installation steps to better location, inside each include dir instead of at the top-level.
Also, don't set NO_INSTALL=1 for c-index-test.

llvm-svn: 102724
2010-04-30 17:59:38 +00:00
David Chisnall d6a6af6a53 Fixed incorrect type of alloca (GNU runtime).
llvm-svn: 102711
2010-04-30 13:36:12 +00:00
Abramo Bagnara 5009937f47 Add calling convention related attributes to related declaration. Mark attributes invalid on type related checking so to add them to declarations only when everything is ok.
llvm-svn: 102710
2010-04-30 13:10:51 +00:00
Abramo Bagnara b639ab9ffc Attribute noreturn is now put in declaration attributes. Fixed a double warning generation.
llvm-svn: 102705
2010-04-30 09:13:03 +00:00
John McCall 5af1aa6393 An edge from a call expression to the exit block is only an abnormal edge
if *none* of the successors of the call expression is the exit block.
This matters when a call of bool type is the condition of (say) a while
loop in a function with no statements after the loop.  This *can* happen
in C, but it's much more common in C++ because of overloaded operators.

Suppresses some substantial number of spurious -Wmissing-noreturn warnings.

llvm-svn: 102696
2010-04-30 07:10:06 +00:00
Douglas Gregor 8b895228d9 Fix ADL for types declared in transparent decls, from Alp Toker!
llvm-svn: 102695
2010-04-30 07:08:38 +00:00
Douglas Gregor 407e961645 Introduce a sequence number into class template partial
specializations, which keeps track of the order in which they were
originally declared. We use this number so that we can always walk the
list of partial specializations in a predictable order during matching
or template instantiation. This also fixes a failure in Boost.Proto,
where SourceManager::isBeforeInTranslationUnit was behaving
poorly in inconsistent ways.

llvm-svn: 102693
2010-04-30 05:56:50 +00:00
John McCall b3cec96a7c Account for the VTT argument when making an implicit copy constructor for
a class with virtual bases.  Just a patch until Sema starts (correctly) doing
most of this analysis.

Fixes PR 6622.

llvm-svn: 102692
2010-04-30 05:56:45 +00:00
Douglas Gregor 1e13c5a8fb When we start the definition of a class template, set the
InjectedClassNameType's Decl to point at the definition. It's a little
messy, but we do the same thing with classes and their record types,
since much of Clang expects that the TagDecl* one gets out of a type
is the definition. Fixes several Boost.Proto failures.

llvm-svn: 102691
2010-04-30 04:39:27 +00:00
Zhongxing Xu 526f504f06 Remove unused trait.
llvm-svn: 102690
2010-04-30 04:17:33 +00:00
Zhongxing Xu 685a1d818d Refactor the AnalysisConsumer to analyze functions after the whole
translation unit is parsed. This enables us to inline some calls when still
analyzing one function at a time.

Actions are classified into Function, CXXMethod, ObjCMethod, 
ObjCImplementation.

This does not hurt performance much. The analysis time for sqlite3.c:

before:
real    17m52.440s
user    17m49.460s
sys    0m2.010s

after:
real    18m0.500s
user    17m56.900s
sys    0m2.330s

DisplayProgress option is broken now. -inine-call action is removed. It
will be reenabled in another form, perhaps as an indenpendant option.

llvm-svn: 102689
2010-04-30 04:14:20 +00:00
John McCall e7db86ddb0 Fix a tentative-parse error with unqualified template ids in cast expressions.
Also resolve a long-working FIXME in the test case I modified.

llvm-svn: 102688
2010-04-30 03:11:01 +00:00
Douglas Gregor dead00f902 Fix pasto in this test
llvm-svn: 102687
2010-04-30 03:07:23 +00:00
Douglas Gregor 6602c25c0c Add Clang version inspection macros. Fixes PR6681.
llvm-svn: 102686
2010-04-30 02:51:06 +00:00
John McCall 48bf349471 Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTI
when used by the exceptions routines.  Fixes PR 6974.

llvm-svn: 102684
2010-04-30 01:15:21 +00:00
Nate Begeman 4a623eed26 logical ops, unary ops, pairwise ops
llvm-svn: 102681
2010-04-30 00:46:57 +00:00
John McCall dac3ea6e8d Teach EHCleanupBlock to deal appropriately with the possibility that there
might not have been an insertion block set at start.  Fixes PR6975.

llvm-svn: 102677
2010-04-30 00:06:43 +00:00
Anders Carlsson 786a3d910e Get the base class addresses before calling EmitClassCopyAssignment.
llvm-svn: 102676
2010-04-30 00:04:01 +00:00
Anders Carlsson 2b4ec8d003 Remove an unnecessary argument to EmitClassCopyAssignment.
llvm-svn: 102674
2010-04-29 23:51:42 +00:00
John McCall 99b2fe5f54 Rebuild the nested name specifiers in member-pointer declarator chunks when
entering the current instantiation.  Set up a little to preserve type location
information for typename types while we're in there.

Fixes a Boost failure.

llvm-svn: 102673
2010-04-29 23:50:39 +00:00
Nate Begeman 723169d8ec Comparisons.
llvm-svn: 102669
2010-04-29 23:36:09 +00:00
Ted Kremenek d8a23f988d Do not enable '-analyze-check-security-syntactic' by default when using '--analyze'. There
are several known issues to address for it should be turned on by default.

llvm-svn: 102664
2010-04-29 22:50:22 +00:00
Douglas Gregor 980fb16f9a When determining a standard conversion sequence involves resolving the
address of an overloaded function (or function template), perform that
resolution prior to determining the implicit conversion
sequence. This resolution is not part of the implicit conversion
sequence itself.

Previously, we would always consider this resolution to be a
function pointer decay, which was a lie: there might be an explicit &
in the expression, in which case decay should not occur. This caused
the CodeGen assertion in PR6973 (where we created a 
pointer to a pointer to a function when we should have had a pointer
to a function), but it's likely that there are corner cases of
overload resolution where this would have failed.

Cleaned up the code involved in determining the type that will
produced afer resolving the overloaded function reference, and added
an assertion to make sure the result is correct. Fixes PR6973.

llvm-svn: 102650
2010-04-29 18:24:40 +00:00
Fariborz Jahanian 9e1a3af030 Properties cannot be synthesized by-dafult in
categories. Issue usual warnings instead of
confusing error message. Radar 7920807

llvm-svn: 102645
2010-04-29 17:52:18 +00:00
Devang Patel dfcd0661a1 Use clang::VarDecl name instead of llvm::GlobalVariable name.
llvm::GLobalVariable name may not match user visibile name for function static variables.

llvm-svn: 102644
2010-04-29 17:48:37 +00:00
Ted Kremenek 3b9ad93a35 Add USR support for 'static inline' functions (which can be declared in header files).
Add USR support for 'static' functions and local variables, which can be handy for resolving named variables within a translation unit.

llvm-svn: 102641
2010-04-29 17:43:29 +00:00
Ted Kremenek 9825536eea Remove USRGenerator::VisitBlockDecl(). We don't need to generate USRs for blocks, since
they have no linkage and by definition are anonymous.

llvm-svn: 102640
2010-04-29 17:43:26 +00:00
Ted Kremenek 772810137a Add test case for __has_feature(objc_weak_class).
llvm-svn: 102639
2010-04-29 17:43:21 +00:00
Nate Begeman 23a2f2ff79 Start stamping out the __builtin_neon stuff.
llvm-svn: 102638
2010-04-29 17:37:19 +00:00
Ted Kremenek 186a074346 Add FunctionDecl::isVariadic() to match BlockDecl::isVariadic() and ObjCMethodDecl::isVariadic().
Do some minor refactoring along the way.

llvm-svn: 102635
2010-04-29 16:49:01 +00:00
Ted Kremenek 8af4f40f4a Rename BlockDecl::IsVariadic() to BlockDecl::isVariadic() to match the casing
for similar methods.  No functionality change.

llvm-svn: 102634
2010-04-29 16:48:58 +00:00
Daniel Dunbar 0c00537583 IRgen/NeXT: Put the synthesized _objc_super, _message_ref_t decls in a valid DeclContext, to satisfy the invariants that should hold on a RecordDecl.
llvm-svn: 102624
2010-04-29 16:29:11 +00:00
Daniel Dunbar 50aa0a528d Remove a FIXME that is unlikely to be fixed (streaming code generation).
llvm-svn: 102623
2010-04-29 16:29:09 +00:00
Daniel Dunbar 117c19fa4d Frontend: Tie backend verification passes to CodeGenOptions::VerifyModule,
instead of NDEBUG.

llvm-svn: 102622
2010-04-29 16:29:06 +00:00
Ted Kremenek bf2de212c6 Bump Clang version number.
llvm-svn: 102614
2010-04-29 15:30:51 +00:00
Douglas Gregor 9225b02096 When performing partial ordering of class template partial
specializations, substitute the deduced template arguments and check
the resulting substitution before concluding that template argument
deduction succeeds. This marvelous little fix makes a bunch of
Boost.Spirit tests start working.

llvm-svn: 102601
2010-04-29 06:31:36 +00:00
Douglas Gregor 684268daab For template argument deduction from class template partial
specializations, separate out the deduction part from the checking and
substitution of the deduced arguments.

llvm-svn: 102600
2010-04-29 06:21:43 +00:00
Mon P Wang 75c645c6d7 A not equal for an unordered relation should return true as specified in IEEE-754, e.g.,
NAN != NAN ? 1 : 0 should return 1.  Also fix the case for complex.

llvm-svn: 102598
2010-04-29 05:53:29 +00:00
Douglas Gregor 33dcc2e34d It turns out that we *can* end up having to display template argument
bindings when the template argument is still an expression; it happens
while checking the template arguments of a class template partial
specializations. Fixes PR6964.

llvm-svn: 102595
2010-04-29 04:55:13 +00:00