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

922 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 2e1cd4264d Introduction the DeclarationName class, as a single, general method of
representing the names of declarations in the C family of
languages. DeclarationName is used in NamedDecl to store the name of
the declaration (naturally), and ObjCMethodDecl is now a NamedDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59441 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 14:58:09 +00:00
Steve Naroff 707b0fe2ef Fix <rdar://problem/6372970> clang ObjC rewriter: incorrect cast when passing block argument
SynthBlockInitExpr() was not adding by-ref arguments to the init expr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59322 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-14 21:36:12 +00:00
Steve Naroff 0aab796da2 Fix <rdar://problem/6370288> clang ObjC rewriter: Too many _objc_symtab, _OBJC_SYMBOLS
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59301 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-14 14:10:01 +00:00
Steve Naroff ace6625f23 Fix an obscure rewriter bug when rewriting implementations that don't have a corresponding interface (found while doing random testing on another bug).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 20:07:04 +00:00
Steve Naroff 0007268870 Fix <rdar://problem/6343942> clang ObjC rewriter: crash rewriting blocks
and <rdar://problem/6344601> clang ObjC rewriter: crash passing Block parameter?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 17:40:07 +00:00
Daniel Dunbar b087ae912b Obey the FIXMES!
- Resume running the always inliner pass always now that LLVM has
   been improved and functions with debug info can be inlined.
 - Remove unused header.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 05:29:02 +00:00
Daniel Dunbar 26fb272713 [LLVM up] Update for raw_fd_ostream change. This fixes a FIXME that
the Backend output should be done in binary mode.
 - I'd appreciate it if someone who has a Windows build could verify
   this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59221 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 05:09:21 +00:00
Douglas Gregor eb8f306325 Implement support for operator overloading using candidate operator
functions for built-in operators, e.g., the builtin

  bool operator==(int const*, int const*)

can be used for the expression "x1 == x2" given:

  struct X {
    operator int const*();
  } x1, x2;

The scheme for handling these built-in operators is relatively simple:
for each candidate required by the standard, create a special kind of
candidate function for the built-in. If overload resolution picks the
built-in operator, we perform the appropriate conversions on the
arguments and then let the normal built-in operator take care of it. 

There may be some optimization opportunity left: if we can reduce the
number of built-in operator overloads we generate, overload resolution
for these cases will go faster. However, one must be careful when
doing this: GCC generates too few operator overloads in our little
test program, and fails to compile it because none of the overloads it
generates match.

Note that we only support operator overload for non-member binary
operators at the moment. The other operators will follow.

As part of this change, ImplicitCastExpr can now be an lvalue.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59148 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 17:17:38 +00:00
Sebastian Redl 0518999d3a Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions, both of values and types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 17:56:53 +00:00
Daniel Dunbar d68ba0ee18 Move backend output out of destructor.
Don't free AST consumer when --disable-free is set.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 06:35:39 +00:00
Daniel Dunbar 48f475335a Remove unused function declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59024 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 04:48:20 +00:00
Argyrios Kyrtzidis eb83ecde1a Implement support for C++ nested-name-specifiers ('foo::bar::x') in the Parser side.
No Sema functionality change, just the signatures of the Action/Sema methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58913 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-08 16:45:02 +00:00
Ted Kremenek daac634c97 Patch by Nikita Zhuk: Add TranslationUnitActions to AnalysisConsumer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58831 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-07 02:09:25 +00:00
Douglas Gregor eaebc75ef6 Initial, rudimentary implementation of operator overloading for binary
operators. For example, one can now write "x + y" where x or y is a
class or enumeration type, and Clang will perform overload resolution
for "+" based on the overloaded operators it finds.

The other kinds of overloadable operators in C++ will follow this same
approach. 

Three major issues remain:
  1) We don't find member operators
  2) Since we don't have user-defined conversion operators, we can't
  call any of the built-in overloaded operators in C++ [over.built].
  3) Once we've done the semantic checks, we drop the overloaded
  operator on the floor; it doesn't get into the AST at all.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-06 23:29:22 +00:00
Ted Kremenek f304ddcf6b AnalysisManager can now be used to for analyses over TranslationUnits.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 19:05:06 +00:00
Douglas Gregor cd9b46e544 Add a new expression class, ObjCSuperExpr, to handle the Objective-C 'super'. Remove ObjCThis from PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58698 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 14:56:14 +00:00
Steve Naroff b2f9e51632 Fix <rdar://problem/6339636> clang ObjC rewriter: Assertion failed: FileID-1 < FileIDs.size() && "Invalid FileID!", file c:\cygwin\home\Administrator\llvm\tools\clang\include\clang/Basic/SourceManager.h, line 513
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58654 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 23:29:32 +00:00
Ted Kremenek 4fc82c8458 Hook up the Plist diagnostic client to the driver.
Fix Plist output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 23:18:07 +00:00
Ted Kremenek ad99dbfc1d Rename 'HTMLDiagnostics.h' to 'PathDiagnosticClients.h'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 22:31:48 +00:00
Steve Naroff 8f6ce5796f Fix <rdar://problem/6336774> clang block rewriter: Assertion failed: Offset+NumBytes <= size() && "Invalid region to erase!", file c:\cygwin\home\Administrator\llvm\to ols\clang\include\clang/Rewrite/RewriteRope.h, line 219.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 11:20:24 +00:00
Daniel Dunbar dd913e5576 Turn off module verification in Release-Asserts builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 09:34:21 +00:00
Daniel Dunbar e10b0f236b "One" line fix for -parse-noop failure, "id" and several other things
were being treated as type names for non-Objective-C files.
 - Other lines are just because MinimalAction didn't have access to
   the LangOptions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 08:56:51 +00:00
Steve Naroff c8ad87bcbd Make sure RewriteObjCMethodDecl() does a block pointer rewrite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58430 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 14:45:29 +00:00
Steve Naroff ced80a848d Add a couple fixes for rewriting ivars/methods that use/contain blocks.
Now this:

@interface Test
{
  void (^ivar)(void);
}
- (void)name;
@end

@implementation Test
- (void)name {
  ivar = ^{ printf("hello\n"); }; // ((struct Test_IMPL *)self)->ivar = (void (*)(void))&__name_block_impl_0((void *)__name_block_func_0);
  ivar(); // ((void (*)(struct __block_impl *))((struct __block_impl *)((struct Test_IMPL *)self)->ivar)->FuncPtr)((struct __block_impl *)((struct Test_IMPL *)self)->ivar); 
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58428 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 12:09:33 +00:00
Steve Naroff aa4d5ae6c4 Convert SynthesizeBlockCall() from test->AST based implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58427 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 10:07:53 +00:00
Zhongxing Xu 3702af57e3 Adjust code format.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 05:03:28 +00:00
Steve Naroff fdc0372eda Convert SynthBlockInitExpr() from text->AST based implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 21:23:59 +00:00
Steve Naroff 8e2f57ad06 Handle block literals at file scope, remove some dead code, etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58390 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 18:15:37 +00:00
Steve Naroff a206b0614a Make sure internally synthesized block pointer types are converted before pretty printing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58380 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 14:49:46 +00:00
Daniel Dunbar 90f41303c6 Workaround an LLVM bug where inlining functions with debug info breaks
code generation.
 - For now, disable running the always inliner pass (at -O0) if we are
   also generating debug information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58376 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 08:50:02 +00:00
Daniel Dunbar ac7ffe0102 Improve llvm-gcc compatibility, -Os implies -O2 (sortof).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58374 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 07:56:11 +00:00
Daniel Dunbar 8e8f3b7f61 Choose CompileOptions (optimization passes) to match llvm-gcc more
closely.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58361 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 03:42:18 +00:00
Chris Lattner 1b450b092a .s files don't require the preprocessor, patch by Roman Divacky!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 20:33:42 +00:00
Steve Naroff fa15fd9db4 More changes necessary to integrate the objc and blocks rewriters.
With this commit, stuff like this is very close to working...

    [foo barf:^(int){ printf("whatever\n"); }];

Here is what is currently translates to...

    ((id (*)(id, SEL, void (^)(int)))(void *)objc_msgSend)((id)foo, sel_registerName("barf:"), (void (*)(int))__main_block_func_0);

I just need make sure the funky cast on objc_msgSend() is converted from "void (^)(int)" to "void (*)(int)". Since the cast doesn't appear in the source code, it needs to be converted in RewriteObjC::SynthMessageExpr().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58348 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 20:29:00 +00:00
Daniel Dunbar d8e3098d4f Access pass manager consistently.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 19:23:05 +00:00
Douglas Gregor 6eec8e883d Rename ExplicitCCastExpr to CStyleCastExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58331 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 15:36:24 +00:00
Daniel Dunbar 524b86f03f Call llvm_shutdown() on (normal) termination. This makes --time-passes usable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58308 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 00:38:08 +00:00
Daniel Dunbar 276373df8c With -verify, only exit early on failure.
- Nice if -verify test exercise the various cleanup functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58285 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 22:10:13 +00:00
Daniel Dunbar 879c3eaab7 Remove unneeded CheckASTConsumer function.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58282 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 22:03:52 +00:00
Steve Naroff 80c28553e0 Fix testsuite regression for "crash.m".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 20:54:44 +00:00
Daniel Dunbar d611bac92c Don't double free module when IRgen fails.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 20:40:41 +00:00
Daniel Dunbar 7e9f1f7de8 Improve dependency file support.
- Add support for -MP (phony targets).
 
 - Use raw_ostream for output instead of std::string concatenation.
 
 - Break long lines in a GCC (4.2) compatible manner.

 - Output dependents in #included order (to match GCC).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 20:01:06 +00:00
Douglas Gregor 49badde06e Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
  - ImplicitCastExpr is (still) used for all explicit casts
  - ExplicitCastExpr is now the root of all *explicit* casts
  - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
  - CXXFunctionalCastExpr inherits from ExplicitCastExpr
  - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
    of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
  - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, 
    CXXReinterpretCastExpr, and CXXConstCastExpr to 

Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.

Most of this patch is simply support for the renaming. There's very
little actual change in semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 19:41:14 +00:00
Steve Naroff a48396e10f Some fixups to the previous objc/blocks rewriter smerge.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 18:50:14 +00:00
Steve Naroff 54055232a5 Integrate the blocks and objc rewriters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 17:20:55 +00:00
Chris Lattner 9d72851fec Rename Characteristic_t to CharacteristicKind
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 01:19:25 +00:00
Chris Lattner 418f6c7d14 Remember whether an initlist had a designator in the AST.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58218 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 23:43:26 +00:00
Chris Lattner 220ad7c8d1 pass designators into sema. This completes parser-level designator
support as far as I know.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 23:35:51 +00:00
Sebastian Redl ad3c91c267 Allow \n for newlines in expected error messages.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58198 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 19:05:16 +00:00
Argyrios Kyrtzidis 7fb5e48882 Don't give a default argument to ASTContext::getFunctionType for the TypeQuals parameter, it causes subtle bugs where TypeQuals, while necessary, are omitted from the call.
-Remove the default argument.
-Update all call sites of ASTContext::getFunctionType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58187 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 16:43:14 +00:00
Oscar Fuentes d2f4e5ea6e CMake: Builds and installs clang binary and libs (no docs yet). It
must be under the `tools' subdirectory of the LLVM *source* tree.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 00:56:18 +00:00
Ted Kremenek 9a30c2474f Use string literal for format string specifier; this prevents ErrMsg from being interpretted as a format string specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 20:19:34 +00:00
Nuno Lopes 7d43a31832 2nd try to fix leakage of the module provider. note that moduleprovider takes ownership of the module
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58128 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 23:27:18 +00:00
Nuno Lopes dd49267500 fix leaking of the module provider
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58127 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 22:51:00 +00:00
Daniel Dunbar 750c358049 Add initial dependency file generation support. Patch by Kovarththanan
Rajaratnam, with some updates and formatting changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58122 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 22:12:41 +00:00
Douglas Gregor 1f81230ac5 Move viewInheritance to CXXRecordDecl, and make sure it builds in Release mode, too
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 19:53:54 +00:00
Daniel Dunbar 6c308cc40a Use LINK_COMPONENTS instead of hard coding LLVM libraries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58076 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 06:24:13 +00:00
Zhongxing Xu b406459d5b Fix linking error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58067 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 02:03:36 +00:00
Ted Kremenek 95c7b00fe8 Make the analyzer store (memory model) a command line option.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 01:04:59 +00:00
Ted Kremenek 7cae2f64a7 Added driver option "-cxx-inheritance-view" for viewing the C++ hierarchy of a class in GraphViz.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 23:36:29 +00:00
Daniel Dunbar 4c877cc89b Hook "fast" code generation to -O0.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58035 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 05:59:43 +00:00
Daniel Dunbar 70f92436f5 Add -O[0-3s] support (following llvm-gcc).
- Passes match llvm-gcc but many of the switches aren't wired.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58034 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 05:50:47 +00:00
Steve Naroff b9988c0c56 Fix <rdar://problem/6312683> clang block rewriter:
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58011 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 23:42:04 +00:00
Daniel Dunbar 8b7650ed5a Only create the target machine when emitting assembly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57993 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 18:29:51 +00:00
Daniel Dunbar ed2cb28552 [LLVM up] Get rid of std::ostream usage from Backend.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57990 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 17:40:45 +00:00
Chris Lattner a778d7d973 Add support for assembler-with-cpp (preprocessed .S files), patch by
Roman Divacky!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57988 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 17:29:21 +00:00
Daniel Dunbar 11292b0ce0 Update to use raw_ostream for PrintModulePass.
- Stop playing fast and loose with the std stream.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57948 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 03:28:13 +00:00
Daniel Dunbar d46075f8c3 Commito, didn't mean to remove this header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 23:54:00 +00:00
Daniel Dunbar d69bacc399 [LLVM up] Add basic -S option to clang.
- Split backend related consumer out into Backend.cpp, replaces
   LLVMCodeGenWriter.
 - Structure follows llvm-gcc to some extent.
 - Still need to implement all the options which impact code
   generation and the optimization passes which llvm-gcc uses at
   various levels.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57936 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 23:49:24 +00:00
Douglas Gregor 8e9bebdea6 Preliminary support for function overloading
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 16:13:35 +00:00
Steve Naroff 94ac21ea70 Fix <rdar://problem/6297052> confused in some way by embedded /* */ comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57903 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 13:37:27 +00:00
Steve Naroff fe6b0dc94a Fix <rdar://problem/6261178> clang-on-xcode: [sema] multiple method warning is over enthusiastic.
Fix <rdar://problem/6265257> warnings for ambiguous message send swamp other warnings.

Reworked Sema::MatchTwoMethodDeclarations() to optionally match based on method size and alignment (the default in GCC). Changed Sema::LookupInstanceMethodInGlobalPool() to use this feature.

Added -Wno-struct-selector-match to driver, however didn't hook it up yet. Added a FIXME that says this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 10:37:50 +00:00
Ted Kremenek 8588896b47 Added the start of a prototype implementation of PCH based on token caching.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57863 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 00:54:44 +00:00
Matthijs Kooijman 85b489739f Add newline at the end of file, to silence compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 08:12:48 +00:00
Daniel Dunbar 0d504c1da8 Remove unneeded EncodingRecordTypes argument to getObjCEncodingForType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 20:21:44 +00:00
Daniel Dunbar d3db401518 Add --disable-free flag to clang.
- Disables the freeing of the ASTContext and the TranslationUnit
   after parsing & sema.
 - Primarily for timing the impact on -fsyntax-only timings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57643 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 16:54:18 +00:00
Steve Naroff ca74360821 Tighten up blocks rewriter to handle casts and some other interesting cases.
This fixes <rdar://problem/6289007> clang block rewriter: ^ in cast is not rewritten.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 18:38:58 +00:00
Chris Lattner 99bd46c018 make the -rewrite-test a bit more interesting: it now
wraps comments in <i> tags.  Extend rewrite tokens to support
this minimal functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57409 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 06:09:52 +00:00
Chris Lattner cff9cc95de start implementing a token rewriter. At this point, it just reads in a file
and lets a client iterate over it. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 05:44:03 +00:00
Chris Lattner b13c5eef36 Add a new -rewrite-test option, which is basically a
playground to experiment with some new rewriter approaches. For now
it is probably the most complex version of 'cat' ever invented.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 05:29:20 +00:00
Chris Lattner c106c106c6 Add a new -dump-raw-tokens option, which allows us to see raw tokens.
Rename -dumptokens to -dump-tokens.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 05:03:36 +00:00
Chris Lattner 590f0cc643 Change how raw lexers are handled: instead of creating them and then
using LexRawToken, create one and use LexFromRawLexer.  This avoids
twiddling the RawLexer flag around and simplifies some code (even 
speeding raw lexing up a tiny bit).

This change also improves the token paster to use a Lexer on the stack
instead of new/deleting it. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 01:15:46 +00:00
Steve Naroff e0109a5427 Fix/simplify RewriteBlocks::RewriteBlockPointerFunctionArgs().
This completes the fix for <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 15:33:34 +00:00
Daniel Dunbar 0b0ee502fc Disable blocks support in C++ mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57334 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 00:20:52 +00:00
Steve Naroff 84a969fed7 Touchup the rewriter to handle the new BlockExpr->BlockDecl dance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57299 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 17:31:13 +00:00
Steve Naroff 56ee6896f2 - Add BlockDecl AST node.
- Modify BlockExpr to reference the BlockDecl.

This is "cleanup" necessary to improve our lookup semantics for blocks (to fix <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?).

Still some follow-up work to finish this (forthcoming).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 17:01:13 +00:00
Ted Kremenek ab9bae7583 Explicitly access the first Decl* referenced by a DeclStmt instead of using "getDecl()." Added a FIXME indicating that the call to RewriteObjCQualifiedInterfaceTypes() is meant to modifying the type-specifier; hopefully this will be a little more clean once DeclGroups contain type specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 22:45:07 +00:00
Ted Kremenek 50a25e25db Use "DeclStmt::getSolitaryDecl()" when accessing the DeclStmt of an @catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 22:39:38 +00:00
Ted Kremenek 1ed8e2a394 Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when rewriting Objective-c foreach statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 22:16:13 +00:00
Ted Kremenek fda4fede1b In RewriteFunctionBody, using DeclStmt::decl_iterator to rewrite the Decls in a DeclStmt instead of using getDecl() to fetch the first Decl.
Steve: Please review this patch.  'make test' passes, and my cursory scan of the rewriter leads me to believe this doesn't break anything, but I'm not sure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 18:47:09 +00:00
Daniel Dunbar 68c59184ee Allow -verify to be used with -rewrite-macros.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 01:38:39 +00:00
Daniel Dunbar 539ced1fdd Add dummy -ast-dump support for ObjC category implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57087 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:31:15 +00:00
Steve Naroff 22aed6574f Remove old diag that alerted the user to a limitation we no longer have:-)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:12:46 +00:00
Steve Naroff d3f779019c Create a function, eliminating some redundancy between SynthesizeBlockInitExpr() and SynthesizeBlockLiterals().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:06:12 +00:00
Steve Naroff acba0f2d0b Finish implementing copy/dispose helpers for imported block decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 23:47:37 +00:00
Daniel Dunbar b0adbba45c Set exit code properly on "Unexpected program action".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 23:42:49 +00:00
Steve Naroff 5e52b1763f Add indirection required for byref BlockDeclRefExpr's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 18:52:47 +00:00
Steve Naroff 3b0fd64cf3 Handle bookkeeping for imported blocks (in SynthesizeBlockImpl).
This code was "lost" with my recent changes to SynthesizeBlockFunc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 18:00:11 +00:00
Steve Naroff b65a4f1cc2 Cut/paste error...need to use the expression "name" for member references (or other complex expressions that can embed a block pointer type)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 17:45:51 +00:00
Steve Naroff 8e9216dab0 Clear the map that associated the rewritten block with it's corresponding BlockExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57053 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 17:10:02 +00:00
Steve Naroff 70f9550c27 Moved main control flow functions to bottom of file.
Reworked control flow to:
- rewrite the block expr body "in place".
- used Chris's new rewriter hook "getRewritenText" to "lift" the text for later use.
- finally, we do the block expr text replacement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57052 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 17:06:23 +00:00
Steve Naroff 94ede6e443 Remove an old/vacuous if clause.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57036 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 23:00:50 +00:00
Steve Naroff 4e13b762e0 More fun & games with the block rewriter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57028 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 20:28:15 +00:00
Steve Naroff 39622b9ad9 Rewrite global block expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:38:09 +00:00
Steve Naroff 83ba14e260 - Add a convenience constructor to Type.
- Many rewriter modifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57003 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:04:50 +00:00
Steve Naroff 48a8c61adb Rework SynthesizeBlockImpl() to include a constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 12:09:49 +00:00
Daniel Dunbar 1bfe1c2129 Pass postfix attributes to ActOnFields.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56992 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 02:03:53 +00:00
Steve Naroff 3ad29e2542 Get the right location to insert the synthesized block literals/functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 00:12:09 +00:00
Steve Naroff a0b75cf582 Name changes and some cleanup of preamble.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56984 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 23:30:43 +00:00
Steve Naroff 8af6a451ea Changed Sema::CheckForConstantInitializer to allow global block literals.
This commit also includes some name changes in the blocks rewriter (no functionality change).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 17:12:56 +00:00
Daniel Dunbar e553a726fa (llvm up) If the target triple is unspecified, automatically set the
OS version part to that of the host on darwin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 01:21:33 +00:00
Daniel Dunbar 14bfdfec4e Drop code to validate OS part of target triple on darwin, too fragile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 00:26:24 +00:00
Daniel Dunbar 320a054acf Fix help for --suppress-system-warnings
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:49:53 +00:00
Chris Lattner 079f2c467d Handle minor version numbers in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
like "10.3.9"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:30:12 +00:00
Chris Lattner ba0f25f754 Finish handling of -mmacosx-version-min. If you now do something like:
clang -mmacosx-version-min=10.4.9 ...

you'll end up with a target triple like "i686-apple-darwin8.9".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56871 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:16:56 +00:00
Chris Lattner 6a30c1fc7f start handling 'mmacosx-version-min', this is not complete yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56828 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 01:13:12 +00:00
Chris Lattner 0b9e736308 clean up a bunch of fixme's I added, by moving
DirectoryLookup::DirType into SourceManager.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:18:42 +00:00
Chris Lattner 1b9ad143c1 fit in 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 20:05:14 +00:00
Daniel Dunbar fd96684034 Make clang preprocessed output a bit more like gcc output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 01:13:35 +00:00
Steve Naroff cc2ece2e36 Fix a couple harmless warnings when compiling optimized with gcc (reported by mrs@apple.com).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 22:46:45 +00:00
Steve Naroff 1f6c3aebff Fix some const-ness to keep the VisualStudio C++ compiler happy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 17:22:34 +00:00
Steve Naroff ca3bb4f14f RewriteBlocks::RewriteBlockPointerDecl(): Handle TypedefDecl's and VarDecl's uniformly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 21:15:53 +00:00
Steve Naroff eab5f63207 Teach block rewriter to replace '^' with '*' in VarDecls.
Since we don't have DeclGroup's and location information for types, there is some fancy footwork to do this fairly reliably.

O.K...it's a kludge. One day, we can use this as motivation to do this more gracefully:-)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 19:24:41 +00:00
Ted Kremenek cfdf9b4edf Change implementation of NSError** coding-style check to be invoked at the end of the retain/release analysis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 21:25:13 +00:00
Steve Naroff 1318895690 Add driver support for invoking block rewriter.
Also tweaked the create function to take an explicit output file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 14:10:13 +00:00
Ted Kremenek f45d18c08b Implemented one of the checks requested in PR 2600:
"Method accepting NSError** argument should have non-void return value to indicate that an error occurred."

Test case written, but the header needs to be delta-debugged reduced.  Will commit shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 06:33:41 +00:00
Steve Naroff 9c3c902835 Remove BlockStmtExpr.
Block literals are now represented by the concrete BlockExpr class.
This is cleanup (removes a FIXME).
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 18:37:59 +00:00
Steve Naroff 1c9f81b902 Add support for rewriting blocks...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 00:13:27 +00:00
Ted Kremenek a95d375044 Patch by Csaba Hruska!
"Here is a patch what replaces std::ostream with llvm::raw_ostream. This patch
covers the AST library, but ignores Analysis lib."


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-13 05:16:45 +00:00
Daniel Dunbar 2fe0997427 Add --suppress-system-warnings (on by default, use =0 to disable)
- For investigating warnings in system headers / builtins.
 - Currently also enables the behavior that allows silent redefinition
   of types in system headers. Conceptually these are separate but I
   didn't feel it was worth two options (or changing LangOptions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-12 18:10:20 +00:00
Steve Naroff 378f47afee Fix <rdar://problem/6210791> clang ObjC rewriter: @try / @catch block with no @finally does not call objc_exception_try_exit.
Need a couple tweaks to RewriteObjCTryStmt(). Need to deal with implicit finally clauses (to make sure objc_exception_try_exit is called). Also fixed a related bug where we need to generate an implicit @catch else clause (to again make sure objc_exception_try_exit is called).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56104 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 15:29:03 +00:00
Argyrios Kyrtzidis d146552a1e LangOptions.C99 should be false in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56092 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 04:21:06 +00:00
Douglas Gregor 233f74b29b Add support for expected-note to Clang's -verify option
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 02:46:36 +00:00
Steve Naroff 8bd3dc64d2 Fix <rdar://problem/6197841> try, finally with no catch stops the exception from being propagated
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 19:59:12 +00:00
Nico Weber e275e926b3 rename libclangSEMA to libclangSema
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-07 17:09:06 +00:00
Ted Kremenek 4b7c98378a Change struct forward declarations and definitions to use unique RecordDecls, as opposed to creating a single RecordDecl and reusing it.
This change effects both RecordDecls and CXXRecordDecls, but does not effect EnumDecls (yet).

The motivation of this patch is as follows:
- Capture more source information, necessary for refactoring/rewriting clients.

- Pave the way to resolve ownership issues with RecordDecls with the forthcoming
  addition of DeclGroups.

Current caveats:
- Until DeclGroups are in place, we will leak RecordDecls not explicitly
  referenced by the AST.  For example:

    typedef struct { ... } x;  

  The RecordDecl for the struct will be leaked because the TypedefDecl doesn't
  refer to it.  This will be solved with DeclGroups.
  
- This patch also (temporarily) breaks CodeGen.  More below.

High-level changes:
- As before, TagType still refers to a TagDecl, but it doesn't own it.  When
  a struct/union/class is first referenced, a RecordType and RecordDecl are
  created for it, and the RecordType refers to that RecordDecl.  Later, if
  a new RecordDecl is created, the pointer to a RecordDecl in RecordType is
  updated to point to the RecordDecl that defines the struct/union/class.

- TagDecl and RecordDecl now how a method 'getDefinition()' to return the
  TagDecl*/RecordDecl* that refers to the TagDecl* that defines a particular
  enum/struct/class/union. This is useful from going from a RecordDecl* that
  defines a forward declaration to the RecordDecl* that provides the actual
  definition. Note that this also works for EnumDecls, except that in this case
  there is no distinction between forward declarations and definitions (yet).

- Clients should no longer assume that 'isDefinition()' returns true from a
  RecordDecl if the corresponding struct/union/class has been defined.
  isDefinition() only returns true if a particular RecordDecl is the defining
  Decl. Use 'getDefinition()' instead to determine if a struct has been defined.

- The main changes to Sema happen in ActOnTag. To make the changes more
  incremental, I split off the processing of enums and structs et al into two
  code paths. Enums use the original code path (which is in ActOnTag) and
  structs use the ActOnTagStruct. Eventually the two code paths will be merged,
  but the idea was to preserve the original logic both for comparison and not to
  change the logic for both enums and structs all at once.

- There is NO CHAINING of RecordDecls for the same RecordType. All RecordDecls
  that correspond to the same type simply have a pointer to that type. If we
  need to figure out what are all the RecordDecls for a given type we can build
  a backmap.

- The diff in CXXRecordDecl.[cpp,h] is actually very small; it just mimics the
  changes to RecordDecl. For some reason 'svn' marks the entire file as changed.

Why is CodeGen broken:
- Codegen assumes that there is an equivalence between RecordDecl* and
  RecordType*. This was true before because we only created one RecordDecl* for
  a given RecordType*, but it is no longer true. I believe this shouldn't be too
  hard to change, but the patch was big enough as it is.
  
I have tested this patch on both the clang test suite, and by running the static analyzer over Postgresql and a large Apple-internal project (mix of Objective-C and C).  


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55839 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 17:16:31 +00:00
Daniel Dunbar 737bdb418c Workaround gcc bug causing crash on our preprocessed outputs.
- gcc is not happy if we start a preprocessed file with
#line 1 "XXX" 1
 - Workaround by making sure file starts with a simple #line change.

Also, factored WriteLineInfo out.

Also, fixed bug where FileType was not being correctly updated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 03:22:57 +00:00
Ted Kremenek df042e6c2b Remove "NextDecl" from RecordDecl. This change touches many files that where RecordDecl or CXXRecordDecl was constructed, always with an argument of 'NULL' for the previous declaration.
The motivation behind this change is that chaining the RecordDecls is simply unnecessary.  Once we create multiple RecordDecls for the same struct/union/class, clients that care about all the declarations of the same struct can build a back map by seeing which Decls refer to the same RecordType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 01:34:33 +00:00
Ted Kremenek 628a42e04d Output "ANALYZE:" diagnostics to STDOUT instead of STDERR.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 00:02:50 +00:00
Ted Kremenek ea644d8440 Following gcc's behavior, only enable trigraphs if '-trigraphs' or '-ansi' is
specified, or -std is set to a conforming mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 21:22:16 +00:00
Daniel Dunbar 932680ecde Add newline to end of file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-29 03:45:59 +00:00
Ted Kremenek 45479c88c8 Always print out the function we're analyzing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55488 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 18:34:41 +00:00
Ted Kremenek 56b98719b0 Ubigraph visualization: represent cached nodes with a different style.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55463 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 05:02:09 +00:00
Ted Kremenek 710ad9343f Automatically execute ubiviz.
Cleanup ubigraph files when don't drawing the graphs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 03:54:51 +00:00
Ted Kremenek d1289327f7 Ubigraph-rendered ExplodedGraphs now have arrows and are oriented downward.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55446 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 22:46:55 +00:00
Ted Kremenek f8ce6991f4 Added Ubigraph visualization for the static analyzer (this is pretty alpha quality).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 22:31:43 +00:00
Daniel Dunbar 9f0afd4e79 Rename ObjCPropertyImplDecl::PropertyImplKind (consistency)
- Change enum name to Kind.
 - Change enum constants to English strings.

Also, fix getPropertyImplementation (which probably should be renamed)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 04:47:31 +00:00
Zhongxing Xu 8148839c10 Moved HTMLDiagnostics to lib/Driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55274 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 02:33:36 +00:00
Chris Lattner 405674c26c adjust to changes in various APIs from LLVM. We can't print
an APInt directly to an ostream now, so add some hacks.  It would
be better to switch all of the bugreport (and friends) stuff over
to raw_ostream.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:23:37 +00:00
Daniel Dunbar dcb4a1a6dd Add TargetInfo::useNeXTRuntimeAsDefault
- Used to autoselect runtime when neither -fnext-runtime nor
   -fgnu-runtime is specified.
 - Default impl is false, all darwin targets set it to true.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55231 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 08:43:39 +00:00