]> granicus.if.org Git - clang/log
clang
15 years agoMake use of the Index library through the index-test tool.
Argyrios Kyrtzidis [Sun, 5 Jul 2009 22:22:35 +0000 (22:22 +0000)]
Make use of the Index library through the index-test tool.

'index-test' is now able to provide additional info for a Decl, through multiple AST files:
-Find declarations
-Find definitions
-Find references

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

15 years agoIntroduce the 'Index' library.
Argyrios Kyrtzidis [Sun, 5 Jul 2009 22:22:19 +0000 (22:22 +0000)]
Introduce the 'Index' library.

Its purpose is to provide the basic infrastructure for cross-translation-unit analysis like indexing, refactoring, etc.

Currently it is very "primitive" and with no type-names support. It can provide functionality like
"show me all references of this function from these translation units".

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

15 years agoIntroduce the DeclReferenceMap class inside the AST library.
Argyrios Kyrtzidis [Sun, 5 Jul 2009 22:22:06 +0000 (22:22 +0000)]
Introduce the DeclReferenceMap class inside the AST library.

DeclReferenceMap (similar to ParentMap) is a helper class for mapping Decls to the AST nodes that reference them.
A client will initialize it by passing an ASTContext to its constructor and later use it to iterate over
the references of a Decl.
References are mapped and retrieved using the primary declaration (Decl::getPrimaryDecl()) of a particular Decl.

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

15 years agoIntroduce the virtual method Decl::getPrimaryDecl().
Argyrios Kyrtzidis [Sun, 5 Jul 2009 22:21:56 +0000 (22:21 +0000)]
Introduce the virtual method Decl::getPrimaryDecl().

When a Decl subclass can have multiple re-declarations in the same declaration context (like FunctionDecl),
getPrimaryDecl() will return a particular Decl that all of them will point to as the "primary" declaration.

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

15 years agoAvoid re-checking the parameters of a function, when trying to resolve a location.
Argyrios Kyrtzidis [Sun, 5 Jul 2009 22:21:46 +0000 (22:21 +0000)]
Avoid re-checking the parameters of a function, when trying to resolve a location.

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

15 years agoMake use of ASTNode for return value of clang::ResolveLocationInAST() and in the...
Argyrios Kyrtzidis [Sun, 5 Jul 2009 22:21:40 +0000 (22:21 +0000)]
Make use of ASTNode for return value of clang::ResolveLocationInAST() and in the index-test tool.

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

15 years agoIntroduce ASTNode class into the AST library.
Argyrios Kyrtzidis [Sun, 5 Jul 2009 22:21:28 +0000 (22:21 +0000)]
Introduce ASTNode class into the AST library.

ASTNode is an immutable pair of a Decl and Stmt. If Stmt is not null, Decl should be its immediate parent.

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

15 years agoDo an early check for function definition.
Argyrios Kyrtzidis [Sun, 5 Jul 2009 22:21:17 +0000 (22:21 +0000)]
Do an early check for function definition.

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

15 years agoPer PR4506, fix the type of size_t on OpenBSD.
Eli Friedman [Sun, 5 Jul 2009 18:47:56 +0000 (18:47 +0000)]
Per PR4506, fix the type of size_t on OpenBSD.

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

15 years agoCompoundLiteralRegion is boundable when it is not in the file scope.
Zhongxing Xu [Sat, 4 Jul 2009 11:43:03 +0000 (11:43 +0000)]
CompoundLiteralRegion is boundable when it is not in the file scope.

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

15 years agoCatch function redeclarations with incompatible exception specifications.
Sebastian Redl [Sat, 4 Jul 2009 11:39:00 +0000 (11:39 +0000)]
Catch function redeclarations with incompatible exception specifications.

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

15 years agoStringRegion is not boundable.
Zhongxing Xu [Sat, 4 Jul 2009 11:31:53 +0000 (11:31 +0000)]
StringRegion is not boundable.

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

15 years agoThis fixes the case where the wrong symbol is emitted leading to linking errors when...
Fariborz Jahanian [Fri, 3 Jul 2009 15:10:14 +0000 (15:10 +0000)]
This fixes the case where the wrong symbol is emitted leading to linking errors when you reference a class before defining it (GNU runtime).
Patch by David Chisnall.

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

15 years agoremove utility methods that are not very useful.
Zhongxing Xu [Fri, 3 Jul 2009 06:11:41 +0000 (06:11 +0000)]
remove utility methods that are not very useful.

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

15 years agoadd test case for r74407.
Zhongxing Xu [Fri, 3 Jul 2009 05:33:23 +0000 (05:33 +0000)]
add test case for r74407.

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

15 years agoUpdate checker build.
Ted Kremenek [Fri, 3 Jul 2009 03:26:09 +0000 (03:26 +0000)]
Update checker build.

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

15 years agoAdd an intermediate typedef for __builtin_va_tag to make it a bit easier
Eli Friedman [Fri, 3 Jul 2009 00:45:06 +0000 (00:45 +0000)]
Add an intermediate typedef for __builtin_va_tag to make it a bit easier
to deal with for AST pretty-printing/rewriting.  Patch by Abramo
Bagnara.

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

15 years agoRemove unused method.
Ted Kremenek [Fri, 3 Jul 2009 00:41:09 +0000 (00:41 +0000)]
Remove unused method.

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

15 years agoBasicStoreManager: Use SymbolManager::canSymbolicate() to determine if a variable...
Ted Kremenek [Fri, 3 Jul 2009 00:36:16 +0000 (00:36 +0000)]
BasicStoreManager: Use SymbolManager::canSymbolicate() to determine if a variable can be symbolicated.

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

15 years agoFix a horrible CFG bug reported in <rdar://problem/7027684>. The wrong successor
Ted Kremenek [Fri, 3 Jul 2009 00:10:50 +0000 (00:10 +0000)]
Fix a horrible CFG bug reported in <rdar://problem/7027684>. The wrong successor
block would get hooked up in some cases when processing empty compound
statements.

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

15 years agoRevert prev commit, we have much bigger problems because 2.3 is missing
Daniel Dunbar [Thu, 2 Jul 2009 23:58:07 +0000 (23:58 +0000)]
Revert prev commit, we have much bigger problems because 2.3 is missing
the subprocess module.

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

15 years agoAvoid @staticmethod to allow use with Python 2.3.
Daniel Dunbar [Thu, 2 Jul 2009 23:56:37 +0000 (23:56 +0000)]
Avoid @staticmethod to allow use with Python 2.3.

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

15 years agoReplace guarded calls in RegionStoreManager to
Ted Kremenek [Thu, 2 Jul 2009 22:16:42 +0000 (22:16 +0000)]
Replace guarded calls in RegionStoreManager to
ValueManager::getRegionValueSymbolVal() with unguarded calls to
ValueManager::getRegionValueSymbolValOrUnknown(). This changes centralizes the
decision of what values to symbolicate in SymbolManager rather than having it
scatter in RegionStoreManager.

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

15 years agoEnhance RegionStore to lazily symbolicate fields and array elements for
Ted Kremenek [Thu, 2 Jul 2009 22:02:15 +0000 (22:02 +0000)]
Enhance RegionStore to lazily symbolicate fields and array elements for
structures passed-by-value as function arguments.

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

15 years agoFix RUN line so this test doesn't hang.
Ted Kremenek [Thu, 2 Jul 2009 18:44:31 +0000 (18:44 +0000)]
Fix RUN line so this test doesn't hang.

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

15 years agoPatch to allocate list of bases in CXXRecordDecl
Fariborz Jahanian [Thu, 2 Jul 2009 18:26:15 +0000 (18:26 +0000)]
Patch to allocate list of bases in CXXRecordDecl
using ASTContxt allocation.

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

15 years agoStoreManagers: Use 'hasGlobalsStorage()' and 'hasParametersStorage()' instead of
Ted Kremenek [Thu, 2 Jul 2009 18:25:09 +0000 (18:25 +0000)]
StoreManagers: Use 'hasGlobalsStorage()' and 'hasParametersStorage()' instead of
directly consulting if a VarDecl is an implicit or actual parameter, a global,
etc.

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

15 years agoAdd a separate MemSpaceRegion for function/method arguments passed on the stack.
Ted Kremenek [Thu, 2 Jul 2009 18:14:59 +0000 (18:14 +0000)]
Add a separate MemSpaceRegion for function/method arguments passed on the stack.
This will simplify the logic of StoreManagers that want to specially reason
about the values of parameters.

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

15 years agoRemove commented methods. Add MemRegion::printStdErr().
Ted Kremenek [Thu, 2 Jul 2009 17:24:10 +0000 (17:24 +0000)]
Remove commented methods.  Add MemRegion::printStdErr().

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

15 years agoAdd support for retrieving the Doxygen comment associated with a given
Douglas Gregor [Thu, 2 Jul 2009 17:08:52 +0000 (17:08 +0000)]
Add support for retrieving the Doxygen comment associated with a given
declaration in the AST.

The new ASTContext::getCommentForDecl function searches for a comment
that is attached to the given declaration, and returns that comment,
which may be composed of several comment blocks.

Comments are always available in an AST. However, to avoid harming
performance, we don't actually parse the comments. Rather, we keep the
source ranges of all of the comments within a large, sorted vector,
then lazily extract comments via a binary search in that vector only
when needed (which never occurs in a "normal" compile).

Comments are written to a precompiled header/AST file as a blob of
source ranges. That blob is only lazily loaded when one requests a
comment for a declaration (this never occurs in a "normal" compile).

The indexer testbed now supports comment extraction. When the
-point-at location points to a declaration with a Doxygen-style
comment, the indexer testbed prints the associated comment
block(s). See test/Index/comments.c for an example.

Some notes:
  - We don't actually attempt to parse the comment blocks themselves,
  beyond identifying them as Doxygen comment blocks to associate them
  with a declaration.
  - We won't find comment blocks that aren't adjacent to the
  declaration, because we start our search based on the location of
  the declaration.
  - We don't go through the necessary hops to find, for example,
  whether some redeclaration of a declaration has comments when our
  current declaration does not. Similarly, we don't attempt to
  associate a \param Foo marker in a function body comment with the
  parameter named Foo (although that is certainly possible).
  - Verification of my "no performance impact" claims is still "to be
  done".

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

15 years agoLook through vector types when determining the base type of a type for declarator...
Douglas Gregor [Wed, 1 Jul 2009 23:58:14 +0000 (23:58 +0000)]
Look through vector types when determining the base type of a type for declarator printing. Bug found via the PCH tester

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

15 years agoUse Destroy for member initializer list clean up.
Fariborz Jahanian [Wed, 1 Jul 2009 23:35:25 +0000 (23:35 +0000)]
Use Destroy for member initializer list clean up.
Per Doug's comments. Doug please review.

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

15 years agoMinor code cleanup: pull variables into scope of 'if' statement, limiting their
Ted Kremenek [Wed, 1 Jul 2009 23:30:34 +0000 (23:30 +0000)]
Minor code cleanup: pull variables into scope of 'if' statement, limiting their
actual lifetime to their logical lifetime.

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

15 years agoFix PR 4489, a PCH crash during de-serialization.
Douglas Gregor [Wed, 1 Jul 2009 23:29:14 +0000 (23:29 +0000)]
Fix PR 4489, a PCH crash during de-serialization.

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

15 years agoTemporarily disable RegionStore for stack-addr-ps.c, as a new test case reveals
Ted Kremenek [Wed, 1 Jul 2009 23:24:11 +0000 (23:24 +0000)]
Temporarily disable RegionStore for stack-addr-ps.c, as a new test case reveals
a case where RegionStore doesn't create symbolic values for the fields of
structs that are passed-by-value.

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

15 years agoAdd a FIXME to RegionStore, do some minor code cleanup, and get RegionStore to
Ted Kremenek [Wed, 1 Jul 2009 23:19:52 +0000 (23:19 +0000)]
Add a FIXME to RegionStore, do some minor code cleanup, and get RegionStore to
pass misc-ps.m. Currently RegionStore/BasicStore don't do any special reasoning
about clang-style vectors, so we should return UnknownVal (in all cases) when
accessing their values via an array.

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

15 years agoUpdate for changes in LLVM. Hopefully this is the last one for a while.
Owen Anderson [Wed, 1 Jul 2009 23:14:14 +0000 (23:14 +0000)]
Update for changes in LLVM.  Hopefully this is the last one for a while.

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

15 years agoKeep track of more information within the template instantiation stack, e.g.,
Douglas Gregor [Wed, 1 Jul 2009 22:01:06 +0000 (22:01 +0000)]
Keep track of more information within the template instantiation stack, e.g.,
by distinguishing between substitution that occurs for template
argument deduction vs. explicitly-specifiad template arguments. This
is used both to improve diagnostics and to make sure we only provide
SFINAE in those cases where SFINAE should apply.

In addition, deal with the sticky issue where SFINAE only considers
substitution of template arguments into the *type* of a function
template; we need to issue hard errors beyond this point, as
test/SemaTemplate/operator-template.cpp illustrates.

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

15 years agoHold the LLVMContext by reference instead of by pointer.
Owen Anderson [Wed, 1 Jul 2009 21:23:16 +0000 (21:23 +0000)]
Hold the LLVMContext by reference instead of by pointer.

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

15 years agoUpdated CXXConstructorDecl AST node for ctor-initilaizer list.
Fariborz Jahanian [Wed, 1 Jul 2009 21:05:43 +0000 (21:05 +0000)]
Updated CXXConstructorDecl AST node for ctor-initilaizer list.
No change in functionality.

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

15 years agoFix thinko in r74506, test condition for floats was inverted.
Daniel Dunbar [Wed, 1 Jul 2009 20:37:45 +0000 (20:37 +0000)]
Fix thinko in r74506, test condition for floats was inverted.
 - Refactored slightly to make control flow more obvious.

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

15 years agoDriver: Mark some Compilation members const.
Daniel Dunbar [Wed, 1 Jul 2009 20:30:52 +0000 (20:30 +0000)]
Driver: Mark some Compilation members const.

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

15 years agoDriver: Move Compilation::Execute to Driver::ExecuteCompilation.
Daniel Dunbar [Wed, 1 Jul 2009 20:03:04 +0000 (20:03 +0000)]
Driver: Move Compilation::Execute to Driver::ExecuteCompilation.
 - The Compilation is just a helper class, it shouldn't have that amount of
   logic in it.

 - No functionality change.

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

15 years agoPatch to implement template types in ctor-initializer list.
Fariborz Jahanian [Wed, 1 Jul 2009 19:21:19 +0000 (19:21 +0000)]
Patch to implement template types in ctor-initializer list.
Also has fix for bugzilla-4469.

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

15 years agoDriver: Improve diagnostics for failed commands.
Daniel Dunbar [Wed, 1 Jul 2009 19:14:39 +0000 (19:14 +0000)]
Driver: Improve diagnostics for failed commands.
 - Not all tools give good error messages, and sometimes the tool can fail w/o
   any error (for example, when signalled).

 - We suppress this message when the failing command is the compiler and it
   failed normally (exit code == 1), under the assumption that it gave a good
   diagnostic.

For example, for a linker failure we now get:
--
ddunbar@lordcrumb:tmp$ clang a.c b.c
ld: duplicate symbol _x in /var/folders/cl/clrOX6SaG+moCeRKEI4PtU+++TI/-Tmp-/cc-bXYITq.o and /var/folders/cl/clrOX6SaG+moCeRKEI4PtU+++TI/-Tmp-/cc-6uK4jD.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--

For a compiler crash we get:
--
ddunbar@lordcrumb:tmp$ clang t.i
Assertion failed: (CGT.getTargetData().getTypeAllocSizeInBits(STy) == RL.getSize()), function layoutStructFields, file CodeGenTypes.cpp, line 573.
0   clang-cc          0x0000000100f1f1f1 PrintStackTrace(void*) + 38
... stack trace and virtual stack trace follow ...
clang: error: compiler command failed due to signal 6 (use -v to see invocation)
--

But for a regular compilation failure we get the usual:
--
ddunbar@lordcrumb:tmp$ clang c.c
c.c:1:6: error: invalid token after top level declarator
int x
     ^
1 diagnostic generated.
--

 - No test case, not amenable to non-executable testing. :/

 - <rdar://problem/6945613>

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

15 years agoDriver: Add Source argument for Commands to hold the Action which caused a
Daniel Dunbar [Wed, 1 Jul 2009 19:02:28 +0000 (19:02 +0000)]
Driver: Add Source argument for Commands to hold the Action which caused a
Command to be generated, to support more advanced diagnostics.
 - No functionality change.

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

15 years agoAdd header search path for Gentoo stable, x86_64 version.
Sebastian Redl [Wed, 1 Jul 2009 18:59:43 +0000 (18:59 +0000)]
Add header search path for Gentoo stable, x86_64 version.

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

15 years agoUpdate for LLVMContext+Module change.
Owen Anderson [Wed, 1 Jul 2009 17:00:06 +0000 (17:00 +0000)]
Update for LLVMContext+Module change.

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

15 years agoTwo fixes to make Clang build on Visual C++ (again), from Alisdair Meredith.
Douglas Gregor [Wed, 1 Jul 2009 15:12:53 +0000 (15:12 +0000)]
Two fixes to make Clang build on Visual C++ (again), from Alisdair Meredith.

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

15 years agoRework Sema::CheckConditionalOperands(). No functionality change.
Steve Naroff [Wed, 1 Jul 2009 14:36:47 +0000 (14:36 +0000)]
Rework Sema::CheckConditionalOperands(). No functionality change.

This was necessary to simplify some other changes I'm making (wrt ObjC type cleanups).

The idea is to separate the constraint checks for block pointers, ObjC pointers, and C pointers (the previous code combined them into one clause).

Note: This routine will be further simplified when I integrate the ObjC type cleanups (forthcoming).

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

15 years agoImplement Eli's feedback for vecto constant expressions;
Nate Begeman [Wed, 1 Jul 2009 07:50:47 +0000 (07:50 +0000)]
Implement Eli's feedback for vecto constant expressions;

For ExtVectorType, initializer is splatted to all elements.
For VectorType, initializer is bitcast to vector type.

Verified that for VectorType, output is identical to gcc.

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

15 years agouse new and simplified LLVM APIs. Patch by Jay Foad!
Chris Lattner [Wed, 1 Jul 2009 04:13:52 +0000 (04:13 +0000)]
use new and simplified LLVM APIs.  Patch by Jay Foad!

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

15 years agoFix for PR4192: fix the definition of int64_t on x86_64 Linux.
Eli Friedman [Wed, 1 Jul 2009 03:36:11 +0000 (03:36 +0000)]
Fix for PR4192: fix the definition of int64_t on x86_64 Linux.

Note that I'm guessing that *BSD and Solaris do the same thing as Linux
here, but it's quite possible I'm wrong; if the following testcase
gives an error on x86-64 with gcc for any of those operating systems, please
tell me:

#include <stdint.h>

int64_t x; long x;

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

15 years agoadd fixme.
Zhongxing Xu [Wed, 1 Jul 2009 02:12:57 +0000 (02:12 +0000)]
add fixme.

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

15 years agoCope with explicitly-specified function template arguments when there
Douglas Gregor [Wed, 1 Jul 2009 00:28:38 +0000 (00:28 +0000)]
Cope with explicitly-specified function template arguments when there
are fewer template arguments than there are template parameters for
that function.

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

15 years agoWhen explicit template arguments are provided for a function call,
Douglas Gregor [Tue, 30 Jun 2009 23:57:56 +0000 (23:57 +0000)]
When explicit template arguments are provided for a function call,
substitute those template arguments into the function parameter types
prior to template argument deduction. There's still a bit of work to
do to make this work properly when only some of the template arguments
are specified.

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

15 years agoPatch to support optional nested-name-specifier in in ctor-initializer
Fariborz Jahanian [Tue, 30 Jun 2009 23:26:25 +0000 (23:26 +0000)]
Patch to support optional nested-name-specifier in in ctor-initializer
list.

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

15 years agoPreliminary parsing and ASTs for template-ids that refer to function
Douglas Gregor [Tue, 30 Jun 2009 22:34:41 +0000 (22:34 +0000)]
Preliminary parsing and ASTs for template-ids that refer to function
templates, such as make<int&>. These template-ids are only barely
functional for function calls; much more to come.

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

15 years agoUpdate old CastRegion logic to not assume that ElementRegion's super region is a
Ted Kremenek [Tue, 30 Jun 2009 22:31:23 +0000 (22:31 +0000)]
Update old CastRegion logic to not assume that ElementRegion's super region is a
TypedRegion. While we plan on removing this code at some point, it serves as a
good reference implementation for use with BasicStore until we are sure the new
CastRegion logic (in RegionStore.cpp) is correct.

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

15 years agoFix: <rdar://problem/7021553> clang -fsyntax-only crashes (in ParseDeclarationSpecifi...
Ted Kremenek [Tue, 30 Jun 2009 22:19:00 +0000 (22:19 +0000)]
Fix: <rdar://problem/7021553> clang -fsyntax-only crashes (in ParseDeclarationSpecifiers ... from ParseObjCTypeName)

Another case where we should use SmallVector::data() instead of taking the
address of element 0 of a SmallVector when the SmallVector has no elements.

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

15 years agoDiagnose multiple initialization of anonymous union
Fariborz Jahanian [Tue, 30 Jun 2009 21:52:59 +0000 (21:52 +0000)]
Diagnose multiple initialization of anonymous union
fields in the ctor-initializer list.

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

15 years agoCombine two conditional branches into one. No functionality change.
Ted Kremenek [Tue, 30 Jun 2009 20:24:11 +0000 (20:24 +0000)]
Combine two conditional branches into one.  No functionality change.

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

15 years agoMore diagnostics related to initialization of direct bases
Fariborz Jahanian [Tue, 30 Jun 2009 17:34:52 +0000 (17:34 +0000)]
More diagnostics related to initialization of direct bases
in ctor-initializer list.

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

15 years agoWhen recursively instantiating function templates, keep track of the
Douglas Gregor [Tue, 30 Jun 2009 17:20:14 +0000 (17:20 +0000)]
When recursively instantiating function templates, keep track of the
instantiation stack so that we provide a full instantiation
backtrace. Previously, we performed all of the instantiations implied
by the recursion, but each looked like a "top-level" instantiation.

The included test case tests the previous fix for the instantiation of
DeclRefExprs. Note that the "instantiated from" diagnostics still
don't tell us which template arguments we're instantiating with.

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

15 years agoReapply r74532, and inherit from OSTargetInfo instead of from Target.
Torok Edwin [Tue, 30 Jun 2009 17:10:35 +0000 (17:10 +0000)]
Reapply r74532, and inherit from OSTargetInfo instead of from Target.
'make test' passes now.

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

15 years agoRevert 74532 till I figure out why it breaks a bunch of tests.
Torok Edwin [Tue, 30 Jun 2009 17:00:25 +0000 (17:00 +0000)]
Revert 74532 till I figure out why it breaks a bunch of tests.

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

15 years agoUpdate C++ section data and directory structure to reflect N2914
Douglas Gregor [Tue, 30 Jun 2009 16:45:27 +0000 (16:45 +0000)]
Update C++ section data and directory structure to reflect N2914

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

15 years agoCompute ending of iterator in for-loop once.
Fariborz Jahanian [Tue, 30 Jun 2009 16:36:53 +0000 (16:36 +0000)]
Compute ending of iterator in for-loop once.

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

15 years agoUse templates instead of creating a new class for each OS/Target combination.
Torok Edwin [Tue, 30 Jun 2009 16:30:17 +0000 (16:30 +0000)]
Use templates instead of creating a new class for each OS/Target combination.
This unifies all the targets supported by an OS into a template.
It also cleans up the differences between the darwin targets.
Also __LP64__ wasn't needed for *BSD, since x86-64 target defines it anyway.

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

15 years agoRefactor ActOnDeclarationNameExpr into a "parsing action" part and a
Douglas Gregor [Tue, 30 Jun 2009 15:47:41 +0000 (15:47 +0000)]
Refactor ActOnDeclarationNameExpr into a "parsing action" part and a
"semantic analysis" part. Use the "semantic analysis" part when
performing template instantiation on a DeclRefExpr, rather than an ad
hoc list of rules to construct DeclRefExprs from the instantiation.

A test case for this change will come in with a large commit, which
illustrates what I was actually trying to work on.

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

15 years agoInstead of r74522, use another approach to fix xfail_regionstore_wine_crash.c.
Zhongxing Xu [Tue, 30 Jun 2009 13:00:53 +0000 (13:00 +0000)]
Instead of r74522, use another approach to fix xfail_regionstore_wine_crash.c.
Mark the super region of the binding of block level expr in the Environment
as live.

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

15 years agoWhen retrieving element region, if its super region has binding, return
Zhongxing Xu [Tue, 30 Jun 2009 12:32:59 +0000 (12:32 +0000)]
When retrieving element region, if its super region has binding, return
unknown for it.

Mark the super region of a live region as live, if the live region is pointed
to by a live pointer variable.

These fixes xfail_regionstore_wine_crash.c.

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

15 years agoBlock level expr should be visited. Otherwise variables in init expr of
Zhongxing Xu [Tue, 30 Jun 2009 12:11:58 +0000 (12:11 +0000)]
Block level expr should be visited. Otherwise variables in init expr of
DeclStmt would be dead before the DeclStmt.
For example:
int x = 0;
int y = x;
'x' would be dead before 'int y = x'.

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

15 years agoadd utility method.
Zhongxing Xu [Tue, 30 Jun 2009 11:52:40 +0000 (11:52 +0000)]
add utility method.

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

15 years agoadd utility methods.
Zhongxing Xu [Tue, 30 Jun 2009 11:50:39 +0000 (11:50 +0000)]
add utility methods.

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

15 years agoremove dead code.
Zhongxing Xu [Tue, 30 Jun 2009 07:50:26 +0000 (07:50 +0000)]
remove dead code.

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

15 years agoWe do not require the super region of element region be typed. So do not
Zhongxing Xu [Tue, 30 Jun 2009 07:41:27 +0000 (07:41 +0000)]
We do not require the super region of element region be typed. So do not
create TypedViewRegion for it.

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

15 years agoImplement PR4175, catching some questionable comparisons. Patch by
Chris Lattner [Tue, 30 Jun 2009 06:24:05 +0000 (06:24 +0000)]
Implement PR4175, catching some questionable comparisons.  Patch by
David Majnemer!

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

15 years agoDe-ASTContext-ify DeclContext.
Argyrios Kyrtzidis [Tue, 30 Jun 2009 02:36:12 +0000 (02:36 +0000)]
De-ASTContext-ify DeclContext.

Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.

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

15 years agoIntroduce DeclContext::getParentASTContext().
Argyrios Kyrtzidis [Tue, 30 Jun 2009 02:35:38 +0000 (02:35 +0000)]
Introduce DeclContext::getParentASTContext().

It's not getASTContext() to avoid "getASTContext is ambiguous" compiler errors for subclasses of both Decl and DeclContext.

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

15 years agoRemove the ASTContext parameter from the getBody() methods of Decl and subclasses.
Argyrios Kyrtzidis [Tue, 30 Jun 2009 02:35:26 +0000 (02:35 +0000)]
Remove the ASTContext parameter from the getBody() methods of Decl and subclasses.

Timings showed no significant difference before and after the commit.

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

15 years agoRemove the ASTContext parameter from the printing related methods of Decl.
Argyrios Kyrtzidis [Tue, 30 Jun 2009 02:35:04 +0000 (02:35 +0000)]
Remove the ASTContext parameter from the printing related methods of Decl.

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

15 years agoDecl::getTranslationUnitDecl() should return itself when the Decl is a TranslationUni...
Argyrios Kyrtzidis [Tue, 30 Jun 2009 02:34:53 +0000 (02:34 +0000)]
Decl::getTranslationUnitDecl() should return itself when the Decl is a TranslationUnitDecl.

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

15 years agoRemove the ASTContext parameter from the attribute-related methods of Decl.
Argyrios Kyrtzidis [Tue, 30 Jun 2009 02:34:44 +0000 (02:34 +0000)]
Remove the ASTContext parameter from the attribute-related methods of Decl.
The implementations of these methods can Use Decl::getASTContext() to get the ASTContext.

This commit touches a lot of files since call sites for these methods are everywhere.
I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it.

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

15 years agoKey decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.
Chris Lattner [Tue, 30 Jun 2009 01:26:17 +0000 (01:26 +0000)]
Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.

This is simple enough, but then I thought it would be nice to make PrintingPolicy
get a LangOptions so that various things can key off "bool" and "C++" independently.
This spiraled out of control.  There are many fixme's, but I think things are slightly
better than they were before.

One thing that can be improved: CFG should probably have an ASTContext pointer in it,
which would simplify its clients.

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

15 years agoTake care of Chris's comments.
Fariborz Jahanian [Tue, 30 Jun 2009 00:17:27 +0000 (00:17 +0000)]
Take care of Chris's comments.

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

15 years agoMake an error message more clear.
Anders Carlsson [Tue, 30 Jun 2009 00:06:57 +0000 (00:06 +0000)]
Make an error message more clear.

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

15 years agoA more detailed diagnosis of ill-formed ctor-initializer
Fariborz Jahanian [Tue, 30 Jun 2009 00:02:17 +0000 (00:02 +0000)]
A more detailed diagnosis of ill-formed ctor-initializer
list.

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

15 years agoUse true/false instead of 1/0.
Daniel Dunbar [Mon, 29 Jun 2009 23:58:47 +0000 (23:58 +0000)]
Use true/false instead of 1/0.

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

15 years agoImprovements to decltype. We now don't crash anymore when the expr is an overloaded...
Anders Carlsson [Mon, 29 Jun 2009 22:58:55 +0000 (22:58 +0000)]
Improvements to decltype. We now don't crash anymore when the expr is an overloaded function decl.

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

15 years agoDon't define __KPRINTF_ATTRIBUTE__ unconditionally on OpenBSD.
Daniel Dunbar [Mon, 29 Jun 2009 22:45:37 +0000 (22:45 +0000)]
Don't define __KPRINTF_ATTRIBUTE__ unconditionally on OpenBSD.

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

15 years agoImprove code generation for function template specializations:
Douglas Gregor [Mon, 29 Jun 2009 22:39:32 +0000 (22:39 +0000)]
Improve code generation for function template specializations:
  - Track implicit instantiations vs. the not-yet-supported explicit
  specializations
  - Give implicit instantiations of function templates (and member
  functions of class templates) linkonce_odr linkage.
  - Improve name mangling for function template specializations,
  including the template arguments of the instantiation and the return
  type of the function.

Note that our name-mangling is improved, but not correct: we still
don't mangle substitutions, although the manglings we produce can be
demangled.

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

15 years agoDiagnose multiple initialzation of data-member/base
Fariborz Jahanian [Mon, 29 Jun 2009 22:33:26 +0000 (22:33 +0000)]
Diagnose multiple initialzation of data-member/base
in the ctor-initializer list. More to come.

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

15 years agoRemove some dead code
Anders Carlsson [Mon, 29 Jun 2009 21:39:57 +0000 (21:39 +0000)]
Remove some dead code

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

15 years agoKeep track of function template specializations, to eliminate
Douglas Gregor [Mon, 29 Jun 2009 20:59:39 +0000 (20:59 +0000)]
Keep track of function template specializations, to eliminate
redundant, implicit instantiations of function templates and provide a
place where we can hang function template specializations.

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

15 years agoOpenBSD support.
Daniel Dunbar [Mon, 29 Jun 2009 20:52:51 +0000 (20:52 +0000)]
OpenBSD support.
 - Patch by Jonathan Gray!

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

15 years ago-Keep a reference to the ASTContext inside the TranslationUnitDecl.
Argyrios Kyrtzidis [Mon, 29 Jun 2009 17:38:40 +0000 (17:38 +0000)]
-Keep a reference to the ASTContext inside the TranslationUnitDecl.
-Introduce Decl::getASTContext() which returns the reference from the TranslationUnitDecl that it is contained in.

The general idea is that Decls can point to their own ASTContext so that it is no longer required to "manually" keep track and make sure that you pass the correct ASTContext to Decls' methods, e.g. methods like Decl::getAttrs should eventually not require a ASTContext parameter.

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

15 years agoRemove redundant leftover code.
Argyrios Kyrtzidis [Mon, 29 Jun 2009 17:38:09 +0000 (17:38 +0000)]
Remove redundant leftover code.

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

15 years agoFix the FloatingLiteral API to take the isexact flag by value instead of
Chris Lattner [Mon, 29 Jun 2009 17:34:55 +0000 (17:34 +0000)]
Fix the FloatingLiteral API to take the isexact flag by value instead of
by pointer.

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

15 years agoMove FunctionDecl::TemplateSpecializationInfo out into its own class,
Douglas Gregor [Mon, 29 Jun 2009 17:30:29 +0000 (17:30 +0000)]
Move FunctionDecl::TemplateSpecializationInfo out into its own class,
FunctionTemplateSpecializationInfo, in DeclTemplate.h. No functionality change.

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