Commit Graph

29330 Commits

Author SHA1 Message Date
David Chisnall 76803410c2 Fixed type error in last commit (forgot that now that selectors are not
accessed via the indirect pointer, they don't need to be pointers to pointers).

Finished moving the message lookup code into separate subclasses for each
runtime.  Also performed a few smallish related tidies.

We're now bitcasting the result of the message lookup functions, rather than
casting the lookup functions themselves, so the messages.m test needed updating
to reflect this.

llvm-svn: 128180
2011-03-23 22:52:06 +00:00
Ted Kremenek dcc4c38970 Fix CFG-construction bug when run from AnalysisBasedWarnings::IssueWarnings() where block-level expressions that need
to be recorded in the Stmt*->CFGBlock* map were not always done so.  Fixes <rdar://problem/9171946>.

llvm-svn: 128170
2011-03-23 21:33:21 +00:00
Douglas Gregor 336a15e041 Unbreak test
llvm-svn: 128168
2011-03-23 21:19:43 +00:00
Fariborz Jahanian 16f92ce539 Support for Transparent unions used as overloadable
function parameter. // rdar:// 9129552
and PR9406.

llvm-svn: 128159
2011-03-23 19:50:54 +00:00
Marshall Clow e7deac8cdc Add a test for !ptr-to-member (should fail)
llvm-svn: 128158
2011-03-23 19:44:36 +00:00
Andrew Trick 4a3ee93447 Revert r128156 because of CodeGenObjC/messages.m and Coverage/codegen-gnu.m.
llvm-svn: 128157
2011-03-23 19:43:59 +00:00
David Chisnall f1a38cf32d Remove the redundant loads / stores to globals that we were generating for selectors (GNU runtimes).
llvm-svn: 128156
2011-03-23 18:39:12 +00:00
David Chisnall d7972f5bf8 Initial work on refactoring GNU runtime code (long overdue - it's quite obvious
that I hadn't used C++ for several years before writing most of this code).
Still lots more to do.  This set of changes includes:

- Remove the distinction between typed and untyped selectors.  More accurately
  reflect what the runtime does, by using typed selectors everywhere, with an
  empty type field if the types are unknown.  Now we just store a small list of
  types for each selector (in theory, this should always be exactly one, but
  this constraint was not enforced back in 1986 when it should have been).

- Add some consistency to how runtime functions are created.  These are all
  generated via the LazyRuntimeFunction class (which might be useful outside
  CGObjCGNU - feel free to move it into a header if it is).  This function
  stores the types of a function, looks it up the first time it's used, and
  caches the result.  This means that we're now not wasting time constructing
  the llvm::FunctionType every time some of the functions are looked up, but
  also not inserting references to runtime functions into the module if they're
  not actually used.

- Started separating out the fragile and non-fragile ABI behaviours into two
  subclasses of CGObjCGNU: CGObjCGCC for the legacy GCC runtime ABI and
  CGObjCGNUstep for the new GNUstep ABI.  Not all of the differences in
  behaviour are factored out yet, but they will be in future commits.

- Removed all of the CodeGen:: things: we've been using namespace CodeGen in
  this file for ages, so having explicit namespace specifiers is just a bit
  confusing.

- Added a few more comments.

- Used llvm::StringRef instead of std::string in a few places.

- Finally got around to storing the module path in the module structure.  The
  ABI says that the compiler should do this, although it's not used in the
  runtime or exposed outside the runtime, so it's pretty useless.  

Still to do:

- We currently have two code paths for generating try blocks, one for ObjC and
  one for ObjC++.  Not only are these substantially similar, they are also very
  similar to the CGObjCMac version.  These need factoring out into a single
  parameterised implementation, either in CGObjCRuntime or CodeGenFunction.
  The EmitObjCXXTryStmt() function was added so that the changes to fix a bug
  in time for the 2.9 release would be self-contained and reduce the chances of
  breaking anything else, but these should be done properly as soon as
  possible.

- Split up some large functions (e.g. GenerateClass()) into smaller functions
  for generating the various data structures.

- The method lookup code into the two subclasses, removing the conditionals in
  the message send functions.

- Add doxygen comments on the remaining undocumented functions.

- We seem to be generating global pointer variables for selectors, then storing
  a pointer to the selector, then generating a load of this pointer (and then a
  load of the real selector later) every time a static selector is used.  I can
  only assume I was asleep or drunk when I did this - we should just be
  referencing the selectors directly in the selector array.

llvm-svn: 128152
2011-03-23 16:36:54 +00:00
Devang Patel 945b8aed2a Update type cache when a type is completed.
Radar 9168773

llvm-svn: 128150
2011-03-23 16:29:39 +00:00
Douglas Gregor 899b68fdf5 Teach DelayedDiagnostic to copy its string, rather than hope that the
string itself lives longer than the DelayedDiagnostic. Fixes a recent
use-after-free regression due to my availability attribute work. 

llvm-svn: 128148
2011-03-23 15:13:44 +00:00
Douglas Gregor d71149a453 Ignore weak_import on Objective-C property and method declarations on
all platforms, not just darwin. Fixes the regression in this test case.

llvm-svn: 128147
2011-03-23 13:27:51 +00:00
Chris Lattner ce6c42f65f switch a few Driver APIs to use llvm::ArrayRef, cleaning up code.
llvm-svn: 128142
2011-03-23 04:04:01 +00:00
Chris Lattner 89d3b337b8 remove a dead variable.
llvm-svn: 128141
2011-03-23 04:03:30 +00:00
Ted Kremenek 1ba9bbc149 Fix crash in clang_getInstantiationLoc() when SourceManager::getInstantiationLoc() can return a SourceLocatin with an invalid
FileID on invalid code.  Fixes <rdar://problem/9164623>.

llvm-svn: 128139
2011-03-23 02:16:44 +00:00
Ted Kremenek d6f4ad1579 std::vector::data() is not portable to VS. Use a gross hack instead.
llvm-svn: 128138
2011-03-23 02:16:41 +00:00
Ken Dyck 3fb4c8920d Convert OffsetFromNearestVBast parameter of InitializeVTablePointer(s) to
CharUnits. No change in functionality intended.

llvm-svn: 128129
2011-03-23 01:04:18 +00:00
Douglas Gregor 20b2ebd785 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.

llvm-svn: 128127
2011-03-23 00:50:03 +00:00
Ken Dyck cfc332cc43 Convert NonVirtual parameter of ApplyNonVirtualAndVirtualOffset() to
CharUnits. No change in functionality intended.

llvm-svn: 128126
2011-03-23 00:45:26 +00:00
John McCall 92d627e1b0 Fix an error with the declaration of block parameters that depend
on previous block parameters that crept in as part of my captures
work a month or so ago.

llvm-svn: 128121
2011-03-22 23:15:50 +00:00
John McCall aa01737782 Warn about unused declaration-specifiers on tag declarations.
llvm-svn: 128118
2011-03-22 23:00:04 +00:00
Eli Friedman 015d6288d4 Make the definition of "long double" consistent for llvm::Triple::Win32 for
both 32-bit and 64-bit targets.

llvm-svn: 128110
2011-03-22 21:25:11 +00:00
David Chisnall 067f0ed468 Simplify Mac runtime selection - it's the factory function's job to select which class to produce, not CodeGenModule's.
llvm-svn: 128109
2011-03-22 21:21:24 +00:00
Ted Kremenek 600b54c1e7 Hopefully fix VS build by not using std::vector::data().
llvm-svn: 128105
2011-03-22 20:16:19 +00:00
David Chisnall 08a45257de Make the property accessor functions that take a ptrdiff_t actually take a ptrdiff_t instead of a long (should have no impact on any sane platforms, but win64 is not sane).
llvm-svn: 128104
2011-03-22 20:03:13 +00:00
David Chisnall 6a566d2c1e Make the ivar offset always be a ptrdiff_t, because stuff in CGObjC.cpp expects this. Actually, it expects a long, but that's a bug that will be fixed in the next commit...
llvm-svn: 128102
2011-03-22 19:57:51 +00:00
Nick Lewycky d2348d8d3f Fix typo in comment.
llvm-svn: 128088
2011-03-22 17:35:47 +00:00
Daniel Dunbar 12100e2c7f Frontend: Add a more explicit -backend-option flag for passing backend command
line options, instead of leveraging the blanket -mllvm option.
 - This allows using the frontend itself without requiring the backend have
   those options available (i.e., if the target wasn't built).

llvm-svn: 128087
2011-03-22 16:48:17 +00:00
Benjamin Kramer ce276e3822 Don't clear OverloadCandidateSets on destruction, it has no effect anymore.
And clearing a SmallPtrSet can be an expensive operation.

llvm-svn: 128081
2011-03-22 09:46:54 +00:00
John McCall 30cd20a316 Apply Jonathan Sauer's proposed solution to PR9519. Thanks!
llvm-svn: 128075
2011-03-22 07:16:37 +00:00
John McCall 6a4fa52b37 The emission of an Objective-C++'s class .cxx_destruct method should be
conditioned on whether it has any destructible ivars, not on whether
it has any non-trivial class-object initializers.

llvm-svn: 128074
2011-03-22 07:05:39 +00:00
John McCall 8f9a42971e Fix a test case and teach ClearLinkageCache() to clear the linkage of
a function template decl's pattern, which was suddenly exposed by my
last patch.

llvm-svn: 128073
2011-03-22 06:58:49 +00:00
John McCall 290b32b90f File-scope static functions need to be mangled with 'L' so that
they don't collide with file-scope extern functions from the same
translation unit.  This is basically a matter of applying the same
logic to FunctionDecls as we were previously applying to VarDecls.

llvm-svn: 128072
2011-03-22 06:34:45 +00:00
Ken Dyck 6aa767c18e Convert Offset variable in GetAddressOfDirectBaseInCompleteClass() to
CharUnits. No change in functionality intended.

llvm-svn: 128060
2011-03-22 01:21:15 +00:00
Ted Kremenek 022a4904fa Rework crash recovery cleanup in ASTUnit and CIndex to recover more memory during a Sema crash (we have just a handful of leaks left)
and to use the simplified cleanup registration API.

llvm-svn: 128059
2011-03-22 01:15:24 +00:00
Ted Kremenek 288fb9dc6e Remove crash recovery cleanups from TypeLocBuilder. They were a bit error prone, only hit in rare cases.
llvm-svn: 128058
2011-03-22 01:15:21 +00:00
Ted Kremenek 022dbc1672 Simplify crash recovery cleanup registration.
llvm-svn: 128057
2011-03-22 01:15:19 +00:00
Ted Kremenek 4c9d46b310 Migrate 'PrettySTackTraceParserEntry' object out of Parser, and have it constructed within ParseAST. This avoids double crashes
during crash recovery.

llvm-svn: 128056
2011-03-22 01:15:17 +00:00
Ken Dyck a1a4ae34d0 Change return value of ComputeNonVirtualBaseClassOffset() to CharUnits. No
change in functionality intended.

llvm-svn: 128050
2011-03-22 00:53:26 +00:00
Ken Dyck 664569965f Eliminate some literal '8's in FillInNullDataMemberPointers() by switching
to CharUnits. No change in functionality intended.

llvm-svn: 128047
2011-03-22 00:24:31 +00:00
Matt Beaumont-Gay a282bc6a00 Output to tempfile
llvm-svn: 128043
2011-03-22 00:19:31 +00:00
Bob Wilson 87ba1d329a Another cortex-m0 patch from James Orr.
llvm-svn: 128029
2011-03-21 21:55:25 +00:00
Bob Wilson d9249414b3 Add clang support for cortex-m0 cpus. Patch by James Orr.
llvm-svn: 128018
2011-03-21 20:40:05 +00:00
Ted Kremenek 9acb346375 scan-build: only display analyzer intra-file progress when in "Verbose" mode.
llvm-svn: 128015
2011-03-21 20:12:21 +00:00
Daniel Dunbar fe908a805b Frontend: Change CC_PRINT_HEADERS to not print header depth markers, these don't
really make any sense in this environment.

llvm-svn: 128014
2011-03-21 19:37:38 +00:00
Fariborz Jahanian 413e064b45 Fix an objc++ diagnostic initializing objc pointers.
// rdar:// 9139947

llvm-svn: 128013
2011-03-21 19:08:42 +00:00
Ted Kremenek 5e14d39a88 Improve crash recovery cleanup to recovery CompilerInstances during crash recovery. This was a huge resource "root" during crashes.
This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct
ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance
object.

llvm-svn: 128011
2011-03-21 18:40:17 +00:00
Ted Kremenek 0aaa67b1c2 Relax assertion to fail during crash recovery cleanup.
llvm-svn: 128010
2011-03-21 18:40:10 +00:00
Ted Kremenek 84de4a1781 Use CrashRecoveryContextCleanup objects to reclaim resources from CompilerInstance objects.
llvm-svn: 128009
2011-03-21 18:40:07 +00:00
Chris Lattner 04fe64f899 and now there are 3!
llvm-svn: 128001
2011-03-21 16:25:11 +00:00
Joerg Sonnenberger fcc3ec90a5 Introduce FindTargetProgramPath to check for a target-specific helper
program and fallback to plain version otherwise. Use this for the NetBSD
target to make it try e.g. i486--netbsdelf-as and -ld for target
i486--netbsdelf.

llvm-svn: 127996
2011-03-21 14:01:40 +00:00
Joerg Sonnenberger bc923f3f7d Memorize presence/absence of -nostdlib in Driver.
Drop program paths on NetBSD (unused). Only include lib dir, if
-nostdlib is absent. Use = to allow --sysroot to work.

llvm-svn: 127995
2011-03-21 13:59:26 +00:00
Joerg Sonnenberger 6165ab1132 Remember sysroot in Driver. Pass it down to ld for NetBSD, FreeBSD
and DragonFly. Use the --sysroot= form for Linux. Fix handling of =
prefix for -B.

llvm-svn: 127994
2011-03-21 13:51:29 +00:00
Bill Wendling a8da50d011 Pass in the TargetMachine parameter to the inst printer.
llvm-svn: 127987
2011-03-21 05:02:03 +00:00
Peter Collingbourne e4c02400ad Code modification hints have been known as fix-it hints for almost
a year now.  Update the internals manual.

llvm-svn: 127983
2011-03-21 01:45:18 +00:00
David Chisnall e1d2584d44 Fix Objective-C++ exceptions (GNU runtime).
llvm-svn: 127980
2011-03-20 21:35:39 +00:00
Anders Carlsson 6dc204de40 __cxa_atexit does not throw.
llvm-svn: 127977
2011-03-20 20:52:32 +00:00
Argyrios Kyrtzidis e762020bb9 In clang_parseTranslationUnit_Impl,p ut the source file after command_line_args otherwise
if '-x' flag is present it will be unused.

llvm-svn: 127971
2011-03-20 18:17:52 +00:00
Peter Collingbourne a85fc0a2f3 Only objects are declared const by a constexpr specifier, per C++0x [dcl.constexpr]p9
llvm-svn: 127967
2011-03-20 08:06:45 +00:00
Francois Pichet 13b4e68642 Downgrade err_mismatched_exception_spec to a ExtWarning in Microsoft mode. MSVC doesn't do any validation on exception specifications.
This remove 1 error when parsing MSVC stl lib with clang.

llvm-svn: 127961
2011-03-19 23:05:18 +00:00
Benjamin Kramer f4ac9ffac1 Initialize FakeAddressSpaceMap flag.
llvm-svn: 127950
2011-03-19 13:04:25 +00:00
Anton Yartsev acb43dbf9b makes vec_step operator work when AltiVec support is enabled
llvm-svn: 127949
2011-03-19 07:53:43 +00:00
Daniel Dunbar 7594237964 Unbreak build.
llvm-svn: 127942
2011-03-19 02:06:21 +00:00
Ken Dyck 6d470d9398 Use CharUnits's new increment operator. No change in functionality intended.
llvm-svn: 127938
2011-03-19 01:28:06 +00:00
Ken Dyck 54d4d9fb19 Add pre- and post-increment/decrement operators to CharUnits.
llvm-svn: 127937
2011-03-19 01:25:59 +00:00
Daniel Dunbar 5366ff1865 Preprocessor: Don't define __STDC__ in -traditional-cpp mode.
llvm-svn: 127933
2011-03-19 01:04:12 +00:00
Ted Kremenek a872326929 Recovery memory from TypeLocBuilders during crashes.
llvm-svn: 127932
2011-03-19 01:00:38 +00:00
Ted Kremenek f75d089679 Recover memory from RecordLayoutBuilders during crashes.
llvm-svn: 127931
2011-03-19 01:00:36 +00:00
Ted Kremenek ddc06d0bd0 Rename class 'CFGReachabilityAnalysis' to 'CFGReverseBlockReachabilityAnalysis'.
This rename serves two purposes:

- It reflects the actual functionality of this analysis.
- We will have more than one reachability analysis.

llvm-svn: 127930
2011-03-19 01:00:33 +00:00
Ken Dyck 0f2f30b241 Replace literal '8's with CharWidth in AppendBitField. No change in
functionality intended.

llvm-svn: 127927
2011-03-19 00:57:28 +00:00
Ted Kremenek 1ec7b33079 Add libclang hook 'clang_toggleCrashRecovery()', which provides a mechanism for a client to enable/disable CrashRecovery within libclang function calls.
llvm-svn: 127920
2011-03-18 23:05:39 +00:00
Ted Kremenek 21c7e6e298 Run all functional logic of clang_annotateTokens() within a CrashRecoveryContext. Fixes <rdar://problem/9121698>.
llvm-svn: 127919
2011-03-18 22:51:30 +00:00
Peter Collingbourne 599cb8e430 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.

llvm-svn: 127915
2011-03-18 22:38:29 +00:00
Ted Kremenek d15609a582 Remove '-Xclang' and '-mllvm' entries from Clang man page. The later is only available in debug builds and the former is not supposed to be used by end-users.
llvm-svn: 127914
2011-03-18 22:11:40 +00:00
Daniel Dunbar 8c3d735118 Driver: Forward -traditional and -traditional-cpp in preprocessing modes.
- We don't really support the majority of the horrible -traditional-cpp
   behavior, but it is unlikely that we ever will either. This allows us to
   start trying to use clang as a /usr/bin/cpp replacement and see what pieces
   of -traditional-cpp mode people actually care about.

llvm-svn: 127911
2011-03-18 21:23:40 +00:00
Daniel Dunbar 1057f86d0e Lexer: Add extremely limited support for -traditional-cpp, ignoring BCPL
comments.

llvm-svn: 127910
2011-03-18 21:23:38 +00:00
Daniel Dunbar 151a372113 Driver/Darwin: Transparently fallback when compiling i386 -fapple-kext code, we
don't support the ABI yet.

llvm-svn: 127903
2011-03-18 20:14:03 +00:00
Daniel Dunbar 1e1c3ca51c Driver: Give SelectTool access to the action inputs.
llvm-svn: 127902
2011-03-18 20:14:00 +00:00
Daniel Dunbar c76a9e6962 Driver/Darwin: Change fallback to use llvm-gcc search paths instead of GCC.
llvm-svn: 127897
2011-03-18 19:25:15 +00:00
Daniel Dunbar 50fab351d7 Driver/Darwin: Kill the DarwinGCC toolchain.
llvm-svn: 127896
2011-03-18 19:25:10 +00:00
Anders Carlsson 9583f794c3 Use the newly added FileManager::getNoncachedStatValue when trying to determine if any files in the preamble have changed.
llvm-svn: 127894
2011-03-18 19:23:38 +00:00
Anders Carlsson 5e36840562 Add FileManager::getNoncachedStatValue, which will resolve relative paths against the working directory specified in the file system options.
llvm-svn: 127893
2011-03-18 19:23:19 +00:00
Anders Carlsson c30dcecb5c Correctly store and keep track of the FileSystemOptions in ASTUnit and in clang_codeCompleteAt.
llvm-svn: 127890
2011-03-18 18:22:40 +00:00
Douglas Gregor 96a4bddefb Add an opt-in -Wheader-hygiene, which current diagnoses the use of
global using directives in C++ headers, from Elliot Glaysher!

llvm-svn: 127881
2011-03-18 16:10:52 +00:00
Rafael Espindola 6b314b3d94 On !Darwin, do use the integrated as with -static.
llvm-svn: 127879
2011-03-18 15:50:12 +00:00
Abramo Bagnara a3088e6568 Defined friend functions are *implicitly* inlined, unless the inline specifier occurs explicitly.
llvm-svn: 127877
2011-03-18 15:21:59 +00:00
Abramo Bagnara 60804e1604 Fixed inconsistency when adding TemplateParameterListsInfo.
llvm-svn: 127876
2011-03-18 15:16:37 +00:00
NAKAMURA Takumi 4977655c94 test/CodeGenCXX/apple-kext-guard-variable.cpp: May I appease non-darwin hosts?
llvm-svn: 127869
2011-03-18 04:46:08 +00:00
John McCall 6107fc9e68 Improve the documentation for some of the analyzer attributes I added
a while back.

llvm-svn: 127866
2011-03-18 03:51:49 +00:00
Ted Kremenek c93cf2e912 Construct 'Sema' object on the stack, so that crash recovery can recovery it's associated resources without walking over dead stack space.
llvm-svn: 127864
2011-03-18 03:44:21 +00:00
NAKAMURA Takumi 2d60add66c www/hacking.html: Add blurb of LLVM_LIT_TOOLS_DIR.
llvm-svn: 127863
2011-03-18 03:21:44 +00:00
NAKAMURA Takumi 6048f80b1a www/hacking.html: Cosmetic change, to detabify, eliminate whitespace, and add proper slashes to URL.
llvm-svn: 127862
2011-03-18 03:21:38 +00:00
NAKAMURA Takumi f5606922f8 test/Driver/sysroot-flags.c: Tweak for Mingw MSYS bash.
MSYS substitutes path (that begins with "/") to de-mounted Windows path, even if it were nonexistent.
"/foo/bar" might be substituted to "C:/msysgit/foo/bar".

llvm-svn: 127861
2011-03-18 03:21:33 +00:00
NAKAMURA Takumi 1bd6491f7f test/Driver/darwin-cc.c: FileCheck-ize and tweak for Mingw MSYS bash.
MSYS substitutes path (that begins with "/") to de-mounted Windows path.
"/tmp" might be substituted as "C:/DOCUME~1/chapuni/LOCALS~1/Temp".

llvm-svn: 127860
2011-03-18 03:21:26 +00:00
John McCall 7ef5cb3038 The Darwin kernel does not provide useful guard variable support.
Issue this as an IR-gen error;  it's not really worthwhile doing this
"right", i.e. in Sema, because IR gen knows a lot of tricks beyond
what the constant evaluator knows.

llvm-svn: 127854
2011-03-18 02:56:14 +00:00
Ted Kremenek 4422bfea50 Use CrashRecoveryContextCleanup objects to recover an ASTUnit if we crash in ASTUnit::LoadFromCommandLine() and ASTUnit::LoadFromCompilerInvocation().
llvm-svn: 127851
2011-03-18 02:06:56 +00:00
Ted Kremenek 750028b6f4 Use CrashRecoveryContextCleanup objects to release resources associated with Sema during a crash while parsing.
llvm-svn: 127850
2011-03-18 02:06:53 +00:00
Ken Dyck a1b35109cf Convert alignment values to CharUnits. No change in functionality intended.
llvm-svn: 127848
2011-03-18 01:26:17 +00:00
Ken Dyck 33fa9ee4fd Convert getSizeInBytes() to getSizeInChars(), which returns its result in
CharUnits. No change in functionality intended.

llvm-svn: 127846
2011-03-18 01:12:13 +00:00
Ken Dyck 4e54dcaca1 Convert variables to CharUnits in ConvertStructToPacked(). No change in
functionality intended.

llvm-svn: 127844
2011-03-18 00:55:06 +00:00
Daniel Dunbar c44f8cf7b8 Driver/Obj-C: Be compatible with GCC behavior in that -fno-exceptions *does not*
disable Obj-C exceptions.

llvm-svn: 127836
2011-03-17 23:28:31 +00:00
Oscar Fuentes 73963b67c1 Fix some issues with include directories: remove a duplicate and put
Clang binary and source directories first (on that order).

llvm-svn: 127822
2011-03-17 19:03:04 +00:00
Daniel Dunbar 033a4bc49e Driver/Darwin: These are command line options, not target features.
llvm-svn: 127820
2011-03-17 18:29:04 +00:00
Daniel Dunbar 1d733e2d7e Driver/Darwin: Suppress spurious warning about -force_cpusubtype_ALL.
llvm-svn: 127819
2011-03-17 17:37:29 +00:00
Daniel Dunbar c9388c11f1 Driver/Darwin/ARM: Kernel/kext code has more strict alignment requirements.
llvm-svn: 127815
2011-03-17 17:10:06 +00:00
Richard Smith 9647d3ca02 Fix PR9488: 'auto' type substitution can fail (for instance, if it creates a reference-to-void type). Don't crash if it does.
Also fix an issue where type source information for the resulting type was being lost.

llvm-svn: 127811
2011-03-17 16:11:59 +00:00
David Chisnall a9e5460f03 Remove code that was intentionally generating bad code on the GNU runtime for no reason (failing to emit .cxx_constructor / .cxx_destructor methods).
llvm-svn: 127806
2011-03-17 14:19:08 +00:00
Ted Kremenek 65ccd1d9b0 Fix test to test the right thing.
llvm-svn: 127803
2011-03-17 05:34:58 +00:00
Ted Kremenek 2551fbe928 Don't construct two CFGs just to run -Wuninitialized. While this causes new warnings to be flagged under -Wconditional-uninitialized, this is something we
can improve over time.

llvm-svn: 127802
2011-03-17 05:29:57 +00:00
Ted Kremenek 97d8d03855 Make test more portable.
llvm-svn: 127799
2011-03-17 04:16:45 +00:00
Ted Kremenek 70727343cf Teach VariadicMethodTypeChecker about pointers attributed as 'NSObject'.
llvm-svn: 127798
2011-03-17 04:10:25 +00:00
Ted Kremenek 6fa1daede5 Teach VariadicMethodTypeChecker that CF references are valid arguments to variadic Objective-C methods.
llvm-svn: 127797
2011-03-17 04:01:35 +00:00
Ted Kremenek 3e5ad5932e Tweak RegionStore's handling of lazy compound values to use the 'Default' versus 'Direct' binding key, thus allowing specific elements of an array/struct to be overwritten without
invalidating the entire binding.  Fixes PR 9455.

llvm-svn: 127796
2011-03-17 03:51:51 +00:00
Ted Kremenek c15a4e4b37 Extend -Wuninitialized to support vector types.
llvm-svn: 127794
2011-03-17 03:06:11 +00:00
Ted Kremenek 61c74a1423 Rename -Wuninitialized-maybe to -Wconditional-uninitialized.
llvm-svn: 127793
2011-03-17 03:06:07 +00:00
Ken Dyck db205d1828 Convert NextOffsetInBytes to CharUnits and rename to NextOffsetInChars. No
change in functionality intended.

llvm-svn: 127787
2011-03-17 01:33:18 +00:00
Matt Beaumont-Gay 145e2eb0e3 Politely inform GCC that we will never fall off the end of that switch.
llvm-svn: 127783
2011-03-17 00:46:34 +00:00
Daniel Dunbar b1db4b69cc Driver/ARM: Match GCC behavior in that -msoft-float disables NEON, despite this
not being consistent at all with other parts of the GCC implementation.

llvm-svn: 127777
2011-03-17 00:07:34 +00:00
Douglas Gregor c2b97994ea When libclang visits a translation unit via clang_visitChildren(),
walk the preprocessing record *before* walking the declarations, so
they we pretend that we actually respect the phases of translation.

We still walk the preprocessing record after the declarations when
performing token annotation or finding the cursor at a location, since
those routines depend on those semantics.

Fixes <rdar://problem/9137195>.

llvm-svn: 127776
2011-03-16 23:23:30 +00:00
Joerg Sonnenberger bdbdf70334 Use C as fallback type if in C preprocessor mode.
llvm-svn: 127769
2011-03-16 22:45:02 +00:00
Eli Friedman b6069255da PR9494: Get rid of bitcast which was both unnecessary and written incorrectly.
llvm-svn: 127768
2011-03-16 22:34:09 +00:00
Ted Kremenek d4bcb4ffc1 Compress argument processing in ccc-analyzer. No functionality change.
llvm-svn: 127758
2011-03-16 21:10:42 +00:00
Abramo Bagnara 9875a3ce70 Use ElaboratedType also for C.
llvm-svn: 127755
2011-03-16 20:16:18 +00:00
Joerg Sonnenberger f6ce2fb1b3 Refactor program name logic. Extend it to infer the target triple from
the program name, if it includes it as proper prefix. This makes calling
clang with -ccc-host-triple x86_64-linux the same as calling it with the
name x86_64-linux-clang.

llvm-svn: 127753
2011-03-16 20:15:43 +00:00
Douglas Gregor 63fab34469 Detect attempts to provide a specialization of a function within a
dependent scope and produce an error (rather than crashing). Fixes PR8979.

llvm-svn: 127749
2011-03-16 19:27:09 +00:00
Argyrios Kyrtzidis d6278e3252 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.

llvm-svn: 127748
2011-03-16 19:17:25 +00:00
Douglas Gregor 89f3cd5c15 Clean up our handling of template-ids that resolve down to a single
overload, so that we actually do the resolution for full expressions
and emit more consistent, useful diagnostics. Also fixes an IRGen
crasher, where Sema wouldn't diagnose a resolvable bound member
function template-id used in a full-expression (<rdar://problem/9108698>).

llvm-svn: 127747
2011-03-16 19:16:25 +00:00
Sandeep Patel 5a4a0f75d4 Fix duplicate argument processing
llvm-svn: 127746
2011-03-16 19:14:34 +00:00
Peter Collingbourne 7d8a0b52d4 Support for printing/dumping static asserts
llvm-svn: 127744
2011-03-16 18:37:27 +00:00
Peter Collingbourne 4828368dc8 Remove a duplicate language feature
llvm-svn: 127743
2011-03-16 18:35:34 +00:00
Chandler Carruth 3cc331a160 Add a 'RawPath' parameter to the PPCallbacks interface. This allows
clients to observe the exact path through which an #included file was
located. This is very useful when trying to record and replay inclusion
operations without it beind influenced by the aggressive caching done
inside the FileManager to avoid redundant system calls and filesystem
operations.

The work to compute and return this is only done in the presence of
callbacks, so it should have no effect on normal compilation.

Patch by Manuel Klimek.

llvm-svn: 127742
2011-03-16 18:34:36 +00:00
Douglas Gregor ce0bc31469 Don't indescriminately print overload candidates when we have invalid
operands to a binary expression; it doesn't make sense in all
contexts. The right answer would be to see if the user forgot at ().

Fixes <rdar://problem/9136502>.

llvm-svn: 127740
2011-03-16 18:21:05 +00:00
Douglas Gregor 6341ceedc5 Allow function calls to dereferenced member pointers of
pointer-to-function type. Fixes <rdar://problem/9065289>.

llvm-svn: 127739
2011-03-16 17:42:23 +00:00
Douglas Gregor a0ff0c34a7 Make sure that we always pop a function's scope *before* we call
ActOnFinishFunctionBody/ActOnBlockStmtExpr. This way, we ensure that
we diagnose undefined labels before the jump-scope checker gets run,
since the jump-scope checker requires (as its invariant) that all of
the GotoStmts be wired up correctly.

Fixes PR9495.

llvm-svn: 127738
2011-03-16 17:05:57 +00:00
Douglas Gregor 46c04e74fb When we're inserting a synthesized label declaration for a
forward-looking "goto" statement, make sure to insert it *after* the
last declaration in the identifier resolver's declaration chain that
is either outside of the function/block/method's scope or that is
declared in that function/block/method's specific scope. Previously,
we could end up inserting the label ahead of declarations in inner
scopes, confusing C++ name lookup.

Fixes PR9491/<rdar://problem/9140426> and <rdar://problem/9135994>.

Note that the crash-on-invalid PR9495 is *not* fixed. That's a
separate issue.

llvm-svn: 127737
2011-03-16 16:39:03 +00:00
David Chisnall 803adc1bcf Fix foreign exception handling (GNU runtime).
llvm-svn: 127736
2011-03-16 15:44:28 +00:00
Abramo Bagnara 22f8cd7117 Added missing methods to get Designators source range.
llvm-svn: 127735
2011-03-16 15:08:46 +00:00
NAKAMURA Takumi c9998aa1f4 test/Driver/hello.c: Tweak for cygming.
- Driver's name may be "clang(-\d.\d).exe".
  - Emitted executable file is named as "%t.exe". It must be harmless on other OS.

llvm-svn: 127729
2011-03-16 13:51:46 +00:00
Ted Kremenek 35c70f64db Teach CFGBuilder that the 'default' branch of a switch statement is dead if all enum values in a switch conditioned are handled.
llvm-svn: 127727
2011-03-16 04:32:01 +00:00
John McCall e99e5dcbd3 Don't emit read barriers for reading __weak __block variables
in non-GC mode.

llvm-svn: 127725
2011-03-16 02:53:38 +00:00
Ted Kremenek 4ceebbf54d VariadicMethodTypeChecker: don't warn for null pointer constants passed to variadic Objective-C methods.
llvm-svn: 127719
2011-03-16 00:22:51 +00:00
Ted Kremenek 6f7008dcb6 c-index-test shouldn't crash when a goto has no matching label. Fixes <rdar://problem/9123493>.
llvm-svn: 127711
2011-03-15 23:47:49 +00:00
Ted Kremenek 6cd0187718 Remove warning for null characters in CFString literals. Clang handles them just fine, and GCC 4.2 doesn't warn here either.
We added this warning back in 2007 when we were comparing against GCC 4.0.

llvm-svn: 127704
2011-03-15 21:18:52 +00:00
Ted Kremenek 0d5b9ef564 Don't warn about null characters in Objective-C format string literals.
llvm-svn: 127703
2011-03-15 21:18:48 +00:00
John McCall 2de87f67e5 Reorganize the emission of (unfoldable) constant casts a bit, and
make sure that upcasts of member pointer types are covered as constants.
Fixed rdar://problem/9130221

llvm-svn: 127702
2011-03-15 21:17:48 +00:00
Sebastian Redl c17003c66b Create __has_feature(cxx_noexcept) and mark it as working.
Find out that our C++0x status has only one field for noexcept expression and specification together, and that it was accidentally already marked as fully implemented.
This completes noexcept specification work.

llvm-svn: 127701
2011-03-15 21:17:12 +00:00
Sebastian Redl e800838170 Fix test case.
llvm-svn: 127699
2011-03-15 21:15:06 +00:00
Sebastian Redl 52ddca23a7 Extend the noexcept expression test to test noexcept specification functions.
llvm-svn: 127693
2011-03-15 20:45:42 +00:00
Sebastian Redl c34c29f661 More robust check for the special C++0x operator new workaround.
llvm-svn: 127692
2011-03-15 20:41:09 +00:00
Sebastian Redl cb5dd00796 Implement a hack to work around the changing exception specification of operator new in C++0x.
llvm-svn: 127688
2011-03-15 19:52:30 +00:00
Ted Kremenek cdb2ae587a Remove bogus assertion in IdempotentOperationsChecker.
llvm-svn: 127687
2011-03-15 19:27:57 +00:00