Commit Graph

3063 Commits

Author SHA1 Message Date
Chris Lattner d4fc27e937 remove the loc argument to Type::isConstantSizeType, which isn't useful.
llvm-svn: 45155
2007-12-18 07:18:16 +00:00
Chris Lattner 20aad334c7 Fix the location we emit the "not a constant" error for this:
int foo() {
  typedef int x[foo()];
  static int y = sizeof(x);
}

previously we'd emit it on the typedef, which made not sense at all.

llvm-svn: 45154
2007-12-18 07:15:40 +00:00
Chris Lattner 6d2d1b67ca Fix PR1863: an assertion due to not setting a location on return from
this method.

llvm-svn: 45153
2007-12-18 07:03:30 +00:00
Chris Lattner 78e34a00f4 Fix const propagation bug.
llvm-svn: 45152
2007-12-18 07:02:56 +00:00
Chris Lattner dcb7cc59ae Fix an nice and subtle parser bug reported by Nico Weber.
llvm-svn: 45149
2007-12-18 06:06:23 +00:00
Steve Naroff b723564c79 Add DefaultFunctionArrayConversion() to the indirection operator in Sema::ActOnUnaryOp().
This fixes a bug Chris forwarded from Oliver Hunt...

typedef struct { char name[100]; } entry;
char f1(entry *e) { return *e->name; }

llvm-svn: 45148
2007-12-18 04:06:57 +00:00
Steve Naroff b74406ba98 Fixe bogus error for variable argument methods. Sema::ObjcGetTypeForMethodDefinition() wasn't preserving the isVariadic boolean. Another fix is to avoid synthsizing the function decl entirely, however this is a separate issue that I don't want to deal with now. Also added a FIXME to Sema::CheckFunctionCall(), which is currently emitting a bogus warning.
llvm-svn: 45146
2007-12-18 03:41:15 +00:00
Anders Carlsson aa5c91980e Turns out the LLVMFoldingBuilder can fold InsertElement. Knowing this, we can get rid of our special casing of constants when creating vectors.
llvm-svn: 45145
2007-12-18 02:45:33 +00:00
Steve Naroff 1d2538cb4d Improve how we find private method decls. This involved:
- Changed Sema::ObjcActOnStartOfMethodDef() to register the methods with the global pools.
- Changed Sema::ActOnInstanceMessage() to look in global pools (should be much less error prone).
- Added a test case to message.m (for lookup that was broken).

Misc changes while I was investigating this...

- Changed Sema::ActOnAtEnd() to call AddFactoryMethodToGlobalPool (this looked like a cut/paste error).
- Added a comment and tweaked another where I was using the first person.

llvm-svn: 45142
2007-12-18 01:30:32 +00:00
Chris Lattner b8be97e239 introduce a new CodeGenModule::getIntrinsic method, which wraps
Intrinsic::getDeclaration, allowing much more terse code.

llvm-svn: 45136
2007-12-18 00:25:38 +00:00
Steve Naroff 2050b0d05a Add __private_extern__ keyword and recognize it. Added a FIXME to indicate there is still work to do.
llvm-svn: 45135
2007-12-18 00:16:02 +00:00
Fariborz Jahanian 9b482ba9ec Fixed a comment describing a function
llvm-svn: 45125
2007-12-17 21:48:49 +00:00
Chris Lattner 619e18cce2 implement HeaderMap::LookupFile. I think headermaps are done now. All that is
left is this crazy thing called "testing".

llvm-svn: 45124
2007-12-17 21:38:04 +00:00
Chris Lattner 9f9a619a9f implement enough helper functions to successfully dump out the
contents of the header map.  Look ma, no assumptions about input data
here (aka, corrupt header maps can't crash the compiler - crazy thought).

llvm-svn: 45122
2007-12-17 21:06:11 +00:00
Fariborz Jahanian 24cb52c9b0 Patch to implemented objective-c's dynamic object pointer qualified with
the protocol list (id<P,...> types).

llvm-svn: 45121
2007-12-17 21:03:50 +00:00
Chris Lattner a0943c36ed Targets.cpp is gone.
llvm-svn: 45119
2007-12-17 20:56:50 +00:00
Chris Lattner e6a76da763 Make the insertion point with an explicit new instead of the builder.
llvm-svn: 45118
2007-12-17 20:50:59 +00:00
Ted Kremenek a59e0064d3 Removed CFG.cpp's dependence on #including iostream.
llvm-svn: 45116
2007-12-17 19:35:20 +00:00
Ted Kremenek 3fbeaea7ee Modified format-string checking to not emit a warning when all of the
following hold:

(1) A vprintf-like function is called that takes the argument list via a
    via_list argument.

(2) The format string is a non-literal that is the parameter value of
    the enclosing function, e.g:
    
    void logmessage(const char *fmt,...) { 
      va_list ap;
      va_start(ap,fmt);
      fprintf(fmt,ap);  // Do not emit a warning.
    }
    
In the future this special case will be enhanced to consult the "format"
attribute attached to a function declaration instead of just allowing a blank
check for all function parameters to be used as format strings to vprintf-like
functions. This will happen when more support for attributes becomes
available.

llvm-svn: 45114
2007-12-17 19:03:13 +00:00
Chris Lattner d39b8c0269 simplify some code, using new scoped_ptr support. Fix a bug in the
cross-endianness case, where we checked the version in the wrong endianness.
Amusingly, the GCC logic that detects mixed endianness hmaps and rejects 
them is dead for this very reason.

llvm-svn: 45113
2007-12-17 18:59:44 +00:00
Chris Lattner 79764a6bee Finish hooking up the scaffolding for headermaps. They can now do everything
except resolve lookups.

llvm-svn: 45111
2007-12-17 18:44:09 +00:00
Ted Kremenek ea63b1575c Format string checker: asprintf does not pass argumnents via va_list.
llvm-svn: 45110
2007-12-17 18:38:31 +00:00
Chris Lattner 4ffe46cbdf Start reading the headermap header, drop the 'errorstr' argument to
the create method.

llvm-svn: 45109
2007-12-17 18:34:53 +00:00
Fariborz Jahanian 77b713b5d3 Also fixed similar regression for class methods, as well as more indentations.
llvm-svn: 45107
2007-12-17 18:07:01 +00:00
Chris Lattner 8d720d083a Sink getName into DirectoryLookup to simplify the client in clang.
llvm-svn: 45106
2007-12-17 17:57:27 +00:00
Fariborz Jahanian 5f6409532b Fixed a regression caused by refactoring of some meta-data generation routines using iteratgors.
Also fixed indentation problems.

llvm-svn: 45105
2007-12-17 17:56:10 +00:00
Ted Kremenek 73e921fdf2 Fixed 80 col violation.
llvm-svn: 45104
2007-12-17 17:50:39 +00:00
Ted Kremenek 5aa66bdfd6 Added driver option -Wno-format-nonliteral to silence format string related
warnings. This flag is the inverse of to GCC's -Wformat-nonliteral option (in
the clang driver, these warnings are on by default).

Patch provided by Shantonu Sen.

llvm-svn: 45103
2007-12-17 17:50:07 +00:00
Chris Lattner faebb62651 Unbreak -v with framework paths. Patch by Shantonu Sen.
llvm-svn: 45102
2007-12-17 17:42:26 +00:00
Ted Kremenek 05821322b4 Fixed another case where sizeof() returns the size in bytes, not bits.
This parallels a previous patch (duplicate logic caused the bug to appear
in multiple locations):
 
  r44316 (http://llvm.org/viewvc/llvm-project?rev=44316&view=rev).

Patch provided by Nuno Lopes.

llvm-svn: 45098
2007-12-17 17:38:43 +00:00
Chris Lattner 1587e6db01 add headermap.cpp
llvm-svn: 45095
2007-12-17 08:22:46 +00:00
Chris Lattner 44bd21b7c1 finish stubbing out support for HeaderMap. Now we just need an implementation!
llvm-svn: 45094
2007-12-17 08:17:39 +00:00
Chris Lattner 712e3873a0 refactor an better comment framework lookup code. This moves it from
HeaderSearch into DirectoryLookup, as a particular framework lookup is 
specific to the directory we are currently querying.

llvm-svn: 45093
2007-12-17 08:13:48 +00:00
Chris Lattner f62f75895f as it turns out, frameworks and headermaps are orthogonal. Make this so in
the internal representation.  This also fixes a bug where -I foo  -F foo would
not search foo as both a normal and framework include dir.

llvm-svn: 45092
2007-12-17 07:52:39 +00:00
Chris Lattner dd00e625d2 add a portability fixme.
llvm-svn: 45091
2007-12-17 06:51:34 +00:00
Chris Lattner 3e206b3a0e teach RemoveDuplicates about header maps.
llvm-svn: 45090
2007-12-17 06:44:29 +00:00
Chris Lattner c4ba38ed1e Step #1 in adding headermap support to clang.
llvm-svn: 45089
2007-12-17 06:36:45 +00:00
Chris Lattner 899ff4a26d rearrange some code and make it more efficient.
llvm-svn: 45087
2007-12-17 05:59:27 +00:00
Chris Lattner 28c91c5f35 add a hack so that codegen doesn't abort on missing sema of initializers, now
we emit stuff like this:

abort on missing sema of initializers, now
we emit stuff like this:

t3.c:1:24: warning: cannot codegen this initializer yet
const char x[2][4] = { { 'a', 'b', '\0', '\0' }, { 'c', 'd', 'e', '\0' } };
                       ^~~~~~~~~~~~~~~~~~~~~~~~

This should be removed when sema is finished.

llvm-svn: 45086
2007-12-17 05:17:42 +00:00
Christopher Lamb 77560fbde7 Update to use new PointerType::getUnqual() api.
llvm-svn: 45081
2007-12-17 01:11:20 +00:00
Anders Carlsson ca6bcae0be Start generating SSE intrinsics.
llvm-svn: 45079
2007-12-16 22:33:50 +00:00
Steve Naroff eaaae467c7 Sema::ActOnMemberReferenceExpr() needs to perform the default conversions.
Bug and test case provided by Carl Lewis.

llvm-svn: 45078
2007-12-16 21:42:28 +00:00
Chris Lattner 39911a2258 swtich to smallptrset, which is more efficient than std::set.
llvm-svn: 45065
2007-12-15 23:20:07 +00:00
Chris Lattner d6658d932b make clang -v output more similar to gcc's -v output.
llvm-svn: 45064
2007-12-15 23:11:06 +00:00
Anders Carlsson f5f6544edc We now support all MMX intrinsics. SSE intrinsics are next.
llvm-svn: 45062
2007-12-15 21:23:30 +00:00
Chris Lattner 60a288ab19 simplify the interfaces to ProcessInputFile and InitializePreprocessor
llvm-svn: 45060
2007-12-15 20:48:40 +00:00
Ted Kremenek 56ba5b3931 Removed "isSizeOfExpr" mode from StmtIterator. It turned out not to be
so useful and introduced a few bugs.

llvm-svn: 45051
2007-12-15 00:39:18 +00:00
Ted Kremenek 3291844bf0 Added "mode" to StmtIterator to record if the expression being iterated
over is the subexpression of a sizeof(expression).  Different clients
will wish to handle iteration over such subexpressions differently, and can
now easily query if they are iterating over such statements using the
StmtIterator's inSizeOfExpr().

llvm-svn: 45047
2007-12-14 23:40:56 +00:00
Steve Naroff 3ce37a6b8e - Remove getInstanceMethods/getClassMethods API on ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCategoryDecl. These methods are replaced by the respective iterators on each class.
- Add getInstanceMethodForSelector to ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCatgoryDecl. This hook will do a "shallow" lookup. This is a convenience method that reducing some of the iterator usage.
- Various changes to convert all clients to the above API's...
 

llvm-svn: 45046
2007-12-14 23:37:57 +00:00
Ted Kremenek 85e45f278c Added support to StmtIterator to traverse the size expression of a VLA type
declared in a sizeof.  For example:

 sizeof(int[foo()]);

the expression "foo()" is an expression that is executed during the evaluation
of sizeof.

llvm-svn: 45043
2007-12-14 22:52:23 +00:00