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

1006 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 6948bc4bcb Provide diag_iterator for iterating over the built-in diagnostic IDs/names in the internal table of DiagnosticIDs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137108 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 03:39:14 +00:00
Chad Rosier 6e43f3f0e2 Additional comments and whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136892 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-04 17:52:43 +00:00
Chad Rosier 61a62216a0 Add partial support for using anonymous bitfields (e.g., int : 0) to enforce
alignment.  This fixes cases where the anonymous bitfield is followed by a 
non-bitfield member.  E.g.,

struct t4
{
  int foo : 1;
  long : 0;
  char bar;
};

Part of rdar://9859156

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136858 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-04 01:21:14 +00:00
Benjamin Kramer b9a8adf57b Remove dead code flagged by GCC's -Wunused-but-set-variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136581 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-31 01:06:41 +00:00
Eric Christopher 895d4220e5 Add support for the 'Q' arm memory constraint.
Fixes rdar://9866494


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136524 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 21:20:35 +00:00
Argyrios Kyrtzidis c0a575f9b7 Make DiagnosticErrorTrap keep a count of the errors that occurred so multiple
DiagnosticErrorTraps can be composed (e.g. a trap inside another trap).

Fixes http://llvm.org/PR10462 & rdar://9852007.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136447 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 01:25:44 +00:00
Ted Kremenek 6e36c12404 Change SourceManager::getDataStructureSizes() to use llvm::capacity_in_bytes().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136236 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-27 18:41:16 +00:00
Ted Kremenek ca7dc2b755 clang_getCXTUResourceUsage: Report memory used by data structures in SourceManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136189 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 23:46:06 +00:00
Chad Rosier 9f1210c328 After further discussion it has been determined that alignof should report
the preferred alignment.  Thus, revert r135934, r135935, and r135940.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136062 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 07:03:04 +00:00
Chandler Carruth 3201f38295 Clean up as many of the comments in Basic I can find to talk in terms of
'expansion' rather than 'instantiation' for macro source locations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136058 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 05:17:23 +00:00
Chandler Carruth 1728762d5a Migrate 'Instantiation' data and API bits of SLocEntry to 'Expansion'
etc. With this I think essentially all of the SourceManager APIs are
converted. Comments and random other bits of cleanup should be all thats
left.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136057 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 04:56:51 +00:00
Chandler Carruth 78df836808 Convert InstantiationInfo and much of the related code to ExpansionInfo
and various other 'expansion' based terms. I've tried to reformat where
appropriate and catch as many references in comments but I'm going to do
several more passes. Also I've tried to expand parameter names to be
more clear where appropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136056 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 04:41:47 +00:00
Chandler Carruth bf340e4523 Rename create(MacroArg)InstantiationLoc to create(MacroArg)ExpansionLoc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 03:03:05 +00:00
Chandler Carruth 96d3589e52 Rename SourceManager (and InstantiationInfo) isMacroArgInstantiation API
to isMacroArgExpansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136053 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 03:03:00 +00:00
Chandler Carruth 642116259e Rename getInstantiationLineNumber to getExpansionLineNumber in both
SourceManager and FullSourceLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 21:09:52 +00:00
Chandler Carruth a77c031cb6 Rename getInstantiationColumnNumber to getExpansionColumnNumber in both
SourceManager and FullSourceLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135965 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 20:57:57 +00:00
Chandler Carruth e7b2b6e87d Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135962 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 20:52:32 +00:00
Chandler Carruth f84ef95ece getInstantiationLocSlowCase -> getExpansionLocSlowCase
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 20:52:26 +00:00
Chandler Carruth 999f739404 Rename SourceManager::getImmediateInstantiationRange to
getImmediateExpansionRange.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135960 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 20:52:21 +00:00
Chad Rosier 822f54a7ba Allow target to specify about using minimum alignment vs preferred. Takes care of
FIXME: Override "preferred align" for double and long long for ARM apcs-gnu ABI. 
Also part of rdar://9802874

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135940 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 19:39:39 +00:00
Chandler Carruth edc3dccece Rename SourceManager::getInstantiationRange to getExpansionRange.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135915 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 16:56:02 +00:00
Chandler Carruth 402785357a Mechanically rename SourceManager::getInstantiationLoc and
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part
of the API and documentation update from 'instantiation' as the term for
macros to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135914 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25 16:49:02 +00:00
Chris Lattner 2d3ba4f5a9 Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon Mulder!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135855 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 17:14:25 +00:00
Chris Lattner 5f9e272e63 remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 10:55:15 +00:00
Bruno Cardoso Lopes 8c24d1a294 Define the _MIPS_SIM builtin macro on MIPS platforms. Patch by Robert Millan!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135675 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-21 15:10:57 +00:00
Chad Rosier d9259f373f Refactor r135502 to avoid an empty if else condition, per Eric's suggestion (good call!).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135510 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 20:00:06 +00:00
Chad Rosier b536a1565c Clang asserts "Invalid environment!" when using -ccc-host-triple
arch-pc-win32-macho (e.g., x86_64-pc-win32-macho), which appears to be a false
positive.
rdar://9786307

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 19:36:03 +00:00
Douglas Gregor f62d43d2af Revamp the SourceManager to separate the representation of parsed
source locations from source locations loaded from an AST/PCH file.

Previously, loading an AST/PCH file involved carefully pre-allocating
space at the beginning of the source manager for the source locations
and FileIDs that correspond to the prefix, and then appending the
source locations/FileIDs used for parsing the remaining translation
unit. This design forced us into loading PCH files early, as a prefix,
whic has become a rather significant limitation.

This patch splits the SourceManager space into two parts: for source
location "addresses", the lower values (growing upward) are used to
describe parsed code, while upper values (growing downward) are used
for source locations loaded from AST/PCH files. Similarly, positive
FileIDs are used to describe parsed code while negative FileIDs are
used to file/macro locations loaded from AST/PCH files. As a result,
we can load PCH/AST files even during parsing, making various
improvemnts in the future possible, e.g., teaching #include <foo.h> to
look for and load <foo.h.gch> if it happens to be already available.

This patch was originally written by Sebastian Redl, then brought
forward to the modern age by Jonathan Turner, and finally
polished/finished by me to be committed.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135484 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 16:10:42 +00:00
Chris Lattner 48b78bda3e simplify
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135170 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 18:45:41 +00:00
Chris Lattner 1e5f83ba51 StringMap::first() is about to start returning a StringRef, adapt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135166 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 18:24:21 +00:00
Bruno Cardoso Lopes e02d391ffe Disable avx feature from corei7-avx, and use -mavx for now. Right now, if -mavx is
specified, 128 avx code is used and we're not sure yet if this the behavior
we want (and if it does, some improvements are needed before relying on it).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134939 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11 23:33:46 +00:00
Bruno Cardoso Lopes 5af80aa821 Enable "avx" feature, so it can be seen by llvm
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134935 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11 22:50:13 +00:00
Chandler Carruth 0673cb3034 Apply patch from Richard Trieu to fix PR9548:
When two different types has the same text representation in the same
diagnostic message, print an a.k.a. after the type if the a.k.a. gives extra
information about the type.

class versa_string;

typedef versa_string string;

namespace std {template <typename T> class vector;}

using std::vector;

void f(vector<string> v);

namespace std {
class basic_string;
typedef basic_string string;
template <typename T> class vector {};
void g() {
  vector<string> v;
  f(v);
}
}

Old message:
----------------
test.cc:15:3: error: no matching function for call to 'f'
  f(&v);
  ^
test.cc:7:6: note: candidate function not viable: no known conversion from
      'vector<string>' to 'vector<string>' for 1st argument
void f(vector<string> v);
     ^
1 error generated.

New message:
---------------
test.cc:15:3: error: no matching function for call to 'f'
  f(v);
  ^
test.cc:7:6: note: candidate function not viable: no known conversion from
      'vector<string>' (aka 'std::vector<std::basic_string>') to
      'vector<string>' (aka 'std::vector<versa_string>') for 1st argument
void f(vector<string> v);
     ^
1 error generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134904 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11 17:49:21 +00:00
Eli Friedman c3e0fb406f Change -mno-mmx to be more compatible with gcc. Specifically, -mno-mmx should not imply -mno-sse.
Note that because we don't usually touch the MMX registers anyway, all -mno-mmx needs to do is tweak the x86-32 calling convention a little for vectors that look like MMX vectors, and prevent the definition of __MMX__.

clang doesn't actually stop the user from using MMX inline asm operands or MMX builtins in -mno-mmx mode; as a QOI issue, it would be nice to diagnose, but I doubt it really matters much.

<rdar://problem/9694837>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134770 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-08 23:31:17 +00:00
Evan Cheng f972b26368 Fix a FIXME in clang ARM driver that was exposed as a bug with ARM backend
change.

Previously clang was passing the following feature strings to the ARM backend
when CPU is cortex-a8: +neon,-vfp2,-vfp3

This used to work because -vfp2,-vfp3 had no effect after +neon. Now that the
features are controlled by individual bits (with implied hierarchy), the net
effect is all three features will be turned off.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134691 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-08 06:40:11 +00:00
Chandler Carruth c8d1ecca1c Keep track of which source locations are part of a macro argument
instantiation and improve diagnostics which are stem from macro
arguments to trace the argument itself back through the layers of macro
expansion.

This requires some tricky handling of the source locations, as the
argument appears to be expanded in the opposite direction from the
surrounding macro. This patch provides helper routines that encapsulate
the logic and explain the reasoning behind how we step through macros
during diagnostic printing.

This fixes the rest of the test cases originially in PR9279, and later
split out into PR10214 and PR10215.

There is still some more work we can do here to improve the macro
backtrace, but those will follow as separate patches.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134660 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 23:56:36 +00:00
Eric Christopher 7c9adf9113 Fix a typo in the fpsr register and add the fpcr register.
Fixes PR10299 and rdar://9740322

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134654 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 22:55:26 +00:00
Argyrios Kyrtzidis 7a759606d9 Move SourceManager::isAt[Start/End]OfMacroInstantiation functions to the Lexer, since they depend on it now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134644 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 21:54:45 +00:00
Joerg Sonnenberger 8e627066a0 FreeBSD gets FreeBSD target, just mipsel.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134619 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 17:01:45 +00:00
Argyrios Kyrtzidis b73377eeb3 Make the Preprocessor more memory efficient and improve macro instantiation diagnostics.
When a macro instantiation occurs, reserve a SLocEntry chunk with length the
full length of the macro definition source. Set the spelling location of this chunk
to point to the start of the macro definition and any tokens that are lexed directly
from the macro definition will get a location from this chunk with the appropriate offset.

For any tokens that come from argument expansion, '##' paste operator, etc. have their
instantiation location point at the appropriate place in the instantiated macro definition
(the argument identifier and the '##' token respectively).
This improves macro instantiation diagnostics:

Before:

t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
int y = M(/);
        ^~~~
t.c:5:11: note: instantiated from:
int y = M(/);
          ^

After:

t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
int y = M(/);
        ^~~~
t.c:3:20: note: instantiated from:
\#define M(op) (foo op 3);
                ~~~ ^  ~
t.c:5:11: note: instantiated from:
int y = M(/);
          ^

The memory savings for a candidate boost library that abuses the preprocessor are:

- 32% less SLocEntries (37M -> 25M)
- 30% reduction in PCH file size (900M -> 635M)
- 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134587 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 03:40:34 +00:00
Argyrios Kyrtzidis 8b86ef0b71 Fix bug in SourceManager::getDecomposedInstantiationLocSlowCase.
It would add up relative (decomposed) offsets like in getDecomposedSpellingLocSlowCase, but while
it makes sense to preserve the offset among lexed spelling locations, it doesn't make
sense to add anything to the offset of the instantiation location. The instantiation
location will be the same regardless of the relative offset in the tokens that were
instantiated.

This bug didn't actually affect anything because, currently, in practice we never create macro
locations with relative offset greater than 0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134586 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 03:40:27 +00:00
Argyrios Kyrtzidis d410e741e8 For -print-stats, add the number of bytes that SLocEntryTable consumes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134585 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 03:40:24 +00:00
Douglas Gregor 85bea9777d Keep track of when "unrecoverable" errors occur, then allow
clang_saveTranslationUnit() to save a PCH file if the only errors it
contains are recoverable errors. Fixes <rdar://problem/9727804>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134503 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-06 17:40:26 +00:00
Benjamin Kramer e855448bc8 SmallVectorize a critical vector.
The small number of elements was determined by taking the median
file length in clang+llvm and /usr/include on OS X with xcode installed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134496 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-06 16:43:46 +00:00
Joerg Sonnenberger caf01c5483 Fix C&P error
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134490 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-06 11:00:56 +00:00
Fariborz Jahanian 9670e179a6 objc-arc: enforce performSelector rules in rejecting retaining selectors
passed to it, and unknown selectors causing potential leak.
// rdar://9659270


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134449 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 22:38:59 +00:00
Eli Friedman e7e66f7222 Remove unused member of Builtin::Info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134443 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 21:53:01 +00:00
Joerg Sonnenberger 94c9ce54bf Hook up mipsel-netbsd and mipsel-freebsd for OS specific handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134425 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 18:24:04 +00:00
Joerg Sonnenberger fa9772b102 Use OS-specific configuration for mips-netbsd and mips-freebsd.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134422 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 18:05:54 +00:00
Joerg Sonnenberger 7cd1de5cc0 Don't define _BIG_ENDIAN for NetBSD/PowerPC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134411 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 14:56:12 +00:00
Joerg Sonnenberger 78542df709 Fix indentation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 14:54:41 +00:00
Joerg Sonnenberger 1a83b43d34 Add explicit default case for -Wswitch-enum.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134399 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-04 23:11:58 +00:00
Joerg Sonnenberger 9a11b7410a Use switch(os) style consistently. Add a bunch of NetBSD branches.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134393 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-04 21:59:44 +00:00
Joerg Sonnenberger 6ac26fae1a On PowerPC, both FreeBSD and NetBSD use ints for (s)size_t
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134392 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-04 21:57:55 +00:00
Eric Christopher aa7333c860 Update for llvm commit r134291.
Fixes rdar://9714064


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134292 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-02 00:20:22 +00:00
Douglas Gregor dca5226598 Add initial *-*-rtems* target, from Joel Sherrill
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134283 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 22:41:14 +00:00
Bob Wilson 949fd1aa67 Use preferred 64-bit alignment for i64 & f64 for Thumb targets. Radar 9695134.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134070 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 16:09:20 +00:00
Eric Christopher de31fd7eee Split out logic for valid clobbers and valid inline asm registers.
Fixes rdar://9281377


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134016 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 18:20:53 +00:00
Argyrios Kyrtzidis ed37ab82c7 SourceManager::isAtStartOfMacroInstantiation should check not only if the location
is at the first token but that the location's offset is not inside the token as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133800 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 17:28:26 +00:00
Jay Foad 65aa688581 Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133515 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-21 15:13:30 +00:00
Eric Christopher cfd323d0d4 Move additional register names to their own lookup, separate from
register aliases. Fixes unnecessary renames of clobbers.

Fixes part of rdar://9425559


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133485 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-21 00:05:20 +00:00
John McCall 1816442fd1 As a hopefully temporary workaround for a header mistake, treat
__bridge_retain as a synonym for __bridge_retained.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133295 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-17 21:23:37 +00:00
Eric Christopher dda231a4a7 Add some more memory constraints for ARM.
Part of rdar://9197685


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133225 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-17 01:40:49 +00:00
Eric Christopher 283f44752a On ARM make sure that we continue translating 'p' to 'r' for the
constraints.

rdar://9618597


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133222 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-17 00:40:18 +00:00
Evan Cheng 8bfa257f15 Stylistic fix: move virtual keyword before return type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133181 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16 19:13:15 +00:00
John McCall 098df7f1de Unconditionally #define the ARC ownership qualifiers, instead of #defining
them only on Darwin tool chains.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133112 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16 00:03:19 +00:00
John McCall f85e193739 Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 23:02:42 +00:00
John McCall 923cd5744a Generate enumerators for diagnostic categories. Patch by Argyrios!
Depends on LLVM r133093.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133094 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 21:46:43 +00:00
Benjamin Kramer 81f9d14f0b StaticDiagNameIndex is never written to, place it into .rodata.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132990 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-14 13:15:38 +00:00
Benjamin Kramer dbda513550 Put classes into anonymous namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132924 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-13 18:38:45 +00:00
Douglas Gregor 926df6cfab Implement Objective-C Related Result Type semantics.
Related result types apply Cocoa conventions to the type of message
sends and property accesses to Objective-C methods that are known to
always return objects whose type is the same as the type of the
receiving class (or a subclass thereof), such as +alloc and
-init. This tightens up static type safety for Objective-C, so that we
now diagnose mistakes like this:

t.m:4:10: warning: incompatible pointer types initializing 'NSSet *'
with an
      expression of type 'NSArray *' [-Wincompatible-pointer-types]
  NSSet *array = [[NSArray alloc] init];
         ^       ~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1:
note: 
      instance method 'init' is assumed to return an instance of its
      receiver
      type ('NSArray *')
- (id)init;
^

It also means that we get decent type inference when writing code in
Objective-C++0x:

  auto array = [[NSMutableArray alloc] initWithObjects:@"one",  @"two",nil];
  //    ^ now infers NSMutableArray* rather than id




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132868 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-11 01:09:30 +00:00
Stuart Hastings 6ce33d67e2 Followup to 132737; make two-character string explicit, add some
comments.  rdar://problem/9037836


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132752 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-08 16:06:31 +00:00
Stuart Hastings 002333f8b2 Clang support for ARM Uv/Uy/Uq inline-asm constraints.
rdar://problem/9037836


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132737 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-07 23:45:05 +00:00
Francois Pichet fe87b82447 My testing shows that function stat has no problem with trailing separators. (tested on Windows and Darwin).
This fixes a bug on Windows:
clang c:\test.cpp

Here the call stat("c:") is not recognized as a directory (must be "c:\").

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132539 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 09:44:29 +00:00
Akira Hatanaka 619e8875d2 Add stuff for o32 ABI conformance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132443 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-02 00:09:17 +00:00
Argyrios Kyrtzidis 469244a322 Add a couple of helper methods in the SourceManager API, isAtStartOfMacroInstantiation/isAtEndOfMacroInstantiation
useful only for source locations that point at a macro token.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132247 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-28 03:56:11 +00:00
Argyrios Kyrtzidis 477aab6782 A StringRef-ication of the DiagnosticIDs API and internals.
Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static
diagnostic data structures, which resulted in a huge global-var-init function.

Depends on llvm commit r132046.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132047 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-25 05:05:01 +00:00
Benjamin Kramer b65b672c7b sandybridge is now called corei7-avx
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131729 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-20 15:11:23 +00:00
Argyrios Kyrtzidis 5adc0515aa Do some safety checks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131491 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 22:09:53 +00:00
Bob Wilson 84f95cf115 Define __ARM_NEON__ in both ARM and Thumb modes. Radar 9431992.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131301 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 18:56:03 +00:00
John McCall 0e9972cccc __builtin_va_list is void* on ARM, not char*.
rdar://problem/9391966



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131080 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-09 02:19:37 +00:00
Argyrios Kyrtzidis e59abb56ce Introduce a Diagnostic::Report function that accepts and emits a StoredDiagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130919 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05 07:54:59 +00:00
Daniel Dunbar cb65de1b21 Revert r130750, "Make the mno flags match GCC. Patch by Alexander Best!", it breaks tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130753 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-03 15:34:01 +00:00
Michael J. Spencer d8b9d68754 Make the mno flags match GCC. Patch by Alexander Best!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130750 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-03 04:35:54 +00:00
Ted Kremenek f61b831d7f Enhance clang_getCXTUResourceUsage() to report how much memory is used by SourceManager's memory buffers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130433 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28 20:36:42 +00:00
Eric Christopher 4d53be4a47 Remove this assert, I don't think it's being helpful and people have
been running into it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130296 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 05:48:06 +00:00
Jay Foad f1cc1d0efd Like the coding standards say, do not use "using namespace std".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-23 09:06:00 +00:00
Argyrios Kyrtzidis 144bc08f5f Don't hide #warnings in a system header, same as gcc. Fixes rdar://8495837.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129951 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 23:08:23 +00:00
Argyrios Kyrtzidis cfdadfe547 Move the check whether a diagnostic must be ignored because it is in a system header
inside DiagnosticIDs::getDiagnosticLevel.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129950 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 23:08:18 +00:00
Daniel Dunbar 8a3a7f36ae Driver/Darwin: Allow OS X deployment targets like 10.4.11, even though they
can't be represented in the environment define.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129939 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 21:27:33 +00:00
Justin Holewinski 285dc6530b PTX: Add PTX intrinsics as builtins and add ptx32 and ptx64 as valid architectures for triples, e.g. ptx32-unknown-unknown
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129870 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-20 19:34:15 +00:00
Douglas Gregor e23ac65af5 Teach SourceManager::getSLocEntry() that it can fail due to problems
during deserialization from  a precompiled header, and update all of
its callers to note when this problem occurs and recover (more)
gracefully. Fixes <rdar://problem/9119249>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129839 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-20 00:21:03 +00:00
Daniel Dunbar a4ff648d4a TWEAK
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129835 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 23:34:21 +00:00
Daniel Dunbar 659d23a4e6 Driver/Darwin: Switch to using -macosx for OS name in triples.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129834 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 23:34:17 +00:00
Daniel Dunbar db57a4cdb0 ADT/Triple: Switch to using .isOSDarwin() predicate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129823 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 21:43:27 +00:00
Daniel Dunbar 0d027ba3e5 Basic/Darwin: Add support for new -osx and -ios style triples (not yet used).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129820 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-19 21:40:34 +00:00
Ted Kremenek 97f55d6ffd Add SelectorTable::getTotalMemory() to allow clients to query how much memory is used by selectors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129728 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-18 22:47:04 +00:00
Michael J. Spencer b24bac98aa Make -mno-mmx imply -mno-3dnow. This is what gcc does, and it makes sense.
Also, fold the sse4 and sse4.1 cases together.

Patch by Alexander Best!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129665 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 19:22:03 +00:00
Douglas Gregor 7d2b8c1fcc Initial work to improve documentation for Clang's diagnostics, from Matthieu Monrocq
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129614 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 22:04:17 +00:00
Chris Lattner fc8f0e14ad fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 05:22:18 +00:00
Peter Collingbourne 7e7fbd05a5 C1X: add a language standard
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129553 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 00:35:23 +00:00
John McCall a5fc472b35 Fix a bunch of major problems with __unknown_anytype and properly test
for them.  The only major missing feature is references.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129234 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 22:50:59 +00:00
Dylan Noblesmith 67922922cf refactor flags for TokenKinds.def
Make KEYALL a combination of all other flags instead
of its own separate flag. Also rewrite the enum
definitions in hex instead of decimal.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129213 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 13:34:05 +00:00
Eric Christopher 156119df1d Eat the UTF-8 BOM at the beginning of a file since it's ignored anyhow.
Nom Nom Nom.

Patch by Anton Korobeynikov!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129174 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 00:01:04 +00:00
Roman Divacky bcaa3b8f1a Enable sse4 and aes for SandyBridge. Leave avx support commented out for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128923 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-05 20:32:44 +00:00
Sandeep Patel 3a41d145e4 Explain why layout prefers 32 for small types on Thumb.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128850 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-04 22:58:12 +00:00
Bob Wilson cd5ce091a1 Change ARM data layout strings to match llvm-gcc.
Sandeep Patel noticed that the alignment was wrong for Neon vector types,
and this change is partly derived from his patch.  For the APCS ABI, however,
additional changes were required: the maximum ABI alignment is 32 bits and
the preferred alignment for i64 and f64 types should be 64 bits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128825 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-04 16:53:11 +00:00
Daniel Dunbar ad1a4c6e89 Change Clang's __VERSION__ to include the same basic info as in clang -v.
- Please never ever ever ever write a tool that sniffs this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128599 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-31 00:53:51 +00:00
Daniel Dunbar 9a4a9c25fc Basic: Add support for a build variable to set the repository path that goes
into the Clang version.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128595 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-31 00:32:50 +00:00
Argyrios Kyrtzidis dc0a2da103 For Diagnostic::Reset() also reset the state related to #pragma diagnostic. Fixes rdar://9170766.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128346 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-26 18:58:17 +00:00
Douglas Gregor 0a0d2b1790 Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

  void foo()
  __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

  - If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
    will result in a deprecation warning, as if we had placed
    attribute((deprecated)) on it (but with a better diagnostic)
  - If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
    will result in an "unavailable" warning (in C)/error (in C++), as
    if we had placed attribute((unavailable)) on it
  - If we choose a deployment target prior to 10.2, foo() is
    weak-imported (if it is a kind of entity that can be weak
    imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128127 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 00:50:03 +00:00
Eli Friedman d9c3fa30bc Make the definition of "long double" consistent for llvm::Triple::Win32 for
both 32-bit and 64-bit targets.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128110 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 21:25:11 +00:00
Bob Wilson a291d5fb78 Another cortex-m0 patch from James Orr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128029 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 21:55:25 +00:00
Ted Kremenek cd1eecfe4f Relax assertion to fail during crash recovery cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128010 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 18:40:10 +00:00
Ted Kremenek 03201fbbde Use CrashRecoveryContextCleanup objects to reclaim resources from CompilerInstance objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128009 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 18:40:07 +00:00
Daniel Dunbar 9ae186f7ca Unbreak build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127942 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 02:06:21 +00:00
Peter Collingbourne 207f4d8543 Add support for language-specific address spaces. On top of that,
add support for the OpenCL __private, __local, __constant and
__global address spaces, as well as the __read_only, _read_write and
__write_only image access specifiers.  Patch originally by ARM;
language-specific address space support by myself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127915 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 22:38:29 +00:00
Anders Carlsson 7dbafb3ade Add FileManager::getNoncachedStatValue, which will resolve relative paths against the working directory specified in the file system options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127893 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 19:23:19 +00:00
Argyrios Kyrtzidis 3cd0128ce4 Having FileManager::getFile always open the file, brought much consternation and leaking of file descriptors.
Add 'openFile' bool to FileManager::getFile to specify whether we want to have the file opened or not, have it
false by default, and enable it only in HeaderSearch.cpp where the open+fstat optimization matters.

Fixes rdar://9139899.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127748 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 19:17:25 +00:00
NAKAMURA Takumi 853134a0ba lib/Basic/Targets.cpp: __declspec(attr) should be provided on mingw as macro, alias of __attribute__.
On mingw without -fms-extensions, we can provide "as-is" __declspec.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127655 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 02:32:50 +00:00
Argyrios Kyrtzidis a8d530e3ad Stop leaking file descriptors.
After the open+fstat optimization, files were already opened for FileManager::getBufferForFile() and we closed them after reading them.
The problem was that when -working-directory was passed, the code path that actually reuses & closes the already opened file descriptor
was not followed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127639 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 00:47:44 +00:00
Anders Carlsson 2e2468e2d2 Get rid of the static FileManager::FixupRelativePath.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127573 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 01:13:54 +00:00
Argyrios Kyrtzidis 299a4a967b Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true the SourceManager
should report the original file name for contents of files that were overriden by other files,
otherwise it should report the name of the new file. Default is true.

Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127289 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 23:35:24 +00:00
NAKAMURA Takumi 17c964ad98 lib/Basic/Targets.cpp: mingw-w64 should define __MINGW32__, too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127238 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 12:06:46 +00:00
Anders Carlsson 03fd362dbf Check in the implementation as well...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127144 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 01:28:33 +00:00
Anders Carlsson af036a6c25 Convert FileManager::FixupRelativePath over to using PathV2.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127133 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 22:25:35 +00:00
Argyrios Kyrtzidis b1c86492f9 Currently we can only remap a file by creating a MemoryBuffer and replacing the file contents with it.
Allow remapping a file by specifying another filename whose contents should be loaded if the original
file gets loaded. This allows to override files without having to create & load buffers in advance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 01:03:53 +00:00
John McCall 85f3d76c0e Move some of the logic about classifying Objective-C methods into
conventional categories into Basic and AST.  Update the self-init checker
to use this logic;  CFRefCountChecker is complicated enough that I didn't
want to touch it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126817 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 01:50:55 +00:00
Ted Kremenek 7decebfc7b Teach TextDiagnosticPrinter to print out '-Werror' in addition to the warning flag for a warning mapped to an error.
For example:

t.c:7:9: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126466 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-25 01:28:26 +00:00
Chandler Carruth 5ef04ee40c Switch the VerifyDiagnosticsClient to use PresumedLocs now that they
exist. Cheat and do this by adding some wrappers around the PresumedLoc
machinery that directly return the line and column number.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126281 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-23 00:47:48 +00:00
Daniel Dunbar e177d3b744 Targets/Darwin: mcount name on Darwin needs to be unmangled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126152 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-21 23:12:51 +00:00
Richard Smith 26ed5f1b0d Test commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126063 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-20 00:59:54 +00:00
Peter Collingbourne 4b93d660c6 Re-instate r125819 and r125820 with no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126060 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 23:03:58 +00:00
Rafael Espindola 96b1d4b4eb Revert 125820 and 125819 to fix PR9266.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126050 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 21:39:31 +00:00
Douglas Gregor 813d834652 Selector::getIdentifierInfoForSlot() can return NULL values, a fact
that was ignored in a few places (most notably, code
completion). Introduce Selector::getNameForSlot() for the common case
where we only care about the name. Audit all uses of
getIdentifierInfoForSlot(), switching many over to getNameForSlot(),
fixing a few crashers.

Fixed <rdar://problem/8939352>, a code-completion crasher.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125977 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 22:29:55 +00:00
NAKAMURA Takumi c910929785 [Heikki Kultala] This patch contains the ABI changes for the TCE target.
TCE target has some too strict alignment rules (that the HW really does not require, but which caused problems elsewhere) for data types and an ABI change was decided.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125833 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 08:44:38 +00:00
Peter Collingbourne ef9a1d0e13 Move TargetInfo::adjustInlineAsmType to TargetCodeGenInfo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125819 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 02:24:56 +00:00
NAKAMURA Takumi 0aa205765a 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125742 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17 08:51:38 +00:00
Douglas Gregor 37c02bf479 Fix a thinko with llvm::Optional, which is clearly the most dangerous class template in the universe
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125679 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16 19:09:24 +00:00
Peter Collingbourne f315fa81ee OpenCL: add support for __kernel, kernel keywords and EXTENSION,
FP_CONTRACT pragmas.  Patch originally by ARM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125475 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-14 01:42:53 +00:00
Jeffrey Yasskin 0a86d44703 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125417 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 23:46:38 +00:00
Zhanyong Wan 21af8878b9 Uses llvm::sys::path instead of hand-rolled algorithm in FileManager.
Reviewed by dgregor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125407 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 21:25:35 +00:00
Zhanyong Wan 9b555ea217 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125384 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 18:44:49 +00:00
Douglas Gregor b7a1841244 Don't compare llvm::Optional<> objects directly; compare their
contents when it's safe. I just *love* C++ some days.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125378 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 18:08:15 +00:00
Douglas Gregor cfbf1c7536 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125286 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 17:09:37 +00:00
Roman Divacky be4c8705e4 Implement mcount profiling, enabled via -pg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125282 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 16:52:03 +00:00
NAKAMURA Takumi 886e1606c2 CMake: LLVM_NO_RTTI must be obsolete now!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125275 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 09:15:32 +00:00
Rafael Espindola 100f239df9 Update for API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125129 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 22:44:16 +00:00
Douglas Gregor 8ef6c8cb6c Improve our uniquing of file entries when files are re-saved or are
overridden via remapping. Thus, when we create a "virtual" file in the
file manager, we still stat() the real file that lives behind it so
that we can provide proper uniquing based on inodes. This helps keep
the file manager much more consistent.

To take advantage of this when reparsing files in libclang, we disable
the use of the stat() cache when reparsing or performing code
completion, since the stat() cache is very likely to be out of date in
this use case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124971 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 19:42:43 +00:00
Douglas Gregor 4814fb5603 If any Fix-Its attached to a diagnostic have invalid source locations
or source locations that refer into a macro instantiation, delete all
of the Fix-Its on that diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124833 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 23:41:12 +00:00
Douglas Gregor 86a4d0dd6a Teach SourceManager::getLocation() how to cope with a source file
whose inode has changed since the file was first created and that is
being seen through a different path name (e.g., due to symlinks or
relative path elements), such that its FileEntry pointer doesn't match
a known FileEntry pointer. Since this requires a system call (to
stat()), we only perform this deeper checking if we can't find the
file by comparing FileEntry pointers.

Also, add a micro-optimization where we don't bother to compute line
numbers when given the location (1, 1). This improves the
efficiency of clang_getLocationForOffset().
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124800 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 17:17:35 +00:00
Rafael Espindola 50ae3e3f10 Revert 124754 and 124760 as they made clang unusable in the presence of symbolic
links.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124776 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 04:35:45 +00:00
Douglas Gregor b9d4cb3881 Improve the performance of filename canonicalization by avoiding
redundant searches in the string. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124760 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 00:18:12 +00:00
Douglas Gregor aa596e8770 Canonicalize path names in the file manager before performing a lookup
on that name. Canonicalization eliminates silliness such as "." and
"foo/.." that breaks the uniquing of files in the presence of virtual
files or files whose inode numbers have changed during
parsing/re-parsing. c-index-test isn't able to create this crazy
situation, so I've resorted to testing outside of the Clang
tree. Fixes <rdar://problem/8928220>.

Note that this hackery will go away once we have a real virtual file
system on which we can layer FileManager; the virtual-files hack is
showing cracks.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124754 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02 22:30:17 +00:00
Douglas Gregor fb7049a219 Support EFI target triple, from Carl Norum!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124660 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 15:06:18 +00:00
Douglas Gregor 3de84241d9 Harden Lexer::GetBeginningOfToken() against bogus source locations and
the disappearance/alteration of files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124616 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-31 22:42:36 +00:00
Douglas Gregor 4f5e21e24f Teach Diagnostic::setClient() to free the existing, owned
client. Fixes a libclang leak.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124614 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-31 22:04:05 +00:00
Douglas Gregor 418df343bb Separate the access-control diagnostics from other diagnostics that do not have SFINAE behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124441 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 21:06:28 +00:00
Axel Naumann 04331169f0 TextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with invalid PresomedLoc, instead of just silencing it.
FileManager.cpp: Allow virtual files in nonexistent directories.
FileManager.cpp: Close FileDescriptor for virtual files that correspond to actual files.
FileManager.cpp: Enable virtual files to be created even for files that were flagged as NON_EXISTENT_FILE, e.g. by a prior (unsuccessful) addFile().

ASTReader.cpp: Read a PCH even if the original source files cannot be found.

Add a test for reading a PCH of a file that has been removed and diagnostics referencing that file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124374 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 10:55:51 +00:00
NAKAMURA Takumi 79521990f7 lib/Basic/Targets.cpp: __builtin_va_list is as same on win64 mingw64!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123691 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 22:56:23 +00:00
NAKAMURA Takumi 1b24cd3475 lib/Basic/Targets.cpp: Fix __declspec() on Mingw-w64.
It should be defined as-is. Some headers would detect existence of __declspec and use one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123690 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 22:56:16 +00:00
NAKAMURA Takumi 8c959d92de lib/Basic/Targets.cpp: Set user_label_prefix on Win64 both mingw and msvc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123689 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 22:56:08 +00:00
Argyrios Kyrtzidis 3efd52cf8f Properly propagate #pragma diagnostic mappings from PCH but not command-line warning flags.
Addresses rdar://8435969&8852495

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123462 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 20:54:07 +00:00
Douglas Gregor 12e8464da2 wint_t is defined as 'unsigned int' on Linux. Fixes PR8938.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123320 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 21:19:25 +00:00
Fariborz Jahanian f84109ee6a Update AST reader/writer to handle new AppleKext.
Fix an unexpected hickup caused by exceeding size of
generated table (and a misleading comment). Improve
on help message for -fapple-kext.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123003 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 18:59:25 +00:00
Bob Wilson 06f45635dd Add cortex-m3 CPU to getCPUDefineSuffix mapping.
Patch by Sylvère Teissier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122965 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 16:57:20 +00:00
Roman Divacky c81f2a2c7f PowerPC fixes.
Fix the width and align of bool type on Darwin to be 32bits
while keeping it 8 everywhere else.

Change the definition of va_list to default to SV4 ABI one
and let darwin subtarget override this.

Both changes submitted by Nathan Whitehorn and reviewed
by Rafael Espindola.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122956 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-06 08:27:10 +00:00
Roman Divacky c8b09a1fa2 set features for k8-sse3
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-29 13:28:29 +00:00
Chris Lattner 3f59c975aa The -fshort-wchar option causes wchar_t to become unsigned, in addition to being
16-bits in size.  Implement this by splitting WChar into two enums, like we have
for char.  This fixes a miscompmilation of XULRunner, PR8856.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122558 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-25 23:25:43 +00:00
Argyrios Kyrtzidis ee933e1cc2 Handle locations coming from macro instantiations properly in SourceManager::isBeforeInTranslationUnit().
Fixes rdar://8790245 and http://llvm.org/PR8821.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 02:53:53 +00:00
Douglas Gregor b68e39930d In C++, if the user redeclares a builtin function with a type that is
inconsistent with the type that the builtin *should* have, forget
about the builtin altogether: we don't want subsequence analyses,
CodeGen, etc., to think that we have a proper builtin function.

C is protected from errors here because it allows one to use a
library builtin without having a declaration, and detects inconsistent
(re-)declarations of builtins during declaration merging. C++ was
unprotected, and therefore would crash.

Fixes PR8839.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122351 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 19:47:46 +00:00
Michael J. Spencer fbfd180495 Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122340 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 16:45:57 +00:00
Nick Lewycky 403ba3522d Add missing standard includes. Patch by Joerg Sonnenberger!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122194 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:49:25 +00:00
Michael J. Spencer 256053b31e Replace all uses of PathV1::isAbsolute with PathV2::is_{absolute,relative}.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122087 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 21:22:22 +00:00
Michael J. Spencer 4eeebc464e MemoryBuffer API update.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121956 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 03:28:14 +00:00
Argyrios Kyrtzidis 0827408865 Fix diagnostic pragmas.
Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state.
Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect
a lot of places, like C++ inline methods, template instantiations, the lexer, etc.

Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location.

Fixes rdar://8365684.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 18:44:22 +00:00
Wesley Peck a48fa4bdf7 Change MBlaze target to have the same description string as its LLVM equivalent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121640 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-12 20:56:47 +00:00
Michael J. Spencer 3a321e23f6 Use error_code instead of std::string* for MemoryBuffer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 17:36:38 +00:00
Chris Lattner c0f31fd085 attempt to fix a buildbot failure, apparently apache fails to build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120688 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 04:27:29 +00:00
Fariborz Jahanian 67aba81690 Such function decls,as objc's objc_msgSend, builtins in
a specific language. We are adding such language info. by
extensing Builtins.def and via a language flag added
to LIBBUILTIN/BUILTIN and check for that when deciding
a name is builtin or not. Implements //rdar://8689273.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120429 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 17:35:24 +00:00
Michael J. Spencer 03013fa9a0 Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120297 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:12:39 +00:00
Francois Pichet 0d4739abf6 Fix 2 problems with Chris Lattner's FileManager redesign on Windows.
- FileEntry::operator= is needed on Win32.
- There was an error in the S_ISDIR() macro.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120079 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 03:07:43 +00:00
Chris Lattner 5cc1c738b0 The final result of all this refactoring: instead of doing stat immediately
followed by an open for every source file we open, probe the file system with
'open' and then do an fstat when it succeeds.  open+fstat is faster than
stat+open because the kernel only has to perform the string->inode mapping
once.  Presumably it gets faster the deeper in your filesystem a lookup
happens.

For -Eonly on cocoa.h, this reduces system time from 0.042s to 0.039s on
my machine, a 7.7% speedup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120066 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 22:32:37 +00:00
Chris Lattner b2b93c12d7 if we succeed in opening a directory but expected a file, ensure we don't
leak a filedescriptor if a client ever starts returning one.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120062 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 21:53:56 +00:00
Chris Lattner 291fcf0298 hopefully resolve the windows buildbot issue (retch)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 21:53:15 +00:00
Chris Lattner 898a061f69 change the 'is directory' indicator to be a null-or-not
pointer that is passed down through the APIs, and make
FileSystemStatCache::get be the one that filters out
directory lookups that hit files.  This also paves the
way to have stat queries be able to return opened files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120060 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 21:17:56 +00:00
Chris Lattner f9f7766846 pull "is directory" handling into FileManager::getStatValue
which simplifies clients and is important for future directions.
Add a FD member to FileEntry which isn't used but will be shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120056 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:50:22 +00:00
Chris Lattner f3e8a9961d tidy up code, add a comment about dir caching.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120048 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:30:42 +00:00
Chris Lattner 72f6130a17 replicate a terrible hack to fix a build error on VC++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:07:39 +00:00
Chris Lattner d6f6111980 simplify the cache miss handling code, eliminating CacheMissing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120038 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:05:15 +00:00
Chris Lattner 11aa4b03b0 factor the "cache miss" handling code out of FM into a static
method in FileSystemStatCache.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120037 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 19:56:39 +00:00
Chris Lattner f8f6129861 r120013 dropped passing in the precomputed file size to
MemoryBuffer::getFile, causing us to pick up a fstat for
every file.  Restore the optimization.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 19:38:22 +00:00
Chris Lattner 74e976ba4b PCH files only cache successful stats. Remove the code that reads/writes
the result code of the stat to/from the PCH file since it is always 0.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120031 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 19:28:12 +00:00
Chris Lattner 10e286aa8d rework the stat cache, pulling it out of FileManager.h into
its own header and giving it some more structure.  No 
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120030 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 19:19:34 +00:00
Chris Lattner 75dfb65c38 tidy up. Split FileManager::getBufferForFile into
two copies, since they are fundamentally different
operations and the StringRef one should go away
(it shouldn't be part of FileManager at least).

Remove some dead arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120013 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 09:19:42 +00:00
Chris Lattner b088cd3138 reduce indentation and use early outs, to make it easier to read
this code. no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 08:50:03 +00:00
Chris Lattner 39b49bcaad now the FileManager has a FileSystemOpts ivar, stop threading
FileSystemOpts through a ton of apis, simplifying a lot of code.
This also fixes a latent bug in ASTUnit where it would invoke
methods on FileManager without creating one in some code paths
in cindextext.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120010 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 08:35:12 +00:00
Chris Lattner 7ad97ffa63 give FileManager a 'FileSystemOptions' ivar, which will be used
to simplify a bunch of code in it.  It should ultimately get inlined
into FileManager.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120007 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 07:51:02 +00:00
Chris Lattner 151466a186 Partially revert Doug's PCH validation patch (r98585).
This patch completely defeated the "passing in a prestat'd size 
to MemoryBuffer" optimization, leading to an extra fstat call for
every buffer opened, in order to find out if the datestamp and size 
of the file on disk matches what is in the stat cache.

I fully admit that I don't completely understand what is going on here:
why punish code when a stat cache isn't in use?  what is the point of a
stat cache if you have to turn around and stat stuff to validate it?

To resolve both these issues, just drop the modtime check and check the
file size, which is the important thing anyway.  This should also resolve
PR6812, because presumably windows is stable when it comes to file sizes.
If the modtime is actually important, we should get it and keep it on the
first stat.

This eliminates 833 fstat syscalls when processing Cocoa.h, speeding up
system time on -Eonly Cocoa.h  from 0.041 to 0.038s.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120001 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 06:09:11 +00:00
Chris Lattner 67452f51ae stringref'ize API
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119997 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 04:45:28 +00:00