Commit Graph

28284 Commits

Author SHA1 Message Date
John McCall 2b3c5538fa Look through array types when deciding whether a field requires non-trivial
destruction in the destructor-aliases logic.  Fixes PR 9197.

llvm-svn: 125447
2011-02-13 00:46:43 +00:00
Fariborz Jahanian 42455ea935 Implement objective-c++'s block pointer type matching involving
types which are contravariance in argument types and covariance
in return types. // rdar://8979379.

llvm-svn: 125445
2011-02-12 19:07:46 +00:00
Ted Kremenek c059798756 Teach the IdempotentOperations checker to ignore property setters.
llvm-svn: 125443
2011-02-12 18:50:03 +00:00
Argyrios Kyrtzidis 9fdd25492c When reading the AST, delay loading of the redeclaration chain to avoid deeply nested calls.
Temporarily set the first (canonical) declaration as the previous one, which is the one that
matters, and mark the real previous DeclID to be loaded & attached later on.

Fixes rdar://8956193.

llvm-svn: 125434
2011-02-12 07:50:47 +00:00
Ted Kremenek ba6ead4bc0 Update static analyzer build to checker-255.
llvm-svn: 125432
2011-02-12 03:20:34 +00:00
Ted Kremenek 70aeefa17e Weaken the ObjCSelfInitChecker to only warn when one calls an 'init' method within an 'init' method. This is a temporary stop gap to avoid false positives while we investigate how to make it smarter.
llvm-svn: 125427
2011-02-12 03:03:54 +00:00
Ted Kremenek 395f1ac038 Add test case for <rdar://problem/6888289>.
llvm-svn: 125424
2011-02-12 01:25:04 +00:00
Ted Kremenek 10b5926e29 static analyzer: Also invalidate instance variables of a receiver in a message expression, just as we do with parameters.
Fixes <rdar://problem/8725041>.

llvm-svn: 125422
2011-02-12 01:01:31 +00:00
Ted Kremenek b1c392aa56 Don't emit a dead store for '++' operations unless it occurs with a return statement. We've never seen any other cases that were real bugs.
Fixes <rdar://problem/6962292>.

llvm-svn: 125419
2011-02-12 00:17:19 +00:00
Jeffrey Yasskin c498878e6d Add CMake dependencies so that LLVM_USED_LIBS order doesn't matter.
I also sorted the tools/driver dependencies since their order no
longer matters.

llvm-svn: 125417
2011-02-11 23:46:38 +00:00
Ted Kremenek 9865d7f0e6 Don't report dead stores on unreachable code paths. Fixes <rdar://problem/8405222>.
llvm-svn: 125415
2011-02-11 23:24:26 +00:00
Zhanyong Wan f3c0ff730b Uses llvm::sys::path instead of hand-rolled algorithm in FileManager.
Reviewed by dgregor.

llvm-svn: 125407
2011-02-11 21:25:35 +00:00
Ted Kremenek 6cc8f5d83c Add test case for PR 8646.
llvm-svn: 125401
2011-02-11 20:13:27 +00:00
Peter Collingbourne de32b20bdd Reject forbidden storage class specifiers in OpenCL. Patch by George Russell!
llvm-svn: 125399
2011-02-11 19:59:54 +00:00
Ted Kremenek 7b3f290d61 Remove RegionStoreManager::evalBinOp(), which is now handled by the SValBuilder.
llvm-svn: 125396
2011-02-11 19:48:19 +00:00
Ted Kremenek eddeba0dae Rename 'InvalidateRegions()' to 'invalidateRegions()'.
llvm-svn: 125395
2011-02-11 19:48:15 +00:00
Douglas Gregor 46c50012ca Rename the operation that loads a preprocessed entity from a given offset to indicate that we're loading from an offset, not an index, lest one be confused. No functionality change.
llvm-svn: 125394
2011-02-11 19:46:30 +00:00
Fariborz Jahanian 178259710a Fix a block sema bug where result type of initializer
is unqualified but its initialized is qualified.
This is for c only and fixes the imm. problem.
c++ is more involved and is wip.
// rdar://8979379

llvm-svn: 125386
2011-02-11 18:46:17 +00:00
Zhanyong Wan e1dd3e2c31 Improves Clang's virtual file handling.
This patch contains:

- making some of the existing comments more accurate in the presence
of virtual files/directories.

- renaming some private data members of FileManager to match their roles better.

- creating 'DirectorEntry's for the parent directories of virtual
files, such that we can tell whether two virtual files are from the
same directory.  This is useful for injecting virtual files whose
directories don't exist in the real file system.

- minor clean-ups and adding comments for class
FileManager::UniqueDirContainer and FileManager::UniqueFileContainer.

- adding statistics on virtual files to FileManager::PrintStats().

- adding unit tests to verify the existing and new behavior of FileManager.

llvm-svn: 125384
2011-02-11 18:44:49 +00:00
Douglas Gregor 6a5be93b81 Don't compare llvm::Optional<> objects directly; compare their
contents when it's safe. I just *love* C++ some days.

llvm-svn: 125378
2011-02-11 18:08:15 +00:00
NAKAMURA Takumi fc217469c2 InitHeaderSearch.cpp: [PR8298] Don't touch drive G: on Windows hosts!
llvm-svn: 125364
2011-02-11 05:25:56 +00:00
Ted Kremenek 5662dfefad Allow the 'Eng' entry in GRStateManager to be a (possibly null) pointer instead of a reference.
llvm-svn: 125362
2011-02-11 04:20:16 +00:00
Rafael Espindola 3968cd0f7b For consistency, use llvm::raw_ostream in the rest of the mangle api.
llvm-svn: 125360
2011-02-11 02:52:17 +00:00
Ken Dyck d5090c16f8 Convert RecordLayout::DataSize to CharUnits from bits, eliminating two
unnecessary calls to RoundUpToAlignment. No changes to functionality
intended.

llvm-svn: 125356
2011-02-11 02:20:09 +00:00
Ken Dyck b0fcc59e19 Add a helper function, ASTContext::toBits(), that converts sizes in
CharUnits to sizes in bits, and use it to tidy up the places where the
conversion was done explicitly.

llvm-svn: 125332
2011-02-11 01:54:29 +00:00
Rafael Espindola a759d72d7b Use raw_ostream instead of raw_svector_ostream.
llvm-svn: 125330
2011-02-11 01:41:00 +00:00
Daniel Dunbar c351d2b7fd build/compiler-rt: Fake Clang into using the right assembler to build the ARM
bits for the runtime libraries.

llvm-svn: 125328
2011-02-11 01:29:49 +00:00
Douglas Gregor 005a6ace07 Eliminate a major performance problem with chained PCH, where we were
causing the deserialization of a large number of declarations when
writing the visible-updates record for the translation unit in C. This
takes us from:

*** AST File Statistics:
  2 stat cache hits
  6 stat cache misses
  1/64463 source location entries read (0.001551%)
  15606/16956 types read (92.038216%)
  59266/89334 declarations read (66.342041%)
  38952/61393 identifiers read (63.446976%)
  0/7778 selectors read (0.000000%)
  24192/34644 statements read (69.830276%)
  388/8809 macros read (4.404586%)
  2095/5189 lexical declcontexts read (40.373867%)
  0/4587 visible declcontexts read (0.000000%)
  0/7716 method pool entries read (0.000000%)
  0 method pool misses

to

*** AST File Statistics:
  2 stat cache hits
  6 stat cache misses
  1/64463 source location entries read (0.001551%)
  26/16956 types read (0.153338%)
  18/89334 declarations read (0.020149%)
  145/61393 identifiers read (0.236183%)
  0/7778 selectors read (0.000000%)
  21/34644 statements read (0.060617%)
  0/8809 macros read (0.000000%)
  0/5189 lexical declcontexts read (0.000000%)
  0/4587 visible declcontexts read (0.000000%)
  0/7716 method pool entries read (0.000000%)
  0 method pool misses

when generating a chained PCH for a header that #includes Cocoa.h
(from a PCH file) and adds one simple function declaration. The
generated PCH file is now only 9580 bytes (down from > 2MB).

llvm-svn: 125326
2011-02-11 00:52:17 +00:00
Douglas Gregor 68051a74ec Implement AST/PCH chaining support for macro definitions. Previously,
we would deserialize all of the macro definitions we knew about while
serializing the macro definitions at the end of the AST/PCH file. Even
though we skipped most of them (since they were unchanged), it's still
a performance problem.

Now, we do the standard AST/PCH chaining trick: watch what identifiers
are deserialized as macro names, and consider only those identifiers
(along with macro definitions that have been deserialized/written in
the source) when serializing the preprocessor state.

llvm-svn: 125324
2011-02-11 00:26:14 +00:00
Rafael Espindola ac00f5dd4b Use raw_svector_ostream in more places in the mangler.
llvm-svn: 125321
2011-02-10 23:59:36 +00:00
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