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

4996 Коммитов

Автор SHA1 Сообщение Дата
Daniel Dunbar 01eb9b9683 PR5218: Replace IdentifierInfo::getName with StringRef version, now that clients
are updated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 21:17:35 +00:00
Daniel Dunbar b5217efa5b Add ObjCCategoryImplDecl::getName() -> StringRef, and a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84435 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 20:25:46 +00:00
Benjamin Kramer 4e0e2f1c5f non-POD members => make it a class (also silences MSVC warnings)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84426 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 18:56:13 +00:00
Anders Carlsson 82debc7d28 Add some more cast kinds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 18:12:03 +00:00
John McCall 49a832bd49 When performing template-substitution into a type, don't just replace the
TemplateTypeParmType with the substituted type directly;  instead, replace it
with a SubstTemplateTypeParmType which will note that the type was originally
written as a template type parameter.  This makes it reasonable to preserve
source information even through template substitution.

Also define the new SubstTemplateTypeParmType class, obviously.

For consistency with current behavior, we stringize these types as if they
were the underlying type.  I'm not sure this is the right thing to do.
At any rate, I paled at adding yet another clause to the don't-desugar 'if'
statement, so I extracted a function to do it.  The new function also does
The Right Thing more often, I think:  e.g. if we have a chain of typedefs
leading to a vector type, we will now desugar all but the last one.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84412 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 09:09:24 +00:00
Daniel Dunbar ecfa8d2d86 Add NameDecl::getName() -> StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84394 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 02:09:45 +00:00
John McCall 51bd803fbd Clone the full Type hierarchy into the TypeLoc hierarchy. Normalize
TypeLoc class names to be $(Type classname)Loc.  Rewrite the visitor.
Provide skeleton implementations for all the new TypeLocs.

Handle all cases in PCH.  Handle a few more cases when inserting
location information in SemaType.

It should be extremely straightforward to add new location information
to existing TypeLoc objects now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 01:05:36 +00:00
Daniel Dunbar bfec576b1b Add FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 23:52:58 +00:00
Daniel Dunbar eaea925e70 StringRefize some parts of Diagnostic API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84377 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 23:52:43 +00:00
Daniel Dunbar 8b94446873 Remove unused BernsteinHash functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 23:52:36 +00:00
Douglas Gregor 8d1c9ae5d2 Fix a crash with qualified member access into a non-type, from Sean Hunt!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 22:37:54 +00:00
Daniel Dunbar 83885f7e3b Add IdentifierTable::CreateIdentifierInfo(StringRef).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84361 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 20:44:06 +00:00
Edward O'Callaghan 12356b1190 Fix for PR5190, Credit to Zhanyong Wan.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 19:32:54 +00:00
Daniel Dunbar 67f594c0a0 Remove a FIXME that doesn't belong, there are numerous other places that use
alignment in bits in clang. If we really want to fix this, it should be a bugzilla.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 09:38:57 +00:00
Daniel Dunbar 7fe60650c1 Add IdentiferInfo::getNameStr() -> StringRef.
Also, add getNameStart as a synonym for getName(). getName() is now deprecated,
when all clients are updated then getNameStr() should be renamed to
getName(). PR5218.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84306 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 03:28:48 +00:00
Ted Kremenek 5cf48766d6 Add 'UseBumpPtrAllocator' flag to ASTUnit::LoadFromPCHFile() to cause the created ASTContext to use
its own BumpPtrAllocator to allocate ASTs.

Change clang_createTranslationUnit (CIndex) to pass 'UseBumpPtrAllocator = true' to
ASTUnit::LoadFromPCHFile().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84296 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 00:34:24 +00:00
Douglas Gregor 61d60ee6aa Merge the "types" and "declarations" blocks in the precompiled header
format, so that we don't end up with multiple declaration and types
blocks. Also, fix a few obscure bugs with PCH loading and generation:

  - If the DeclIDs DenseMap reallocates while we are writing a
    declaration (due to recursively writing other declarations), we
    could end up writing a bad ID to ExternalDefinitions.
  - When loading an ArrayLoc (part of DeclaratorInfo), we need to set
    the size expression to NULL if no size expression was provided.

PCH -> AST rewriting is still partly broken, unfortunately.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 00:13:19 +00:00
Fariborz Jahanian 866b2744ff Patch to clean up and improve visual display of
builtin function ambiguity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84289 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 23:25:02 +00:00
Douglas Gregor bdfe48ac80 While writing source-location entries to a PCH file, go through an
interface that can load those source-location entries on demand (from
another PCH file).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84287 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 22:46:09 +00:00
John McCall 4ce74bd425 Allow TypeLocs to be fully initialized with a single SourceLocation. This
will be the keystone of converting existing rewrites to be rewrites on TypeLocs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84286 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 22:31:57 +00:00
John McCall a1ee0c548b Factor out routines to encode/decode DeclaratorInfos and move them into the
core PCH reader/writer implementation files.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84278 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 21:56:05 +00:00
John McCall d9067b3186 Add an accessor to extra the type directly from a DeclaratorInfo
without an opaque call.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84277 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 21:42:04 +00:00
Douglas Gregor 02465750c8 Make CIndex and c-index-test a little bit more robust. The only
substantive change is that clang_getCursorSource() now returns the
file in which a macro was instantiated when the cursor points into a
macro instantiation, rather than crashing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 21:24:31 +00:00
Ted Kremenek 40a5ef90ac Provide 'static' version of BinaryOperator::isShiftOp().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 20:45:04 +00:00
Douglas Gregor 7d1d49d297 Keep track of whether declararions were loaded from a precompiled
header or not via a new "PCHLevel" field in Decl. We currently use
this information to help CIndex filter out declarations that came from
a precompiled header (rather than from an AST file). Further down the
road, it can be used to help implement multi-level precompiled
headers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84267 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 20:01:17 +00:00
Douglas Gregor 52e7108f51 Add support for a chain of stat caches in the FileManager, rather than
only supporting a single stat cache. The immediate benefit of this
change is that we can now generate a PCH/AST file when including
another PCH file; in the future, the chain of stat caches will likely
be useful with multiple levels of PCH files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 18:18:30 +00:00
Anders Carlsson 16a8904f3f Add CK_VectorSplat and use it for casting non-pointer scalars to ExtVectors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84245 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 05:23:41 +00:00
Anders Carlsson ebeaf2031c Add a ToVoid cast kind and start using it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 02:35:04 +00:00
Ted Kremenek 473e16745a retain/release checker: Stop tracking reference counts for any symbols touched by StoreManager::InvalidateRegion().
This fixes <rdar://problem/7257223> and <rdar://problem/7283470>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84223 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 00:30:49 +00:00
John McCall 46a617a792 Remove the ConstantArrayType subtypes. This information is preserved in the
TypeLoc records for declarations;  it should not be necessary to represent it
directly in the type system.

Please complain if you were using these classes and feel you can't replicate
previous functionality using the TypeLoc API.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84222 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 00:14:28 +00:00
John McCall a6f56429aa ConcreteTypeLoc subclasses which call getInnerTypeLoc() should get a
compile-time error now;  moreover, remove the need for an explicit hasInnerType()
call.  Thanks to Doug Gregor for the metaprogramming approach.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84215 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 22:37:38 +00:00
Steve Naroff e19944c939 Make sure temporary files get unlinked.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 22:23:48 +00:00
Steve Naroff 5b7d8e254f Implement <rdar://problem/7303432> [Clang/Index] In-memory-style AST generation API (initial API implementation).
Added clang_createTranslationUnitFromSourceFile().
Changed clang_createIndex() to lookup the location of clang (using dladdr).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 20:04:39 +00:00
Douglas Gregor 0a897e32a0 Simplify checking of explicit template specialization/explicit
instantiation redeclaration semantics for function template
specializations and member functions of class template
specializations. Also, record the point of instantiation for
explicit-instantiated functions and static data members.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84188 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 17:21:20 +00:00
Douglas Gregor 454885ec4f Check the interactions between explicit instantiations and template
specializations. Work in progress; there's more cleanup required to
actually use the new CheckSpecializationInstantiationRedecl checker
uniformly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84185 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 15:54:05 +00:00
Douglas Gregor e2d3a3de71 Diagnose explicit instantiations of function templates and member
functions/static data members of class template specializations that
do not have definitions. This is the latter part of [temp.explicit]p4;
the former part still needs more testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84182 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 14:05:49 +00:00
Douglas Gregor bf7643e796 More explicit template instantiation. Now we're checking for more
cases where an explicit instantiation requires a definition; the
remainder of these checks will come with the implementation of
paragraph 4 of [temp.explicit].


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 12:53:22 +00:00
John McCall f2130a6e3c Complete some unfinished comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84169 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 04:01:40 +00:00
John McCall 34a0447b80 Better living through metaprogramming. Create a base class which abstracts
most of the unsafe boilerplate out of TypeLoc.  Create a QualifiedLoc class
to represent the idea that we *might* start representing source locations
of qualifiers.  Dealing with qualifiers explicitly like this also lets us
efficiently ignore them in all the concrete cases.

This should make it obvious and easy to add new TypeLoc subclasses.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 03:50:32 +00:00
Douglas Gregor 9302da67ea CheckTemplateSpecializationScope isn't going to be used for explicit
instantiations, since the requirements are too different from those
for template specializations. Simplify it slightly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84156 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 23:50:59 +00:00
Douglas Gregor 558c03222c Additional semantic checking for explicit template instantiations,
focusing on the scope- and qualifier-related semantic requirements in
C++ [temp.explicit]p2.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84154 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 23:41:34 +00:00
Douglas Gregor 1028c9f0af Give explicit and implicit instantiations of static data members of
class templates the proper linkage. 

Daniel, please look over the CodeGenModule bits.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 21:29:40 +00:00
Douglas Gregor 663b5a0be7 Testing and some minor fixes for explicit template instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84129 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 20:14:33 +00:00
Rafael Espindola 31b63beefa Add support for having different c++ search dirs with -m32 and -m64. So far
this is only used in darwin10, 64 bit ubuntu 9.10 and 64 bit openSUSE 11.1.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84115 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 17:09:44 +00:00
Sebastian Redl 37c38ec5f1 Have the exception specification checkers take partial diagnostics. Use this to merge two diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84105 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 16:09:29 +00:00
Sebastian Redl 491b84c062 Use partial diagnostics properly in call to RequireCompleteType. Among other things, this means we get a note on the declaration of the incomplete type when it is used in an exception specification.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 14:59:48 +00:00
Zhongxing Xu 09270cc1b9 Now StoreManager::CastRegion() takes a MemRegion, returns a MemRegion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 06:55:01 +00:00
Chris Lattner 278b9f0693 fix some cfstring related issues:
1) -fwritable-string does affect the non-utf16 version of cfstrings
   just not the utf16 ones.
2) utf16 strings should always be marked constant, as the __TEXT segment
   is readonly.
3) The name of the global doesn't matter, remove it from TargetInfo.
4) Trust the asmprinter to drop cstrings into the right section, like llvmgcc does now.

This fixes rdar://7115750



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 05:55:45 +00:00
Zhongxing Xu d0f8bb1f6b * Remove unused GRState* parameter
* Make all Base value the last argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84071 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 03:33:08 +00:00
Fariborz Jahanian d9290cb5ad Handle ambiguity of reference initialization.
Removes a FIXME.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84068 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 00:52:43 +00:00