]> granicus.if.org Git - clang/log
clang
13 years agoContinuing work on ObjC tidyup:
David Chisnall [Fri, 25 Mar 2011 11:57:33 +0000 (11:57 +0000)]
Continuing work on ObjC tidyup:

- Moved the CGObjCRuntime functions out of CGObjCMac.cpp into CGObjCRuntime.cpp

- Added generic functions in CGObjCRuntime for emitting @try and @synchronize
  blocks, usable by any runtime that uses DWARF exceptions.

- Made the GNU runtimes use these functions.

It should now be possible to replace the equivalent functions in
CGObjCNonFragileABIMac with simple calls to these two functions, providing the
runtime functions as arguments.  I'll post a diff to the list for review before
making any changes to the Mac runtime stuff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128274 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove warnings about using override control keywords in inline function definitions...
Anders Carlsson [Fri, 25 Mar 2011 11:28:25 +0000 (11:28 +0000)]
Remove warnings about using override control keywords in inline function definitions; they will be allowed in the next C++0x draft.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128273 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix some clang warnings.
Anders Carlsson [Fri, 25 Mar 2011 11:22:47 +0000 (11:22 +0000)]
Fix some clang warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128272 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove 'new' from virt-specifier since it's going to be removed in the next C++0x...
Anders Carlsson [Fri, 25 Mar 2011 11:19:41 +0000 (11:19 +0000)]
Remove 'new' from virt-specifier since it's going to be removed in the next C++0x draft

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128271 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoApply the nonnull attribute to constructor expressions too.
Nick Lewycky [Fri, 25 Mar 2011 01:44:32 +0000 (01:44 +0000)]
Apply the nonnull attribute to constructor expressions too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128253 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch constant evaluation of float casts over to cast kinds.
Eli Friedman [Fri, 25 Mar 2011 00:54:52 +0000 (00:54 +0000)]
Switch constant evaluation of float casts over to cast kinds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128251 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCleanup integral and vector constant evaluation of casts to use cast kinds.
Eli Friedman [Fri, 25 Mar 2011 00:43:55 +0000 (00:43 +0000)]
Cleanup integral and vector constant evaluation of casts to use cast kinds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128250 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFixed some of the incompatibilities with gcc.
John Thompson [Thu, 24 Mar 2011 18:51:57 +0000 (18:51 +0000)]
Fixed some of the incompatibilities with gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128228 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMinor fix in the injection of labels, since we want to look at the redeclaration...
Douglas Gregor [Thu, 24 Mar 2011 14:35:16 +0000 (14:35 +0000)]
Minor fix in the injection of labels, since we want to look at the redeclaration context of each declaration in the identifier chain. Should fix Linux self-host

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128210 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInsomniac refactoring: change how the parser allocates attributes so that
John McCall [Thu, 24 Mar 2011 11:26:52 +0000 (11:26 +0000)]
Insomniac refactoring:  change how the parser allocates attributes so that
AttributeLists do not accumulate over the lifetime of parsing, but are
instead reused.  Also make the arguments array not require a separate
allocation, and make availability attributes store their stuff in
augmented memory, too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128209 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix the insertion of label declarations into the identifier chain in
Douglas Gregor [Thu, 24 Mar 2011 10:35:39 +0000 (10:35 +0000)]
Fix the insertion of label declarations into the identifier chain in
the case where we only have a single identifier with that name in the
chain. Fixes PR9463 for real this time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128208 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake sure we aggressively attach nounwind (etc.) to calls to library
Eli Friedman [Thu, 24 Mar 2011 05:09:45 +0000 (05:09 +0000)]
Make sure we aggressively attach nounwind (etc.) to calls to library
functions of the form __builtin_XXX.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128198 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConvert the BaseOffset member of BaseSubobject to CharUnits from bits. No
Ken Dyck [Thu, 24 Mar 2011 01:21:01 +0000 (01:21 +0000)]
Convert the BaseOffset member of BaseSubobject to CharUnits from bits. No
change in functionality intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128190 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a new warning for exit-time destructors.
Anders Carlsson [Thu, 24 Mar 2011 01:01:41 +0000 (01:01 +0000)]
Add a new warning for exit-time destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128188 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRework checker "packages" and groups to be more hierarchical.
Ted Kremenek [Thu, 24 Mar 2011 00:28:47 +0000 (00:28 +0000)]
Rework checker "packages" and groups to be more hierarchical.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128187 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCall out ObjC parameter types as a different kind of declarator context
John McCall [Wed, 23 Mar 2011 23:43:04 +0000 (23:43 +0000)]
Call out ObjC parameter types as a different kind of declarator context
from a normal type-spec, just for completeness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128185 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFixed type error in last commit (forgot that now that selectors are not
David Chisnall [Wed, 23 Mar 2011 22:52:06 +0000 (22:52 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128180 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix CFG-construction bug when run from AnalysisBasedWarnings::IssueWarnings() where...
Ted Kremenek [Wed, 23 Mar 2011 21:33:21 +0000 (21:33 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128170 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUnbreak test
Douglas Gregor [Wed, 23 Mar 2011 21:19:43 +0000 (21:19 +0000)]
Unbreak test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128168 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSupport for Transparent unions used as overloadable
Fariborz Jahanian [Wed, 23 Mar 2011 19:50:54 +0000 (19:50 +0000)]
Support for Transparent unions used as overloadable
function parameter. // rdar:// 9129552
and PR9406.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128159 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a test for !ptr-to-member (should fail)
Marshall Clow [Wed, 23 Mar 2011 19:44:36 +0000 (19:44 +0000)]
Add a test for !ptr-to-member (should fail)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128158 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert r128156 because of CodeGenObjC/messages.m and Coverage/codegen-gnu.m.
Andrew Trick [Wed, 23 Mar 2011 19:43:59 +0000 (19:43 +0000)]
Revert r128156 because of CodeGenObjC/messages.m and Coverage/codegen-gnu.m.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128157 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove the redundant loads / stores to globals that we were generating for selectors...
David Chisnall [Wed, 23 Mar 2011 18:39:12 +0000 (18:39 +0000)]
Remove the redundant loads / stores to globals that we were generating for selectors (GNU runtimes).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128156 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInitial work on refactoring GNU runtime code (long overdue - it's quite obvious
David Chisnall [Wed, 23 Mar 2011 16:36:54 +0000 (16:36 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128152 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate type cache when a type is completed.
Devang Patel [Wed, 23 Mar 2011 16:29:39 +0000 (16:29 +0000)]
Update type cache when a type is completed.
Radar 9168773

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128150 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach DelayedDiagnostic to copy its string, rather than hope that the
Douglas Gregor [Wed, 23 Mar 2011 15:13:44 +0000 (15:13 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128148 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIgnore weak_import on Objective-C property and method declarations on
Douglas Gregor [Wed, 23 Mar 2011 13:27:51 +0000 (13:27 +0000)]
Ignore weak_import on Objective-C property and method declarations on
all platforms, not just darwin. Fixes the regression in this test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128147 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoswitch a few Driver APIs to use llvm::ArrayRef, cleaning up code.
Chris Lattner [Wed, 23 Mar 2011 04:04:01 +0000 (04:04 +0000)]
switch a few Driver APIs to use llvm::ArrayRef, cleaning up code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128142 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoremove a dead variable.
Chris Lattner [Wed, 23 Mar 2011 04:03:30 +0000 (04:03 +0000)]
remove a dead variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128141 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix crash in clang_getInstantiationLoc() when SourceManager::getInstantiationLoc...
Ted Kremenek [Wed, 23 Mar 2011 02:16:44 +0000 (02:16 +0000)]
Fix crash in clang_getInstantiationLoc() when SourceManager::getInstantiationLoc() can return a SourceLocatin with an invalid
FileID on invalid code.  Fixes <rdar://problem/9164623>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128139 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agostd::vector::data() is not portable to VS. Use a gross hack instead.
Ted Kremenek [Wed, 23 Mar 2011 02:16:41 +0000 (02:16 +0000)]
std::vector::data() is not portable to VS.  Use a gross hack instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128138 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConvert OffsetFromNearestVBast parameter of InitializeVTablePointer(s) to
Ken Dyck [Wed, 23 Mar 2011 01:04:18 +0000 (01:04 +0000)]
Convert OffsetFromNearestVBast parameter of InitializeVTablePointer(s) to
CharUnits. No change in functionality intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128129 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement a new 'availability' attribute, that allows one to specify
Douglas Gregor [Wed, 23 Mar 2011 00:50:03 +0000 (00:50 +0000)]
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

13 years agoConvert NonVirtual parameter of ApplyNonVirtualAndVirtualOffset() to
Ken Dyck [Wed, 23 Mar 2011 00:45:26 +0000 (00:45 +0000)]
Convert NonVirtual parameter of ApplyNonVirtualAndVirtualOffset() to
CharUnits. No change in functionality intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128126 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix an error with the declaration of block parameters that depend
John McCall [Tue, 22 Mar 2011 23:15:50 +0000 (23:15 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128121 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWarn about unused declaration-specifiers on tag declarations.
John McCall [Tue, 22 Mar 2011 23:00:04 +0000 (23:00 +0000)]
Warn about unused declaration-specifiers on tag declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128118 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the definition of "long double" consistent for llvm::Triple::Win32 for
Eli Friedman [Tue, 22 Mar 2011 21:25:11 +0000 (21:25 +0000)]
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

13 years agoSimplify Mac runtime selection - it's the factory function's job to select which...
David Chisnall [Tue, 22 Mar 2011 21:21:24 +0000 (21:21 +0000)]
Simplify Mac runtime selection - it's the factory function's job to select which class to produce, not CodeGenModule's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128109 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHopefully fix VS build by not using std::vector::data().
Ted Kremenek [Tue, 22 Mar 2011 20:16:19 +0000 (20:16 +0000)]
Hopefully fix VS build by not using std::vector::data().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128105 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the property accessor functions that take a ptrdiff_t actually take a ptrdiff_t...
David Chisnall [Tue, 22 Mar 2011 20:03:13 +0000 (20:03 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128104 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the ivar offset always be a ptrdiff_t, because stuff in CGObjC.cpp expects this...
David Chisnall [Tue, 22 Mar 2011 19:57:51 +0000 (19:57 +0000)]
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...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128102 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix typo in comment.
Nick Lewycky [Tue, 22 Mar 2011 17:35:47 +0000 (17:35 +0000)]
Fix typo in comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128088 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFrontend: Add a more explicit -backend-option flag for passing backend command
Daniel Dunbar [Tue, 22 Mar 2011 16:48:17 +0000 (16:48 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128087 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't clear OverloadCandidateSets on destruction, it has no effect anymore.
Benjamin Kramer [Tue, 22 Mar 2011 09:46:54 +0000 (09:46 +0000)]
Don't clear OverloadCandidateSets on destruction, it has no effect anymore.

And clearing a SmallPtrSet can be an expensive operation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128081 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoApply Jonathan Sauer's proposed solution to PR9519. Thanks!
John McCall [Tue, 22 Mar 2011 07:16:37 +0000 (07:16 +0000)]
Apply Jonathan Sauer's proposed solution to PR9519.  Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128075 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThe emission of an Objective-C++'s class .cxx_destruct method should be
John McCall [Tue, 22 Mar 2011 07:05:39 +0000 (07:05 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128074 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a test case and teach ClearLinkageCache() to clear the linkage of
John McCall [Tue, 22 Mar 2011 06:58:49 +0000 (06:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128073 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFile-scope static functions need to be mangled with 'L' so that
John McCall [Tue, 22 Mar 2011 06:34:45 +0000 (06:34 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128072 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConvert Offset variable in GetAddressOfDirectBaseInCompleteClass() to
Ken Dyck [Tue, 22 Mar 2011 01:21:15 +0000 (01:21 +0000)]
Convert Offset variable in GetAddressOfDirectBaseInCompleteClass() to
CharUnits. No change in functionality intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128060 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRework crash recovery cleanup in ASTUnit and CIndex to recover more memory during...
Ted Kremenek [Tue, 22 Mar 2011 01:15:24 +0000 (01:15 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128059 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove crash recovery cleanups from TypeLocBuilder. They were a bit error prone...
Ted Kremenek [Tue, 22 Mar 2011 01:15:21 +0000 (01:15 +0000)]
Remove crash recovery cleanups from TypeLocBuilder.  They were a bit error prone, only hit in rare cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128058 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSimplify crash recovery cleanup registration.
Ted Kremenek [Tue, 22 Mar 2011 01:15:19 +0000 (01:15 +0000)]
Simplify crash recovery cleanup registration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128057 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMigrate 'PrettySTackTraceParserEntry' object out of Parser, and have it constructed...
Ted Kremenek [Tue, 22 Mar 2011 01:15:17 +0000 (01:15 +0000)]
Migrate 'PrettySTackTraceParserEntry' object out of Parser, and have it constructed within ParseAST.  This avoids double crashes
during crash recovery.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128056 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoChange return value of ComputeNonVirtualBaseClassOffset() to CharUnits. No
Ken Dyck [Tue, 22 Mar 2011 00:53:26 +0000 (00:53 +0000)]
Change return value of ComputeNonVirtualBaseClassOffset() to CharUnits. No
change in functionality intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128050 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEliminate some literal '8's in FillInNullDataMemberPointers() by switching
Ken Dyck [Tue, 22 Mar 2011 00:24:31 +0000 (00:24 +0000)]
Eliminate some literal '8's in FillInNullDataMemberPointers() by switching
to CharUnits. No change in functionality intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128047 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOutput to tempfile
Matt Beaumont-Gay [Tue, 22 Mar 2011 00:19:31 +0000 (00:19 +0000)]
Output to tempfile

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128043 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAnother cortex-m0 patch from James Orr.
Bob Wilson [Mon, 21 Mar 2011 21:55:25 +0000 (21:55 +0000)]
Another cortex-m0 patch from James Orr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128029 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd clang support for cortex-m0 cpus. Patch by James Orr.
Bob Wilson [Mon, 21 Mar 2011 20:40:05 +0000 (20:40 +0000)]
Add clang support for cortex-m0 cpus.  Patch by James Orr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128018 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoscan-build: only display analyzer intra-file progress when in "Verbose" mode.
Ted Kremenek [Mon, 21 Mar 2011 20:12:21 +0000 (20:12 +0000)]
scan-build: only display analyzer intra-file progress when in "Verbose" mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128015 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFrontend: Change CC_PRINT_HEADERS to not print header depth markers, these don't
Daniel Dunbar [Mon, 21 Mar 2011 19:37:38 +0000 (19:37 +0000)]
Frontend: Change CC_PRINT_HEADERS to not print header depth markers, these don't
really make any sense in this environment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128014 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix an objc++ diagnostic initializing objc pointers.
Fariborz Jahanian [Mon, 21 Mar 2011 19:08:42 +0000 (19:08 +0000)]
Fix an objc++ diagnostic initializing objc pointers.
// rdar:// 9139947

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128013 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove crash recovery cleanup to recovery CompilerInstances during crash recovery...
Ted Kremenek [Mon, 21 Mar 2011 18:40:17 +0000 (18:40 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128011 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRelax assertion to fail during crash recovery cleanup.
Ted Kremenek [Mon, 21 Mar 2011 18:40:10 +0000 (18:40 +0000)]
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

13 years agoUse CrashRecoveryContextCleanup objects to reclaim resources from CompilerInstance...
Ted Kremenek [Mon, 21 Mar 2011 18:40:07 +0000 (18:40 +0000)]
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

13 years agoand now there are 3!
Chris Lattner [Mon, 21 Mar 2011 16:25:11 +0000 (16:25 +0000)]
and now there are 3!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128001 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIntroduce FindTargetProgramPath to check for a target-specific helper
Joerg Sonnenberger [Mon, 21 Mar 2011 14:01:40 +0000 (14:01 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127996 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMemorize presence/absence of -nostdlib in Driver.
Joerg Sonnenberger [Mon, 21 Mar 2011 13:59:26 +0000 (13:59 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127995 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemember sysroot in Driver. Pass it down to ld for NetBSD, FreeBSD
Joerg Sonnenberger [Mon, 21 Mar 2011 13:51:29 +0000 (13:51 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127994 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPass in the TargetMachine parameter to the inst printer.
Bill Wendling [Mon, 21 Mar 2011 05:02:03 +0000 (05:02 +0000)]
Pass in the TargetMachine parameter to the inst printer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127987 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCode modification hints have been known as fix-it hints for almost
Peter Collingbourne [Mon, 21 Mar 2011 01:45:18 +0000 (01:45 +0000)]
Code modification hints have been known as fix-it hints for almost
a year now.  Update the internals manual.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127983 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix Objective-C++ exceptions (GNU runtime).
David Chisnall [Sun, 20 Mar 2011 21:35:39 +0000 (21:35 +0000)]
Fix Objective-C++ exceptions (GNU runtime).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127980 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago__cxa_atexit does not throw.
Anders Carlsson [Sun, 20 Mar 2011 20:52:32 +0000 (20:52 +0000)]
__cxa_atexit does not throw.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127977 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIn clang_parseTranslationUnit_Impl,p ut the source file after command_line_args otherwise
Argyrios Kyrtzidis [Sun, 20 Mar 2011 18:17:52 +0000 (18:17 +0000)]
In clang_parseTranslationUnit_Impl,p ut the source file after command_line_args otherwise
if '-x' flag is present it will be unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127971 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOnly objects are declared const by a constexpr specifier, per C++0x [dcl.constexpr]p9
Peter Collingbourne [Sun, 20 Mar 2011 08:06:45 +0000 (08:06 +0000)]
Only objects are declared const by a constexpr specifier, per C++0x [dcl.constexpr]p9

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127967 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDowngrade err_mismatched_exception_spec to a ExtWarning in Microsoft mode. MSVC doesn...
Francois Pichet [Sat, 19 Mar 2011 23:05:18 +0000 (23:05 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127961 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInitialize FakeAddressSpaceMap flag.
Benjamin Kramer [Sat, 19 Mar 2011 13:04:25 +0000 (13:04 +0000)]
Initialize FakeAddressSpaceMap flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127950 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agomakes vec_step operator work when AltiVec support is enabled
Anton Yartsev [Sat, 19 Mar 2011 07:53:43 +0000 (07:53 +0000)]
makes vec_step operator work when AltiVec support is enabled

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127949 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUnbreak build.
Daniel Dunbar [Sat, 19 Mar 2011 02:06:21 +0000 (02:06 +0000)]
Unbreak build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127942 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse CharUnits's new increment operator. No change in functionality intended.
Ken Dyck [Sat, 19 Mar 2011 01:28:06 +0000 (01:28 +0000)]
Use CharUnits's new increment operator. No change in functionality intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127938 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd pre- and post-increment/decrement operators to CharUnits.
Ken Dyck [Sat, 19 Mar 2011 01:25:59 +0000 (01:25 +0000)]
Add pre- and post-increment/decrement operators to CharUnits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127937 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPreprocessor: Don't define __STDC__ in -traditional-cpp mode.
Daniel Dunbar [Sat, 19 Mar 2011 01:04:12 +0000 (01:04 +0000)]
Preprocessor: Don't define __STDC__ in -traditional-cpp mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127933 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRecovery memory from TypeLocBuilders during crashes.
Ted Kremenek [Sat, 19 Mar 2011 01:00:38 +0000 (01:00 +0000)]
Recovery memory from TypeLocBuilders during crashes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127932 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRecover memory from RecordLayoutBuilders during crashes.
Ted Kremenek [Sat, 19 Mar 2011 01:00:36 +0000 (01:00 +0000)]
Recover memory from RecordLayoutBuilders during crashes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127931 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRename class 'CFGReachabilityAnalysis' to 'CFGReverseBlockReachabilityAnalysis'.
Ted Kremenek [Sat, 19 Mar 2011 01:00:33 +0000 (01:00 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127930 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReplace literal '8's with CharWidth in AppendBitField. No change in
Ken Dyck [Sat, 19 Mar 2011 00:57:28 +0000 (00:57 +0000)]
Replace literal '8's with CharWidth in AppendBitField. No change in
functionality intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127927 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd libclang hook 'clang_toggleCrashRecovery()', which provides a mechanism for a...
Ted Kremenek [Fri, 18 Mar 2011 23:05:39 +0000 (23:05 +0000)]
Add libclang hook 'clang_toggleCrashRecovery()', which provides a mechanism for a client to enable/disable CrashRecovery within libclang function calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127920 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRun all functional logic of clang_annotateTokens() within a CrashRecoveryContext...
Ted Kremenek [Fri, 18 Mar 2011 22:51:30 +0000 (22:51 +0000)]
Run all functional logic of clang_annotateTokens() within a CrashRecoveryContext.  Fixes <rdar://problem/9121698>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127919 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for language-specific address spaces. On top of that,
Peter Collingbourne [Fri, 18 Mar 2011 22:38:29 +0000 (22:38 +0000)]
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

13 years agoRemove '-Xclang' and '-mllvm' entries from Clang man page. The later is only availab...
Ted Kremenek [Fri, 18 Mar 2011 22:11:40 +0000 (22:11 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127914 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver: Forward -traditional and -traditional-cpp in preprocessing modes.
Daniel Dunbar [Fri, 18 Mar 2011 21:23:40 +0000 (21:23 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127911 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoLexer: Add extremely limited support for -traditional-cpp, ignoring BCPL
Daniel Dunbar [Fri, 18 Mar 2011 21:23:38 +0000 (21:23 +0000)]
Lexer: Add extremely limited support for -traditional-cpp, ignoring BCPL
comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127910 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin: Transparently fallback when compiling i386 -fapple-kext code, we
Daniel Dunbar [Fri, 18 Mar 2011 20:14:03 +0000 (20:14 +0000)]
Driver/Darwin: Transparently fallback when compiling i386 -fapple-kext code, we
don't support the ABI yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127903 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver: Give SelectTool access to the action inputs.
Daniel Dunbar [Fri, 18 Mar 2011 20:14:00 +0000 (20:14 +0000)]
Driver: Give SelectTool access to the action inputs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127902 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin: Change fallback to use llvm-gcc search paths instead of GCC.
Daniel Dunbar [Fri, 18 Mar 2011 19:25:15 +0000 (19:25 +0000)]
Driver/Darwin: Change fallback to use llvm-gcc search paths instead of GCC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127897 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin: Kill the DarwinGCC toolchain.
Daniel Dunbar [Fri, 18 Mar 2011 19:25:10 +0000 (19:25 +0000)]
Driver/Darwin: Kill the DarwinGCC toolchain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127896 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse the newly added FileManager::getNoncachedStatValue when trying to determine if...
Anders Carlsson [Fri, 18 Mar 2011 19:23:38 +0000 (19:23 +0000)]
Use the newly added FileManager::getNoncachedStatValue when trying to determine if any files in the preamble have changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127894 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd FileManager::getNoncachedStatValue, which will resolve relative paths against...
Anders Carlsson [Fri, 18 Mar 2011 19:23:19 +0000 (19:23 +0000)]
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

13 years agoCorrectly store and keep track of the FileSystemOptions in ASTUnit and in clang_codeC...
Anders Carlsson [Fri, 18 Mar 2011 18:22:40 +0000 (18:22 +0000)]
Correctly store and keep track of the FileSystemOptions in ASTUnit and in clang_codeCompleteAt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127890 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd an opt-in -Wheader-hygiene, which current diagnoses the use of
Douglas Gregor [Fri, 18 Mar 2011 16:10:52 +0000 (16:10 +0000)]
Add an opt-in -Wheader-hygiene, which current diagnoses the use of
global using directives in C++ headers, from Elliot Glaysher!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127881 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOn !Darwin, do use the integrated as with -static.
Rafael Espindola [Fri, 18 Mar 2011 15:50:12 +0000 (15:50 +0000)]
On !Darwin, do use the integrated as with -static.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127879 91177308-0d34-0410-b5e6-96231b3b80d8