Commit Graph

18049 Commits

Author SHA1 Message Date
Chris Lattner 50c3c1316a Inline LocalInstantiationScope::getInstantiationOf into its one
client, making room for future hacking.

llvm-svn: 125770
2011-02-17 19:47:42 +00:00
Chris Lattner 15a776fff7 remove some defensive code: LocalInstantiationScope::getInstantiationOf
and findInstantiationOf can never return null, even on invalid code.

llvm-svn: 125769
2011-02-17 19:38:27 +00:00
Douglas Gregor d6f8124c9c Eliminate the internal command-line option for viewing inheritance in C++ classes, since it's only really worked for the trivial cases anyway due to lame pseudo-parsing of the class name. The viewInheritance() function is still available for use in the debugger, where this is far more useful
llvm-svn: 125762
2011-02-17 19:04:40 +00:00
John McCall e6be5e1c0d Remove the "conditional save" hashtables from IR generation.
llvm-svn: 125761
2011-02-17 19:02:56 +00:00
Douglas Gregor 428d75ffd9 The internal -fdump-record-layouts flag already dumps the layout when it was computed; no need to do so again at the end of the translation unit
llvm-svn: 125760
2011-02-17 18:59:06 +00:00
Argyrios Kyrtzidis 9d5235d527 When building StaticAnalyzer/Frontend add -I "<Checkers build dir>" to allow Checkers.inc to be
included without '..', thus being compatible with build systems of *BSDs.

Patch by Joerg Sonnenberger!

llvm-svn: 125758
2011-02-17 18:40:33 +00:00
Douglas Gregor e5de7013c7 Remove the last virtual member function from the Decl hierarchy,
reducing the size of all declarations by one pointer. For a 64-bit
Clang parsing Cocoa.h, this saves ~630k of memory (about 3.5% of
ASTContext's memory usage for this header).

llvm-svn: 125756
2011-02-17 18:14:32 +00:00
Douglas Gregor b494173c93 Devirtualize TagDecl::completeDefinition().
llvm-svn: 125755
2011-02-17 18:06:05 +00:00
Douglas Gregor fe590dfa84 Devirtualize DeclaratorDecl::getInnerLocStart() and TagDecl::getInnerLocStart().
llvm-svn: 125754
2011-02-17 17:39:40 +00:00
Fariborz Jahanian 5fc74804a6 Improve diagnostics on missing property decl.
llvm-svn: 125752
2011-02-17 17:30:05 +00:00
Douglas Gregor a991f3a4e9 Devirtualize NamedDecl::getNameForDiagnostic().
llvm-svn: 125751
2011-02-17 17:23:19 +00:00
Douglas Gregor 0215459c37 Devirtualize RedeclarableTemplateDecl::newCommon().
llvm-svn: 125750
2011-02-17 17:10:20 +00:00
Chandler Carruth 22c7a79a1d Implement a sub-group of -Wconversion: -Wliteral-conversion. This
specifically targets literals which are implicitly converted, a those
are more often unintended and trivial to fix. This can be especially
helpful for diagnosing what makes 'const int x = 1e6' not an ICE.

Original patch authored by Jim Meehan with contributions from other
Googlers and a few cleanups from myself.

llvm-svn: 125745
2011-02-17 11:05:49 +00:00
John McCall c07a0c7e48 Change the representation of GNU ?: expressions to use a different expression
class and to bind the shared value using OpaqueValueExpr.  This fixes an
unnoticed problem with deserialization of these expressions where the
deserialized form would lose the vital pointer-equality trait;  or rather,
it fixes it because this patch also does the right thing for deserializing
OVEs.

Change OVEs to not be a "temporary object" in the sense that copy elision is
permitted.

This new representation is not totally unawkward to work with, but I think
that's really part and parcel with the semantics we're modelling here.  In
particular, it's much easier to fix things like the copy elision bug and to
make the CFG look right.

I've tried to update the analyzer to deal with this in at least some          
obvious cases, and I think we get a much better CFG out, but the printing
of OpaqueValueExprs probably needs some work.

llvm-svn: 125744
2011-02-17 10:25:35 +00:00
NAKAMURA Takumi 49ddc3646f lib/Frontend/InitHeaderSearch.cpp: Add mingw-w64's include paths.
llvm-svn: 125743
2011-02-17 08:51:47 +00:00
NAKAMURA Takumi 31ea2f14bc Triple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 instead.
No one uses *-mingw64. mingw-w64 is represented as {i686|x86_64}-w64-mingw32.

llvm-svn: 125742
2011-02-17 08:51:38 +00:00
NAKAMURA Takumi 029d74b264 Fix whitespace.
llvm-svn: 125741
2011-02-17 08:50:50 +00:00
Douglas Gregor 133edddd82 Devirtualize Decl::getNextRedeclaration().
llvm-svn: 125740
2011-02-17 08:47:29 +00:00
Chandler Carruth 712563bba4 Implement -Wenum-compare, which warns when comparing two enums of
different types. We omit the warning when the enum types are anonymous.
Unlike GCC, this warning does not distinguish between C++ and C/ObjC for
controling whether it is on by default, it is always on by default.

Original patch contributed by Richard Trieu (@ Google), I fixed some
style issues, and cleaned it up for submission.

llvm-svn: 125739
2011-02-17 08:37:06 +00:00
Douglas Gregor 5ee06f02f9 Simple little optimization to Decl::getCanonicalDecl(), eliminating some heavyweight machinery and indirection that we don't need
llvm-svn: 125737
2011-02-17 08:14:56 +00:00
Douglas Gregor 00716e8bd3 Devirtualize Decl::getSourceRange()
llvm-svn: 125736
2011-02-17 08:12:32 +00:00
Douglas Gregor 7edc20ac24 Devirtualize Decl::getCanonicalDecl().
llvm-svn: 125735
2011-02-17 07:58:36 +00:00
Chris Lattner c8e630e4db Step #1/N of implementing support for __label__: split labels into
LabelDecl and LabelStmt.  There is a 1-1 correspondence between the
two, but this simplifies a bunch of code by itself.  This is because
labels are the only place where we previously had references to random
other statements, causing grief for AST serialization and other stuff.

This does cause one regression (attr(unused) doesn't silence unused
label warnings) which I'll address next.

This does fix some minor bugs:
1. "The only valid attribute " diagnostic was capitalized.
2. Various diagnostics printed as ''labelname'' instead of 'labelname'
3. This reduces duplication of label checking between functions and blocks.

Review appreciated, particularly for the cindex and template bits.

llvm-svn: 125733
2011-02-17 07:39:24 +00:00
Douglas Gregor f7b2c93b2f Devirtualize Decl::getBody() and Decl::hasBody().
llvm-svn: 125731
2011-02-17 07:13:24 +00:00
Douglas Gregor a43942a48e De-virtualize Decl::isOutOfLine().
llvm-svn: 125730
2011-02-17 07:02:32 +00:00
Douglas Gregor b0f2ea9e9e When printing a qualified type, look through a substituted template
parameter type to see what's behind it, so that we don't end up
printing silly things like "float const *" when "const float *" would
make more sense. Also, replace the pile of "isa" tests with a simple
switch enumerating all of the cases, making a few more obvious cases
use prefix qualifiers.

llvm-svn: 125729
2011-02-17 06:52:25 +00:00
Chris Lattner 5a9b1ec94c simplify a bit.
llvm-svn: 125724
2011-02-17 05:38:27 +00:00
Douglas Gregor 230a7e60b1 Improve parser recovery in "for" statements, from Richard Smith!
llvm-svn: 125722
2011-02-17 03:38:46 +00:00
Douglas Gregor 0e5d72f164 I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.
I will not hold on to temporary StringRefs.

llvm-svn: 125718
2011-02-17 03:19:26 +00:00
Douglas Gregor 9c1f1bfedc When Parser::ParseExpressionList isn't given a completer, fall back to
normal "expression" completion. Fixes the most annoying
code-completion bug I've found.

llvm-svn: 125715
2011-02-17 03:09:23 +00:00
Matt Beaumont-Gay 956fc1cb81 Fix PR9025 and add a diagnostic (and sometimes a fixit) for an overloaded
function name used as the base of a member expression. Early feedback from
Chandler Carruth, and code review from Nick Lewycky.

llvm-svn: 125714
2011-02-17 02:54:17 +00:00
Ted Kremenek 378313944f Disable default synthesized properties until we can properly re-evaluate the feature.
llvm-svn: 125708
2011-02-17 02:17:56 +00:00
Chris Lattner 5df2a4e8df fix clang -MM output to escape spaces in filenames. This seems to be
the only character that GCC escapes.  PR9224.

llvm-svn: 125707
2011-02-17 02:14:49 +00:00
Ken Dyck 02ced6fd19 Convert MaxFieldAlignment to CharUnits from bits. No change in functionality
intended.

llvm-svn: 125704
2011-02-17 01:49:42 +00:00
Fariborz Jahanian 05d389f407 Improve diagnostics when property names an object type of
a forward class. // rdar://8851803

llvm-svn: 125699
2011-02-17 01:26:14 +00:00
Douglas Gregor 669a25aec3 Implement code completion results for the Objective-C Key-Value Coding
(KVC) and Key-Value Observing (KVO) protocols.

llvm-svn: 125696
2011-02-17 00:22:45 +00:00
Nick Lewycky 8d2226208d Ensure that the NRVO flag has some block to insert into. Fixes PR9178!
llvm-svn: 125694
2011-02-16 23:59:08 +00:00
Ted Kremenek 197fcd4418 Fix assertion failure in -Warray-bounds on template parameters used as arrays.
llvm-svn: 125693
2011-02-16 23:39:09 +00:00
Fariborz Jahanian 9cd649d376 Block rewriting bug. Don't take address of captured
byref variables again when passing them to inner blocks. 
// rdar://9006279

llvm-svn: 125690
2011-02-16 22:37:10 +00:00
Zhanyong Wan 85a203ebdd Makes most methods in SVals.h conform to the naming guide. Reviewed
by kremenek.

llvm-svn: 125687
2011-02-16 21:13:32 +00:00
Douglas Gregor d766be689d Fix a thinko with llvm::Optional, which is clearly the most dangerous class template in the universe
llvm-svn: 125679
2011-02-16 19:09:24 +00:00
Douglas Gregor 162b712d38 Teach the CXCodeCompleteResults results structure, which stores
code-completion results accessed via libclang, to extend the lifetime
of the allocator used for cached global code-completion results at
least until these completion results are destroyed. Fixes
<rdar://problem/8997369>.

llvm-svn: 125678
2011-02-16 19:08:06 +00:00
Devang Patel 1728c232d5 If preprocessed token introduced empty filename then use main translation unit's filename for debug info entries.
llvm-svn: 125672
2011-02-16 18:40:36 +00:00
Douglas Gregor df7a79a997 Improve the invalidation logic for the cache of global code
completions. We now compute a hash of the names of all top-level
declarations and macro definitions, and invalidate the cache when the
hash value changes.

llvm-svn: 125670
2011-02-16 18:16:54 +00:00
John McCall b5011ab8f9 Remove this FIXME; clear up an unused variable; style.
llvm-svn: 125662
2011-02-16 08:39:19 +00:00
John McCall 1bf5846abf Save a copy expression for non-trivial copy constructions of catch variables.
llvm-svn: 125661
2011-02-16 08:02:54 +00:00
Ted Kremenek 108b2d56bf Tweak -Warray-bounds diagnostics based on feedback from Chandler.
llvm-svn: 125649
2011-02-16 04:01:44 +00:00
Nick Lewycky bb1e5079b2 Revert r125642. This broke the build? It should be a no-op.
llvm-svn: 125645
2011-02-16 02:34:28 +00:00
Ken Dyck 1300b3b357 Convert the UnpackedAlignment field to CharUnits from bits. No change in
functionality intended.

llvm-svn: 125643
2011-02-16 02:11:31 +00:00
Nick Lewycky 757515588a Don't use "../foo" to return to the current directory.
llvm-svn: 125642
2011-02-16 02:10:49 +00:00