Commit Graph

368 Commits

Author SHA1 Message Date
Ted Kremenek ec28391084 Added clang option '--analyzer-display-progress' to indicate that the analyzer should output 'ANALYZE:' messages to display its progress on a source file.
llvm-svn: 62875
2009-01-23 20:52:26 +00:00
Ted Kremenek 099243aa9e When using -analyzer-output-plist always output a plist file even if it contains no error reports.
llvm-svn: 62871
2009-01-23 20:06:20 +00:00
Fariborz Jahanian b15a3d5969 Use NonFragileABI as name of new Next abi. More comments
for the new meta-data.

llvm-svn: 62806
2009-01-22 23:02:58 +00:00
Chris Lattner 8c5ffd0761 Adjust to api change.
llvm-svn: 62785
2009-01-22 20:57:52 +00:00
Fariborz Jahanian 279eda6275 Refactoring ObjC Next's runtime classes in preparation for
the new ObjC's abi.

llvm-svn: 62721
2009-01-21 22:04:16 +00:00
Anders Carlsson e26b945b8d Don't turn off blocks when compiling Obj-C code
llvm-svn: 62701
2009-01-21 18:47:36 +00:00
Daniel Dunbar 34fc92fdc2 Add -analyze action to run static analyzer, instead of inferring from
individual checker options.

llvm-svn: 62634
2009-01-20 23:17:32 +00:00
Chris Lattner 08354fef13 add a simplified lexer ctor that sets up the lexer to raw-lex an
entire file.

llvm-svn: 62414
2009-01-17 07:35:14 +00:00
Chris Lattner d32480d3db this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker
instead of yet-another-random-unsigned floating around.

This is an important distinction from the "FileID" currently tracked by
SourceLocation.  *That* FileID may refer to the start of a file or to a
chunk within it.  The new FileID *only* refers to the file (and its 
#include stack and eventually #line data), it cannot refer to a chunk.

FileID is a completely opaque datatype to all clients, only SourceManager
is allowed to poke and prod it.

llvm-svn: 62407
2009-01-17 06:22:33 +00:00
Ted Kremenek a705b04d7f IdentifierInfo:
- IdentifierInfo can now (optionally) have its string data not be
  co-located with itself.  This is for use with PTH.  This aspect is a
  little gross, as getName() and getLength() now make assumptions
  about a possible alternate representation of IdentifierInfo.
  Perhaps we should make IdentifierInfo have virtual methods?

IdentifierTable:
- Added class "IdentifierInfoLookup" that can be used by
  IdentifierTable to perform "string -> IdentifierInfo" lookups using
  an auxilliary data structure.  This is used by PTH.
- Perform tests show that IdentifierTable::get() does not slow down
  because of the extra check for the IdentiferInfoLookup object (the
  regular StringMap lookup does enough work to mitigate the impact of
  an extra null pointer check).
- The upshot is that now that some IdentifierInfo objects might be
  owned by the IdentiferInfoLookup object.  This should be reviewed.

PTH:
- Modified PTHManager::GetIdentifierInfo to *not* insert entries in
  IdentifierTable's string map, and instead create IdentifierInfo
  objects on the fly when mapping from persistent IDs to
  IdentifierInfos.  This saves a ton of work with string copies,
  hashing, and StringMap lookup and resizing.  This change was
  motivated because when processing source files in the PTH cache we
  don't need to do any string -> IdentifierInfo lookups.
- PTHManager now subclasses IdentifierInfoLookup, allowing clients of
  IdentifierTable to transparently use IdentifierInfo objects managed
  by the PTH file.  PTHManager resolves "string -> IdentifierInfo"
  queries by doing a binary search over a sorted table of identifier
  strings in the PTH file (the exact algorithm we use can be changed
  as needed).

These changes lead to the following performance changes when using PTH on Cocoa.h:
- fsyntax-only: 10% performance improvement
- Eonly: 30% performance improvement

llvm-svn: 62273
2009-01-15 18:47:46 +00:00
Daniel Dunbar 1dad2d8e8b Fix typo and spelling of -Wunused-macros.
llvm-svn: 62239
2009-01-14 18:56:36 +00:00
Zhongxing Xu 9aabf025e5 Add an initial framework of a DeclContextPrinter. It can print DeclContext and
its Decls in indented format. An Example:

$ cat t.cpp
class A {
  int a;
  void f();
};
void A::f() {
  a = 3;
}

$ clang -print-decl-contexts t.cpp
[translation unit] 0x9754d7c
    <typedef> __builtin_va_list
    [class] A 0x9753310
        <class> A 0x975ce20
        <field> a
        <c++ method> f
        <c++ ctor> A
        <c++ ctor> A
        <c++ method> operator=
        <c++ dtor> ~A
    [c++ method] f [[0x9753310]]

Some comments: '<>' indicates a declaration, '[]' indicates a definition, '[[
]]' displays the semantic DeclContext which is different from the lexical
DeclContext.  The symbols printed can definitely be changed in the future.

llvm-svn: 62136
2009-01-13 01:29:24 +00:00
Douglas Gregor c6f58fe266 Implement support for anonymous structs and unions in C. Both C and
C++ handle anonymous structs/unions in the same way. Addresses several
bugs:

  <rdar://problem/6259534>
  <rdar://problem/6481130>
  <rdar://problem/6483159>

The test case in PR clang/1750 now passes with -fsyntax-only, but
CodeGen for inline assembler still fails.

llvm-svn: 62112
2009-01-12 22:49:06 +00:00
Ted Kremenek feb260784b Always print out SourceManager stats with 'Stats' is true. This revealed that PTH always pulls in the source pages with -fsyntax-only (investigating further).
llvm-svn: 61996
2009-01-09 18:20:21 +00:00
Ted Kremenek b54c19a754 Enable support for '-x objective-c++-header'.
llvm-svn: 61963
2009-01-09 00:38:08 +00:00
Fariborz Jahanian d11dc0b1d9 Place warning about 'readonly' property attributes which
are related to setter syntax under -Wreadonly-setter-attrs
to prevent warnings in projects built with gcc.

llvm-svn: 61953
2009-01-08 23:23:10 +00:00
Ted Kremenek 63a55ab079 Remove redunant (and incorrect) call to SourceManager::PrintStats(). This would be called after a SourceManager was 'cleared', so it printed bogus results. Moreover, these stats are already printed earlier in the code path.
llvm-svn: 61825
2009-01-06 22:16:26 +00:00
Daniel Dunbar 7b127324ce Force i[0-9]86 to i386 when using LLVM_HOSTTRIPLE.
Only use major part of OS version when on darwin and modifying OS part
of target triple.

llvm-svn: 60957
2008-12-12 18:34:35 +00:00
Chris Lattner 5b4927048f -std=c99 defaults blocks to off even on darwin, but -fblocks overrides
even it. 

llvm-svn: 60568
2008-12-05 00:10:44 +00:00
Chris Lattner 2ca529ce61 instead of forcing blocks on by default, make them default to off, but let
specific targets default them to on.  Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.

llvm-svn: 60563
2008-12-04 23:20:07 +00:00
Chris Lattner c7c6dd4d97 replace useNeXTRuntimeAsDefault with a generic hook that allows targets
to specify their default language options.

llvm-svn: 60561
2008-12-04 22:54:33 +00:00
Ted Kremenek da4d9dfbca Add "-token-cache" option for using pretokenized cache files.
llvm-svn: 60440
2008-12-02 19:57:31 +00:00
Daniel Dunbar 1f3d7849a8 Add LangOptions marker for assembler-with-cpp mode and use to define
__ASSEMBLER__ properly. Patch from Roman Divacky (with minor
formatting changes). Thanks!

llvm-svn: 60362
2008-12-01 18:55:22 +00:00
Douglas Gregor c12ce19595 Enable blocks in C++
llvm-svn: 60361
2008-12-01 18:34:47 +00:00
Douglas Gregor 237f96c40f Implement implicit conversions for Objective-C specific types, e.g.,
converting a pointer to one Objective-C interface into a pointer to another
Objective-C interface, and conversions with 'id'. The semantics seems
to match GCC, although they seem somewhat ad hoc.

Fixed a few cases where we assumed the C++ definition of isObjectType,
but were getting the C definition, causing failures in trouble with
conversions to void pointers.

llvm-svn: 60130
2008-11-26 23:31:11 +00:00
Zhongxing Xu 21148402d6 Add plugin loading for clang. This will be used to load alternative constraint manager for static analysis.
llvm-svn: 60091
2008-11-26 05:23:17 +00:00
Ted Kremenek 25391e7cb7 reverting this because it breaks some blocks cases, I'll send doug a testcase
llvm-svn: 59850
2008-11-22 01:04:48 +00:00
Douglas Gregor 09075a99e0 Don't turn off blocks in C++
llvm-svn: 59827
2008-11-21 17:10:06 +00:00
Chris Lattner 327984f4c4 switch TextDiagnosticPrinter to raw_ostream.
llvm-svn: 59597
2008-11-19 06:56:25 +00:00
Chris Lattner 7b9f769ea9 remove a helper method with only one call site.
llvm-svn: 59495
2008-11-18 05:05:28 +00:00
Daniel Dunbar a94d873b4b Move backend output out of destructor.
Don't free AST consumer when --disable-free is set.

llvm-svn: 59030
2008-11-11 06:35:39 +00:00
Ted Kremenek 14f18653f6 Hook up the Plist diagnostic client to the driver.
Fix Plist output.

llvm-svn: 58652
2008-11-03 23:18:07 +00:00
Ted Kremenek e868c00d5a Rename 'HTMLDiagnostics.h' to 'PathDiagnosticClients.h'
llvm-svn: 58646
2008-11-03 22:31:48 +00:00
Daniel Dunbar ada702ef45 Turn off module verification in Release-Asserts builds.
llvm-svn: 58500
2008-10-31 09:34:21 +00:00
Daniel Dunbar f8362f9e5d "One" line fix for -parse-noop failure, "id" and several other things
were being treated as type names for non-Objective-C files.
 - Other lines are just because MinimalAction didn't have access to
   the LangOptions.

llvm-svn: 58498
2008-10-31 08:56:51 +00:00
Daniel Dunbar e74f2c2633 Improve llvm-gcc compatibility, -Os implies -O2 (sortof).
llvm-svn: 58374
2008-10-29 07:56:11 +00:00
Daniel Dunbar a3730a23a2 Choose CompileOptions (optimization passes) to match llvm-gcc more
closely.

llvm-svn: 58361
2008-10-29 03:42:18 +00:00
Chris Lattner 1500970962 .s files don't require the preprocessor, patch by Roman Divacky!
llvm-svn: 58349
2008-10-28 20:33:42 +00:00
Daniel Dunbar 460f8ee507 Call llvm_shutdown() on (normal) termination. This makes --time-passes usable.
llvm-svn: 58308
2008-10-28 00:38:08 +00:00
Daniel Dunbar 1a0625e5cf With -verify, only exit early on failure.
- Nice if -verify test exercise the various cleanup functions.

llvm-svn: 58285
2008-10-27 22:10:13 +00:00
Daniel Dunbar eb3e41417d Remove unneeded CheckASTConsumer function.
- No functionality change.

llvm-svn: 58282
2008-10-27 22:03:52 +00:00
Ted Kremenek 3773bbce54 Use string literal for format string specifier; this prevents ErrMsg from being interpretted as a format string specifier.
llvm-svn: 58150
2008-10-25 20:19:34 +00:00
Daniel Dunbar fa0caca6d2 Add initial dependency file generation support. Patch by Kovarththanan
Rajaratnam, with some updates and formatting changes.

llvm-svn: 58122
2008-10-24 22:12:41 +00:00
Ted Kremenek 6779f893b9 Make the analyzer store (memory model) a command line option.
llvm-svn: 58056
2008-10-24 01:04:59 +00:00
Ted Kremenek 45e2b90d3d Added driver option "-cxx-inheritance-view" for viewing the C++ hierarchy of a class in GraphViz.
llvm-svn: 58051
2008-10-23 23:36:29 +00:00
Daniel Dunbar 71880e738a Add -O[0-3s] support (following llvm-gcc).
- Passes match llvm-gcc but many of the switches aren't wired.

llvm-svn: 58034
2008-10-23 05:50:47 +00:00
Chris Lattner 720d515ee9 Add support for assembler-with-cpp (preprocessed .S files), patch by
Roman Divacky!

llvm-svn: 57988
2008-10-22 17:29:21 +00:00
Daniel Dunbar c13935e8be [LLVM up] Add basic -S option to clang.
- Split backend related consumer out into Backend.cpp, replaces
   LLVMCodeGenWriter.
 - Structure follows llvm-gcc to some extent.
 - Still need to implement all the options which impact code
   generation and the optimization passes which llvm-gcc uses at
   various levels.

llvm-svn: 57936
2008-10-21 23:49:24 +00:00
Steve Naroff a0ed165a84 Fix <rdar://problem/6261178> clang-on-xcode: [sema] multiple method warning is over enthusiastic.
Fix <rdar://problem/6265257> warnings for ambiguous message send swamp other warnings.

Reworked Sema::MatchTwoMethodDeclarations() to optionally match based on method size and alignment (the default in GCC). Changed Sema::LookupInstanceMethodInGlobalPool() to use this feature.

Added -Wno-struct-selector-match to driver, however didn't hook it up yet. Added a FIXME that says this.

llvm-svn: 57898
2008-10-21 10:37:50 +00:00
Ted Kremenek 8ab23ade80 Added the start of a prototype implementation of PCH based on token caching.
llvm-svn: 57863
2008-10-21 00:54:44 +00:00