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

1006 Коммитов

Автор SHA1 Сообщение Дата
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
Chris Lattner efc4be242b avoid creating sys::Path instances when -fworking-directory isn't being used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119995 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 04:33:43 +00:00
Benjamin Kramer aa8b2d95bc Filename.rfind("/\\") won't give us the position of the last directory seperator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-21 11:32:22 +00:00
Chris Lattner f69a1f319b change the various getFile routines to use StringRef as their implementation form.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119934 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-21 09:50:16 +00:00
Benjamin Kramer a6a32e2953 Initialize StoredDiagnostic's members in order.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119808 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 17:36:51 +00:00
Douglas Gregor aa5f135f8d Extend the libclang diagnostic API to provide information about the
option name, category ID, and category name corresponding to a diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119802 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 16:18:16 +00:00
Benjamin Kramer 3bbe0b033e Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119741 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 21:19:52 +00:00
Argyrios Kyrtzidis f2224d89a6 Since multiple diagnostics can share one diagnostic client, have the client keeping track
of the total number of warnings/errors reported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 20:06:46 +00:00
Argyrios Kyrtzidis 33e4e70c8c Refactoring of Diagnostic class.
-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
   SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119730 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 20:06:41 +00:00
Benjamin Kramer 5807d9cce3 Fix a typo in the UTF-8 BOM (PR8645). Use a StringSwitch while at it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119698 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 12:46:39 +00:00
Douglas Gregor cb7b1e17b6 Make sure to always check the result of
SourceManager::getPresumedLoc(), so that we don't try to make use of
an invalid presumed location. Doing so can cause crashes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118885 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12 07:15:47 +00:00
Bruno Cardoso Lopes 9284d21502 Add support for soft/hard float options to the Sparc target
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118514 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 17:21:19 +00:00
Rafael Espindola 19ddda83f9 Include System/DataTypes.h in Diagnostic.h to get intptr_t.
Set Haiku's UserLabelPrefix to "".
Patch by Paul Davey.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118510 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 16:41:02 +00:00
Argyrios Kyrtzidis 389db16c63 Implement -working-directory.
When -working-directory is passed in command line, file paths are resolved relative to the specified directory.
This helps both when using libclang (where we can't require the user to actually change the working directory)
and to help reproduce test cases when the reproduction work comes along.

--FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains
 the working directory value if set).
--FileSystemOptions are passed around to various interfaces that perform file operations.
--Opening & reading the content of files should be done only through FileManager. This is useful in general since
 file operations will be abstracted in the future for the reproduction mechanism.

FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same
FileManager but with different FileSystemOptions.

Addresses rdar://8583824.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118203 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 22:45:23 +00:00
Anders Carlsson 79ca1ee4b6 When setting a tied check if it's already tied. If it's tied to another constraint it's invalid. Fixes PR3905.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 02:54:51 +00:00
Anders Carlsson 86eda39c8a A number in an input constraint can't point to a read-write ('+') constraint. Fixes PR3904.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118145 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 02:22:29 +00:00
Douglas Gregor c417fa0244 Teach SourceManager::getPresumedLoc() how to fail gracefully if getLineNumber/getColumnNumber fail
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 00:39:22 +00:00
Chris Lattner 3248854a5d Rename alignof -> alignOf to avoid irritating C++'0x compilers,
PR8423


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 05:14:06 +00:00
Dale Johannesen 1e592cba6b Handle Type.h a better way.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117743 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 23:24:33 +00:00
Dale Johannesen f6e2c2039f Generate bitcasts going in and out of MMX parameters
in asm's.  PR 8501, 8602988.
I don't like including Type.h where it is; the idea was
to get references to X86_MMXTy out of the common code.
Maybe there's a better way?



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117736 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 23:12:32 +00:00
Dale Johannesen d145535546 Ahem. Add rest of D and Q registers to ARM inline asm handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117517 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 01:05:37 +00:00
Dale Johannesen 20eb49b503 Add D and Q register names to ARM inline asm handling.
No aliasing is needed, these work as given in the BE.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117508 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 23:34:42 +00:00
Dan Gohman 0d06e99891 getOrCreateContentCache never returns null, so overrideFileContents
doesn't need its return value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117393 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 20:47:28 +00:00
Chandler Carruth 14bd96571e Update remaining attribute macros to new style.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117204 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-23 08:44:57 +00:00
Dale Johannesen cee5501857 Change handling of inline asm 'p' constraint to match llvm-gcc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117149 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 21:07:10 +00:00
Oscar Fuentes 8523d81f3e Don't try to guess svn version when current path is a symlink.
See PR 8473.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117110 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 17:16:39 +00:00
Francois Pichet 4f74d021d0 Revert r117005, WIN32 is not predefined after all.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117026 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 16:14:56 +00:00
Francois Pichet 1a6f72df4b MSVC defines WIN32 as a predefined macro.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117005 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 09:39:28 +00:00
Michael J. Spencer a764e8395a Targets: Fix MinGW and VisualStudio predefined macros.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 08:22:51 +00:00
Michael J. Spencer dae4ac4fe5 Reorganize predefined macros for all Windows targets.
This adds an option to set the _MSC_VER macro without
recompiling. This is very useful when testing compatibility
with the Windows SDK and c++stdlib headers.

-fmsc-version=<version> (defaults to VS2003 (1300))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116999 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 05:21:48 +00:00
Michael J. Spencer 20249a1af2 Fix Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 03:16:25 +00:00
Michael J. Spencer 542ad38e2b Revert "Cleanup and fix predefined macros for windows."
Didn't realize this was on my branch ;/.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 03:14:35 +00:00
Michael J. Spencer 712392e4de Cleanup and fix predefined macros for windows.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116988 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 03:13:04 +00:00
Michael J. Spencer e2ef189b05 CodeGen: Fix long double on Windows using MSVC runtime.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116700 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 07:11:10 +00:00
Michael J. Spencer 237cf582b8 Fix Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 07:10:59 +00:00
Douglas Gregor 95f4292cc5 When performing typo correction, look through the set of known
identifiers to determine good typo-correction candidates. Once we've
identified those candidates, we perform name lookup on each of them
and the consider the results. 

This optimization makes typo correction > 2x faster on a benchmark
example using a single typo (NSstring) in a tiny file that includes
Cocoa.h from a precompiled header, since we are deserializing far less
information now during typo correction.

There is a semantic change here, which is interesting. The presence of
a similarly-named entity that is not visible can now affect typo
correction. This is both good (you won't get weird corrections if the
thing you wanted isn't in scope) and bad (you won't get good
corrections if there is a similarly-named-but-completely-unrelated
thing). Time will tell whether it was a good choice or not.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116528 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 22:11:03 +00:00
John McCall e53a44bcd3 Teach Diagnostic to recursively expand inside %plural formats.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 01:55:31 +00:00
Douglas Gregor 3a43d8df59 _Bool is not a keyword in C++. Fixes PR7388 and PR8349.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 20:00:38 +00:00
Douglas Gregor b535041ee3 Fix a silly bug in the suppression of non-error diagnostics in a
SFINAE context, where we weren't getting the right diagnostic argument
count. I blame DiagnosticBuilder's weirdness. Fixes PR8372.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116411 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 17:22:14 +00:00
Daniel Dunbar 83e18f8060 Basic: Tweak attempt to make version tags work from 'svn export's again, clip
off the extra parts of the $URL$ SVN keyword.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116269 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 23:50:34 +00:00
Daniel Dunbar 7171f2aaf9 Basic: Attempt to make version tags work from 'svn export's again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116268 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 23:44:19 +00:00
Douglas Gregor d3ab63e0f6 Eliminate -fdiagnostics-binary and all of the infrastructure for
emitting diagnostics in a binary form to be consumed by libclang,
since libclang no longer does any of its work out-of-process, making
this code dead. Besides, this stuff never worked at 100% anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 22:02:06 +00:00
Chris Lattner 757e685512 Per discussion with Sanjiv, remove the PIC16 target from mainline. When/if
it comes back, it will be largely a rewrite, so keeping the old codebase
in tree isn't helping anyone.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 05:44:49 +00:00
Daniel Dunbar ddb6c8df46 Driver: When clang is built with a VENDOR set, include the base LLVM version in
the version information, to help prevent user confusion about vendor version
numbers vs. LLVM version numbers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115915 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 15:00:30 +00:00
Zhanyong Wan 1f24e11769 Fix handling of the 'Invalid' argument in SourceManager's methods (patch by Dean Sturtevant, reviewed by chandlerc and Sebastian Redl).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115638 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-05 17:56:33 +00:00
Daniel Dunbar 16a8fb7e9d Basic: Simplify getClangRepositoryPath and getClangRevision.
- I don't like returning StringRef's ever, unless it is actually important for
   performance, which it isn't here.

 - Also, stop validating getClangRevision to be an integer, I don't see a good
   reason to do this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115071 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 19:15:29 +00:00
Daniel Dunbar 640cf37c94 Basic: Add support for git svn to get the repo version in clang executable,
patch by Jonathan Mulder!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115049 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 17:57:10 +00:00
John Thompson 7ccc58f9ff Fixed pr20314-2.c failure, added E, F, p constraint letters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114490 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 22:04:54 +00:00
John Thompson 2f474ea9ef Added '|' delimiter to separate inline asm multiple alternative constraints for Clang side of support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114253 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-18 01:15:13 +00:00
Cameron Esfahani 1484e0da64 Fix Windows64 target info so pointer arithmetic is done correctly, and no sign extension code is emitted: PtrDiffType needs to be a signed long long. Add a corresponding test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113910 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 00:28:12 +00:00
Michael J. Spencer 560a921b85 Revert "CMake: Update to use standard CMake dependency tracking facilities instead"
This reverts commit r113631

Conflicts:

	CMakeLists.txt
	lib/CodeGen/CMakeLists.txt

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113817 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 23:54:41 +00:00
Michael J. Spencer 5a7f34958c CMake: Update to use standard CMake dependency tracking facilities instead
of whatever we were using before...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113631 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 21:13:16 +00:00
Dale Johannesen 0f048a44b5 Allow 'o' and 'V' as constraints for output asm operands.
Allow '<' and '>' as constraints for input or output.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113246 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 18:40:41 +00:00
Dawn Perchik 52fc314e1b Add symantic support for the Pascal calling convention via
"__attribute((pascal))" or "__pascal" (and "_pascal" under
-fborland-extensions).  Support still needs to be added to llvm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 01:29:35 +00:00
Chris Lattner f13721dd91 Add support for windows x86-64 varargs, patch by Cameron Esfahani!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112603 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 16:44:54 +00:00
Dan Gohman 3f86b789f5 Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112219 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 21:27:06 +00:00
Dale Johannesen 545be51fdf Add some missing X86-specific asm constraint letters, and fix
some bugs in setting allowsRegister on the ones there.
8348447.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111980 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 22:33:12 +00:00
Chris Lattner c070da46b8 fix PR7953 - Windows filename are case insensitive:
#pragma once wasn't working on win32 if the header file was included
using a different case.
I tracked down  the problem to the fact that clang::FileManager was
caching files using case sensitive string (UniqueFiles) on Windows.

I changed FileManager to cache filename in lower case only.
Doesn't affect UNIX because UNIX uses Inode to uniquely identify files.

unix doesn't use this codepath.

Analysis and patch by Francois Pichet!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 23:50:42 +00:00
Eli Friedman a7e6845660 Detabify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 01:00:03 +00:00
John McCall ee79a4c30e The ARM C++ ABI is sufficiently different from the Itanium C++ ABI that
it deserves its own enumerator.  Obviously the implementations should
closely follow the Itanium ABI except in cases of divergence.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111749 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 22:46:04 +00:00
Sebastian Redl 3c7f413460 More PCH -> AST renaming.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 23:57:06 +00:00
Douglas Gregor 783c56f477 Simplify FixItHint by eliminated the unnecessary InsertionLoc
location. Patch by Eelis van der Weegen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111362 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 14:24:02 +00:00
Chandler Carruth 7a5bf5fb01 Check whether errors should be included in the diagnostic counts. Previously,
only warnings did this check.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111355 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 06:46:41 +00:00
Sebastian Redl 5005a6cf2e Get rid of pretty non-ASCII quotes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111316 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 22:42:34 +00:00
Chris Lattner 653f5812f7 apparently msvc defines _STDCALL_SUPPORTED, so we should
too.  Patch by Per Linden!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111236 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 16:02:32 +00:00
Argyrios Kyrtzidis ba6f816d63 Remove dead code, caught by unused function warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 01:15:58 +00:00
Eli Friedman 0eff4e73d5 Fix oversight with symbolic names in TargetInfo::validateInputConstraint.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 23:03:37 +00:00
Argyrios Kyrtzidis 646395bbca -Make TokenID of IdentifierInfo read-only, remove setTokenID().
-There are 2 instances that change the TokenID for GNU libstdc++ 4.2 compatibility.
  To handler those cases introduce a RevertedTokenID bitfield, RevertTokenIDToIdentifier() and hasRevertedTokenIDToIdentifier() methods.
  Store the bitfield in PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110868 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 22:55:12 +00:00
Daniel Dunbar bf3d55243a ARM: Recognize single precision float register names.
- We don't recognize double or NEON register names yet -- we don't have the
   infrastructure to generate the right clobbers for them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 02:17:20 +00:00
Daniel Dunbar 1fd71718ee ARM: Swap which registers we consider real / aliases to match LLVM and llvm-gcc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110774 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 02:17:11 +00:00
John Thompson 6f15803491 Fix for pr7869, inline asm mult-alt constraints.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110764 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 00:58:20 +00:00
John Thompson ef44e11107 Slightly revised handling of mult-alt constraints, to avoid an assert, until we have the full fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110706 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 19:20:14 +00:00
Douglas Gregor 72283806e7 Define _INTEGRAL_MAX_BITS for the win32 and win64 targets, from Per Lindén!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110442 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 12:37:52 +00:00
Chris Lattner 86e83730b5 fix the va_list definition for vc++64, patch by Cameron Esfahani!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110370 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 20:04:20 +00:00
Bruno Cardoso Lopes 7377ed985b Add -mavx and -mno-avx command line support
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110265 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04 22:29:13 +00:00
Eli Friedman 270c03550b PR7777: Set EnabledByDefault to something useful, instead of setting it
randomly.  This makes us consistently show "-pedantic" as the warning option
for a warning where appropriate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109987 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-01 22:13:15 +00:00
Douglas Gregor cc5888d833 Implement dependency analysis for the precompiled preamble. If any of
the files in the precompiled preamble have changed since it was build,
force the preamble to be rebuilt.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109937 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-31 00:40:00 +00:00
Sebastian Redl ffaab3e2bb Make macro weirdness in chained PCH work. This required changing the way PCHReader and PCHWriter are initialized to correctly pick up all initializer. On the upside, this means that there is far less repetition in the dependent PCH now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 00:29:29 +00:00
Sebastian Redl b86238d2f0 Add a test case for tentative definitions in chained PCH. Fix a bug that completely messed up source locations and thus caused a crash whenever a diagnostic was emitted in chained PCH files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109660 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 21:07:02 +00:00
Douglas Gregor 3e15e0a7b4 When remapping a virtual file, also make an entry for the file with
its absolute path on disk. Also, introduce a fun test for the
precompiled preamble, which almost works...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109470 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 23:54:23 +00:00
Douglas Gregor f4f6c9db68 Introduce basic support for loading a precompiled preamble while
reparsing an ASTUnit. When saving a preamble, create a buffer larger
than the actual file we're working with but fill everything from the
end of the preamble to the end of the file with spaces (so the lexer
will quickly skip them). When we load the file, create a buffer of the
same size, filling it with the file and then spaces. Then, instruct
the lexer to start lexing after the preamble, therefore continuing the
parse from the spot where the preamble left off.

It's now possible to perform a simple preamble build + parse (+
reparse) with ASTUnit. However, one has to disable a bunch of checking
in the PCH reader to do so. That part isn't committed; it will likely
be handled with some other kind of flag (e.g., -fno-validate-pch).

As part of this, fix some issues with null termination of the memory
buffers created for the preamble; we were trying to explicitly
NULL-terminate them, even though they were also getting implicitly
NULL terminated, leading to excess warnings about NULL characters in
source files.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109445 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 21:36:20 +00:00
Dan Gohman 3c46e8db99 Fix namespace polution.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109440 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 21:25:24 +00:00
Benjamin Kramer 3c2d3016ad Wrap bit mangling logic for DiagMappings in its own class so it doesn't leak
into other code. Make it an array instead of a constant-length vector.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109384 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-25 21:40:48 +00:00
Nate Begeman ad4f387b45 Catch thinko that Daniel Dunbar found.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109023 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 18:11:42 +00:00
Nate Begeman dbf8ea413e Fix win64 compilation of constants like 0xFFFFFFFFFFFFFFFFULL
intmax_t is __int64 (long long to clang), per VS 2010 stdint.h



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108980 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 02:02:56 +00:00
Douglas Gregor abc563f554 Introduce a new libclang API, clang_reparseTranslationUnit(), which
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108756 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 21:46:24 +00:00
Chris Lattner 9638eef7e3 BUILD_ARCHIVE is the default for libraries, no need to set it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108633 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-18 00:14:47 +00:00
Ted Kremenek bee05c1206 Add builtin definition for scanf, including extending the builtin encoding to
represent builtins that have the "scanf" attribution (via the format attribute) just
like we do with printf functions.  Follow-up work is needed to add similar support
for fscanf et al.

This is to support format-string checking for scanf functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108499 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 02:11:15 +00:00
Daniel Dunbar dacf9dda17 CodeGen/ObjC/NeXT: Fix Obj-C message send to match llvm-gcc when choosing
whether to use objc_msgSend_fpret; the choice is target dependent, not Obj-C ABI
dependent.
 - <rdar://problem/8139758> arm objc _objc_msgSend_fpret bug

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 23:39:36 +00:00
Benjamin Kramer ec1b1cc006 Pass StringRefs by value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 23:19:41 +00:00
John Thompson bb0cf4a29d Hack for dealing with commas until we support multiple alternative constraints, per pr7338.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 22:49:34 +00:00
John Thompson ab9e2f5aa4 Revert 107953, remove comma ignoring from PPC constraints.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107956 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 04:53:08 +00:00
John Thompson ec3a5d8975 Updating PPC target to ignore commas in asm contrains, as apparently that is what gcc does.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107953 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 02:01:40 +00:00
Chris Lattner 38e317d6dc add driver support for minix, patch by Kees van Reeuwijk
from PR7583


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107788 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 16:01:42 +00:00
Eric Christopher dd53ec9524 Translate numbers properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 19:04:52 +00:00
John Thompson 56b6ecad6c Fixed another double-char in PPC-specific asm constraints.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106812 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 00:02:05 +00:00
John Thompson 8e6065af76 Added PPC-specific asm constraints, PS3 configuration changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106806 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 22:44:13 +00:00
Eric Christopher 1f84f8d970 More clang support for darwin tls. Add a __has_feature macro and
target specific preprocessor define as well.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106715 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 02:02:00 +00:00
Chris Lattner 0a76aae8c0 introduce a new CharSourceRange class, and enhance the diagnostics routines
to use them instead of SourceRange.  CharSourceRange is just a SourceRange
plus a bool that indicates whether the range has the end character resolved
or whether the end location is the start of the end token.  While most of
the compiler wants to think of ranges that have ends that are the start of
the end token, the printf diagnostic stuff wants to highlight ranges within
tokens.

This is transparent to the diagnostic stuff.  To start taking advantage of
the new capabilities, you can do something like this:
  Diag(..) << CharSourceRange::getCharRange(Begin,End)





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106338 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18 22:45:06 +00:00
Douglas Gregor 2390b62f3a Update CMake build system for ARM NEON generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106220 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17 15:17:41 +00:00
Sean Hunt ee6e4b4baa Update CMake build for new attribute changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106188 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17 00:37:02 +00:00