Граф коммитов

287 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 47099742e2 add a bunch of timers for -E and other modes. This requires
llvm r64874 or later.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64875 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 01:51:21 +00:00
Chris Lattner 445026698c move llvm backend specific #includes into Backend.cpp instead of Clang.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64872 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 01:23:44 +00:00
Chris Lattner 8a5c80913c indentation and formatting
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64871 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 01:20:05 +00:00
Chris Lattner dddaa9cbbc clang will hopefully never support ratfor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64870 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 01:17:01 +00:00
Chris Lattner b2509e148c wire up a minimal -ftime-report, which prints the optimizer/codegen
times.  Daniel, plz add driver support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 01:12:43 +00:00
Daniel Dunbar a034ba807b Backend: Accept -mcpu and -mattr for use by TargetMachine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64798 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 19:47:34 +00:00
Ted Kremenek be1fe1eb12 Static Analyzer driver/options (partial) cleanup:
- Move all analyzer options logic to AnalysisConsumer.cpp.
- Unified specification of stores/constraints/output to be:
   -analyzer-output=...
   -analyzer-store=...
   -analyzer-constraints=...
  instead of -analyzer-range-constraints, -analyzer-store-basic, etc.
- Updated drivers (ccc-analyzer, scan-builds, new ccc) to obey this new
  interface
- Updated test cases to conform to new driver options


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 04:27:41 +00:00
Chris Lattner 5bef8ddabf add support for -fno-math-errno, and validate that it affects sema properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64708 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 00:35:09 +00:00
Chris Lattner 5ea9d1bb0b remove extraneous .
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 00:30:31 +00:00
Daniel Dunbar ef2abfee3e Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.
- Define pow[lf]?, sqrt[lf]? as builtins.

 - Add -fmath-errno option which binds to LangOptions.MathErrno

 - Add new builtin flag Builtin::Context::isConstWithoutErrno for
   functions which can be marked as const if errno isn't respected for
   math functions. Sema automatically marks these functions as const
   when they are defined, if MathErrno=0.

 - IRgen uses const attribute on sqrt and pow library functions to
   decide if it can use the llvm intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 22:43:43 +00:00
Daniel Dunbar 3ada6ffd92 PR3589: Don't simplify libcalls with -ffreestanding.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64599 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 20:00:15 +00:00
Douglas Gregor 3573c0c0b4 Add -ffreestanding to suppress the implicit declaration of library builtins like printf and malloc. Fixes PR3586
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64566 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 20:49:29 +00:00
Chris Lattner c76d807565 add support for -x c++-header, update comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 06:19:20 +00:00
Chris Lattner db76684bcb default diag::err_pp_file_not_found to mapping to fatal,
implementing PR3492: #include failures should be a fatal error


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 04:16:41 +00:00
Daniel Dunbar d604c40e93 Add -femit-all-decls codegen option.
- Emits all declarations, even unused (static) ones.
 - Useful when doing minimization of codegen problems (otherwise
   problems localized to a static function aren't minimized well).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 21:19:06 +00:00
Mike Stump a0f02aa227 Use the updated CommandLine api for -fno-blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63563 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 22:57:57 +00:00
Anders Carlsson ad53eff732 Fix typo noticed by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63449 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 23:26:40 +00:00
Anders Carlsson b0f90ccbc1 Turn on -flax-vector-conversions by default, issue a warning whenever one is done. Add a -fnolax-vector-conversions option. Fixes PR2862.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 23:17:46 +00:00
Chris Lattner 65f5e64a7a wire up -fno-show-source-location option, patch by Alexei Svitkine!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63409 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 19:01:41 +00:00
Mike Stump b55cc635f5 Add -fno-blocks support. This fixes block-no-block-def.c.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 08:22:07 +00:00
Daniel Dunbar d2ea38643f Fix name of -x option for C preprocessed input; it should be
cpp-output, not c-cpp-output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63345 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 23:50:47 +00:00
Chris Lattner 19e8e2cffc next round of diagnostics cleanups, moving some
diags around, eliminating #defines, etc.  Patch by
Anders Johnsen!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 17:46:13 +00:00
Chris Lattner 88eccaf06f Fix -Wimplicit-function-declaration, which required some refactoring and
changes in various diagnostics code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63282 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 06:55:46 +00:00
Chris Lattner 1a360896d7 Fix a wart that existed from before we had EXTWARN.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 05:23:19 +00:00
Chris Lattner 500d3297d2 move library-specific diagnostic headers into library private dirs. Reduce
redundant #includes.  Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63271 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 05:15:15 +00:00
Ted Kremenek 8a6aec620d Enhance PTHManager::Create() to take an optional Diagnostic* argument that can be used to report issues such as a missing PTH file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 20:49:33 +00:00
Ted Kremenek 46157b5964 Patch by Alexei Svitkine: Refactor Sema::ParseAST API to allow clients to pass as an argument a TranslationUnit object whose contents live beyond the call to ParseAST.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63175 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 04:29:29 +00:00
Mike Stump 007f2a9e28 Add a preliminary version number.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 02:43:35 +00:00
Chris Lattner 20c6b3b85e Split the single monolithic DiagnosticKinds.def file into one
.def file for each library.  This means that adding a diagnostic
to sema doesn't require all the other libraries to be rebuilt.

Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 18:30:58 +00:00
Ted Kremenek 491918ee2f Added clang option '--analyzer-display-progress' to indicate that the analyzer should output 'ANALYZE:' messages to display its progress on a source file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62875 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 20:52:26 +00:00
Ted Kremenek c472d79e3a When using -analyzer-output-plist always output a plist file even if it contains no error reports.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62871 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 20:06:20 +00:00
Fariborz Jahanian 30bc57187b Use NonFragileABI as name of new Next abi. More comments
for the new meta-data.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62806 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22 23:02:58 +00:00
Chris Lattner a05ff45ca2 Adjust to api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62785 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22 20:57:52 +00:00
Fariborz Jahanian ee0af74d1e Refactoring ObjC Next's runtime classes in preparation for
the new ObjC's abi.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62721 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21 22:04:16 +00:00
Anders Carlsson e56f6ffb12 Don't turn off blocks when compiling Obj-C code
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62701 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21 18:47:36 +00:00
Daniel Dunbar d427023c33 Add -analyze action to run static analyzer, instead of inferring from
individual checker options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 23:17:32 +00:00
Chris Lattner 025c3a6640 add a simplified lexer ctor that sets up the lexer to raw-lex an
entire file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 07:35:14 +00:00
Chris Lattner 2b2453a7d8 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 06:22:33 +00:00
Ted Kremenek 72b1b15ee8 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 18:47:46 +00:00
Daniel Dunbar d77b251b06 Fix typo and spelling of -Wunused-macros.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-14 18:56:36 +00:00
Zhongxing Xu 2d75d6f56c 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62136 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 01:29:24 +00:00
Douglas Gregor 4920f1ffb6 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 22:49:06 +00:00
Ted Kremenek 1b95a6546d Always print out SourceManager stats with 'Stats' is true. This revealed that PTH always pulls in the source pages with -fsyntax-only (investigating further).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61996 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 18:20:21 +00:00
Ted Kremenek f890191057 Enable support for '-x objective-c++-header'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61963 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 00:38:08 +00:00
Fariborz Jahanian 17d0d0d7ca Place warning about 'readonly' property attributes which
are related to setter syntax under -Wreadonly-setter-attrs
to prevent warnings in projects built with gcc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 23:23:10 +00:00
Ted Kremenek b789103464 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06 22:16:26 +00:00
Daniel Dunbar a629190326 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60957 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 18:34:35 +00:00
Chris Lattner 802db9b4d5 -std=c99 defaults blocks to off even on darwin, but -fblocks overrides
even it. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60568 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 00:10:44 +00:00
Chris Lattner ae0ee03fd9 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60563 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 23:20:07 +00:00
Chris Lattner 8fc4dfb30e replace useNeXTRuntimeAsDefault with a generic hook that allows targets
to specify their default language options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 22:54:33 +00:00