Commit Graph

28254 Commits

Author SHA1 Message Date
Matt Beaumont-Gay 1fe49151c9 Add braces to quiet a gcc warning.
llvm-svn: 125309
2011-02-10 20:35:01 +00:00
Daniel Dunbar 7c2dc3667f Fix think-o I committed without testing, shameful.
llvm-svn: 125299
2011-02-10 18:29:28 +00:00
Daniel Dunbar 66d8483170 Fix a gcc Wuninitialized false positive.
llvm-svn: 125298
2011-02-10 18:24:25 +00:00
Douglas Gregor 2e5571d0fb When we're writing macro definitions to an AST/PCH File, sort the
macro definitions by macro name first. That way, we'll get a stable
ordering in the AST/PCH file.

llvm-svn: 125297
2011-02-10 18:20:09 +00:00
Argyrios Kyrtzidis 7dd856a76b For -Woverloaded-virtual take into account canonical methods. Fixes rdar://8979966 & http://llvm.org/PR9182.
llvm-svn: 125296
2011-02-10 18:13:41 +00:00
Daniel Dunbar cb2b3d051d Fix family-friendly-o, tsk tsk.
llvm-svn: 125293
2011-02-10 18:10:07 +00:00
Daniel Dunbar 468a8f8756 IRgen: Fix an immediate-exit-from-fn style nit.
llvm-svn: 125289
2011-02-10 17:32:22 +00:00
Douglas Gregor 09b6989ef0 Implement two related optimizations that make de-serialization of
AST/PCH files more lazy:
  - Don't preload all of the file source-location entries when reading
  the AST file. Instead, load them lazily, when needed.
  - Only look up header-search information (whether a header was already
  #import'd, how many times it's been included, etc.) when it's needed
  by the preprocessor, rather than pre-populating it.

Previously, we would pre-load all of the file source-location entries,
which also populated the header-search information structure. This was
a relatively minor performance issue, since we would end up stat()'ing
all of the headers stored within a AST/PCH file when the AST/PCH file
was loaded. In the normal PCH use case, the stat()s were cached, so
the cost--of preloading ~860 source-location entries in the Cocoa.h
case---was relatively low.

However, the recent optimization that replaced stat+open with
open+fstat turned this into a major problem, since the preloading of
source-location entries would now end up opening those files. Worse,
those files wouldn't be closed until the file manager was destroyed,
so just opening a Cocoa.h PCH file would hold on to ~860 file
descriptors, and it was easy to blow through the process's limit on
the number of open file descriptors.

By eliminating the preloading of these files, we neither open nor stat
the headers stored in the PCH/AST file until they're actually needed
for something. Concretely, we went from

*** HeaderSearch Stats:
835 files tracked.
  364 #import/#pragma once files.
  823 included exactly once.
  6 max times a file is included.
  3 #include/#include_next/#import.
    0 #includes skipped due to the multi-include optimization.
1 framework lookups.
0 subframework lookups.

*** Source Manager Stats:
835 files mapped, 3 mem buffers mapped.
37460 SLocEntry's allocated, 11215575B of Sloc address space used.
62 bytes of files mapped, 0 files with line #'s computed.

with a trivial program that uses a chained PCH including a Cocoa PCH
to

*** HeaderSearch Stats:
4 files tracked.
  1 #import/#pragma once files.
  3 included exactly once.
  2 max times a file is included.
  3 #include/#include_next/#import.
    0 #includes skipped due to the multi-include optimization.
1 framework lookups.
0 subframework lookups.

*** Source Manager Stats:
3 files mapped, 3 mem buffers mapped.
37460 SLocEntry's allocated, 11215575B of Sloc address space used.
62 bytes of files mapped, 0 files with line #'s computed.

for the same program.

llvm-svn: 125286
2011-02-10 17:09:37 +00:00
Roman Divacky 66f2276aee Adjust the object files to be linked in when mcount profiling
is specified in the FreeBSD linker driver.

llvm-svn: 125285
2011-02-10 16:59:40 +00:00
Roman Divacky 5bc5151299 Add a testcase for the mcount profiling.
llvm-svn: 125283
2011-02-10 16:52:35 +00:00
Roman Divacky 178e0160b7 Implement mcount profiling, enabled via -pg.
llvm-svn: 125282
2011-02-10 16:52:03 +00:00
Ken Dyck 89d9f360cd Drop the 'InBits' part from the name of RecordSizeInBits as the value is in
character units.

llvm-svn: 125281
2011-02-10 12:36:29 +00:00
Ken Dyck f18bf0d2e1 Eliminate some signed-to-unsigned comparision warnings introduced in
r125156.

llvm-svn: 125280
2011-02-10 12:20:05 +00:00
NAKAMURA Takumi 98dd73d66c CMake: LLVM_NO_RTTI must be obsolete now!
llvm-svn: 125275
2011-02-10 09:15:32 +00:00
John McCall f768aa7613 Move the check that gives functions with unique-external types unique-external
linkage into Decl.cpp.  Disable this logic for extern "C" functions, because
the operative rule there is weaker.  Fixes rdar://problem/8898466

llvm-svn: 125268
2011-02-10 06:50:24 +00:00
Ted Kremenek 1656db69f3 Run ~GRState() when reclaiming GRStates.
llvm-svn: 125262
2011-02-10 03:07:40 +00:00
Ted Kremenek 75e4564140 static analyzer: Make GRStates reference counted, with reference counts managed by ExplodedNodes.
This reduces memory usage of the analyzer on sqlite by another 5%.

llvm-svn: 125260
2011-02-10 02:21:52 +00:00
Ted Kremenek 4bd19da586 Add hack to CMakeLists.txt so that StaticAnalyzer libraries find their corresponding headers.
This is a hack because we really should only search in the 'include/clang/StaticAnalyzer' directory
if we are in 'lib/StaticAnalyzer'.  My CMake knowledge is limited, so I appeal to anyone with
more expertise.

llvm-svn: 125252
2011-02-10 01:03:09 +00:00
Ted Kremenek f8cbac4b91 Split 'include/clang/StaticAnalyzer' into 'include/clang/StaticAnalyzer/Core' and 'include/clang/StaticAnalyzer/Checkers'.
This layout matches lib/StaticAnalyzer, which corresponds to two StaticAnalyzer libraries.

llvm-svn: 125251
2011-02-10 01:03:03 +00:00
Devang Patel 425909dd41 If an aggregate is returned as 'sret' argument then let debugger know about this.
llvm-svn: 125249
2011-02-10 00:40:52 +00:00
Ted Kremenek 0bc2855aa9 Update clang-wpa to pass extra argument to AnalysisManager constructor.
llvm-svn: 125235
2011-02-09 22:59:20 +00:00
Devang Patel 17ac005dbb Add target triple.
llvm-svn: 125230
2011-02-09 22:29:15 +00:00
Fariborz Jahanian ca3566fc20 Fix scoping of method declarations and issue
warning when same parameter name used multiple times.
// rdar://8877730

llvm-svn: 125229
2011-02-09 22:20:01 +00:00
Peter Collingbourne 5eec5f0422 Parse: add support for parsing CUDA kernel calls
llvm-svn: 125219
2011-02-09 21:12:02 +00:00
Peter Collingbourne c1270f51fa Lexer: add CUDA kernel call tokens
llvm-svn: 125218
2011-02-09 21:08:21 +00:00
Peter Collingbourne 41f8546233 AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actions
llvm-svn: 125217
2011-02-09 21:07:24 +00:00
Peter Collingbourne 9e2c81f00a AST, Sema, Serialization: keep track of cudaConfigureCall
llvm-svn: 125216
2011-02-09 21:04:32 +00:00
Devang Patel 84d40a431f Do not emit AT_MIPS_linkage_name for Objective-C method static variable i.
llvm-svn: 125210
2011-02-09 19:16:38 +00:00
Douglas Gregor 1388a89999 Finish up the diagnostic client before we've torn down the ASTReader,
since the diagnostic client might poke at source locations that have
not yet been deserialized.

llvm-svn: 125204
2011-02-09 18:47:31 +00:00
Daniel Dunbar 0bb0331d95 Driver/Frontend: Wire up -mregparm=.
llvm-svn: 125201
2011-02-09 17:54:19 +00:00
Nick Lewycky bae992ffd9 Non-void functions need to return some value.
llvm-svn: 125185
2011-02-09 08:42:57 +00:00
John McCall f75152fb9f Give these little helper functions definitions so that newer gccs stop
complaining.

llvm-svn: 125184
2011-02-09 08:31:17 +00:00
John McCall bd06678921 Remove vtables from the Stmt hierarchy; this was pretty easy as
there were only three virtual methods of any significance.

The primary way to grab child iterators now is with
  Stmt::child_range children();
  Stmt::const_child_range children() const;
where a child_range is just a std::pair of iterators suitable for
being llvm::tie'd to some locals.  I've left the old child_begin()
and child_end() accessors in place, but it's probably a substantial
penalty to grab the iterators individually now, since the
switch-based dispatch is kindof inherently slower than vtable
dispatch.  Grabbing them together is probably a slight win over the
status quo, although of course we could've achieved that with vtables, too.

I also reclassified SwitchCase (correctly) as an abstract Stmt
class, which (as the first such class that wasn't an Expr subclass)
required some fiddling in a few places.

There are somewhat gross metaprogramming hooks in place to ensure
that new statements/expressions continue to implement
getSourceRange() and children().  I had to work around a recent clang
bug;  dgregor actually fixed it already, but I didn't want to
introduce a selfhosting dependency on ToT.

llvm-svn: 125183
2011-02-09 08:16:59 +00:00
Zhanyong Wan 392d2ed8a1 Fix a typo in a comment in tools/clang/unittests/Frontend/Makefile.
llvm-svn: 125182
2011-02-09 07:42:47 +00:00
Ted Kremenek 435c80f5ea Initialize 'reclaimNodes'.
llvm-svn: 125179
2011-02-09 06:04:59 +00:00
NAKAMURA Takumi 1e8200d7ba test: CMake: Be aware of LLVM_LIT_TOOLS_DIR.
llvm-svn: 125178
2011-02-09 04:19:57 +00:00
Devang Patel 19ba2b4d6e Emit debug info for objc_selector.
llvm-svn: 125163
2011-02-09 03:15:05 +00:00
Ken Dyck 48b0b2f762 Correct units in comments describing Size and getSize().
llvm-svn: 125158
2011-02-09 02:06:44 +00:00
Douglas Gregor 2575631c0f When IRgen refers to a function declaration that is not a definition,
and we later find the definition, make sure that we add the definition
(not the declaration) to the list of deferred definitions to
emit. Fixes PR8864.

Thanks to Nick Lewycky for testing this	patch out

llvm-svn: 125157
2011-02-09 02:03:05 +00:00
Ken Dyck c8ae55050d Convert RecordLayout::Size to CharUnits from bits. No changes to
functionality intended.

llvm-svn: 125156
2011-02-09 01:59:34 +00:00
Ted Kremenek a40f8ebc83 static analyzer: Further reduce the analyzer's memory usage when analyzing sqlite3 by 7-10% by recylcing "uninteresting" ExplodedNodes.
The optimization involves eagerly pruning ExplodedNodes from the ExplodedGraph that contain
practically no difference between the predecessor and successor nodes.  For example, if
the state is different between a predecessor and a node, the node is left in.  Only for
the 'environment' component of the state do we not care if the ExplodedNodes are different.
This paves the way for future optimizations where we can reclaim the environment objects.

llvm-svn: 125154
2011-02-09 01:27:33 +00:00
Ted Kremenek a628225535 Make ProgramPoint::getTag() public.
llvm-svn: 125153
2011-02-09 01:27:27 +00:00
John McCall f4cd4f94d9 NonTypeTemplateParmDecl is just a DeclaratorDecl, not a VarDecl.
Also, reorganize and make very explicit the logic for determining
the value kind and type of a referenced declaration.

llvm-svn: 125150
2011-02-09 01:13:10 +00:00
Devang Patel 14524e0f24 If an aggregate argument is passed indirectly because it has non trivial
destructor or copy constructor than let debug info know about it.

Radar 8945514.

llvm-svn: 125142
2011-02-09 00:37:30 +00:00
Ted Kremenek fffba74477 No longer pass deprecated '-nodistribute' flag to xcodebuild.
llvm-svn: 125131
2011-02-08 22:54:30 +00:00
Ted Kremenek 1953f97ac9 analyzer, retain/release checker: Remove hack where objects passed in message to 'self' are no longer tracked.
llvm-svn: 125130
2011-02-08 22:54:26 +00:00
Rafael Espindola c6236065b7 Update for API change.
llvm-svn: 125129
2011-02-08 22:44:16 +00:00
John McCall 7a198cef04 When checking the 'weak' and 'weakref' attributes, look for non-external
linkage rather than the presence of the 'static' storage class specifier.
Fixes rdar://problem/8814626.

llvm-svn: 125126
2011-02-08 22:35:49 +00:00
Fariborz Jahanian 701f094afb Fix an IRGen bug in property setter calls when
setter and getter types mismatch. // rdar://8966864

llvm-svn: 125125
2011-02-08 22:33:23 +00:00
Argyrios Kyrtzidis fa0734ec4f [analyzer] Move the files in lib/StaticAnalyzer to lib/StaticAnalyzer/Core.
Eventually there will also be a lib/StaticAnalyzer/Frontend that will handle initialization and checker registration.
Yet another library to avoid cyclic dependencies between Core and Checkers.

llvm-svn: 125124
2011-02-08 22:30:36 +00:00