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

489 Коммитов

Автор SHA1 Сообщение Дата
Nate Begeman 2ef13e5abe Take 2 on AltiVec-style vector initializers.
Fixes PR4704 problems

Addresses Eli's patch feedback re: ugly cast code

Updates all postfix operators to remove ParenListExprs.  While this is awful,
no better solution (say, in the parser) is obvious to me.  Better solutions
welcome.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 23:49:36 +00:00
Chris Lattner 797c3c4f5d fix a couple of problems with section attributes:
1. Passing something that isn't a string used to cause:
   "argument to annotate attribute was not a string literal"
  make it say "section attribute" instead.

2. Fix the location of the above message to point to the
   bad argument instead of the section token.

3. Implement rdar://4341926, by diagnosing invalid section
   specifiers in the frontend rather than letting them slip all
   the way to the assembler (a QoI win).

An example of #3 is that we used to produce something like this:

/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name
/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.).

Daniel improved clang to use llvm_report_error, so now we got:

$ clang t.c -c
fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier
      requires a segment and section separated by a comma.

with no loc info.  Now we get:

$ clang t.c -fsyntax-only
t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment
      and section separated by a comma
int x __attribute__((section("sadf")));
                             ^

which is nice :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 19:03:04 +00:00
Daniel Dunbar 70121ebd65 Use LLVM's new error handler API to report back end errors using Diagnostic.
For example,
--
ddunbar@giles:Frontend$ clang -c backend-errors.c
fatal error: error in backend: Global variable 'a' has an invalid section specifier
      'I AM, not, legal': mach-o section specifier uses an unknown section type.
--
compare to:
--
ddunbar@giles:Frontend$ gcc -c backend-errors.c
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Expected comma after segment-name
/var/folders/DQ/DQ8GT3++HESEzT1obWBynE+++TI/-Tmp-//cc45w2pq.s:2:Rest of line ignored. 1st junk character valued 77 (M).
--

Yay!

I am not tied to my wording choice, we could also go with "uncoverable error"
for the prefix, or just leave it off entirely.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78554 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 03:40:28 +00:00
Daniel Dunbar 1df5109f47 Revert r78535, it is causing a number of failures to build projects.
--- Reverse-merging r78535 into '.':
D    test/Sema/altivec-init.c
U    include/clang/Basic/DiagnosticSemaKinds.td
U    include/clang/AST/Expr.h
U    include/clang/AST/StmtNodes.def
U    include/clang/Parse/Parser.h
U    include/clang/Parse/Action.h
U    tools/clang-cc/clang-cc.cpp
U    lib/Frontend/PrintParserCallbacks.cpp
U    lib/CodeGen/CGExprScalar.cpp
U    lib/Sema/SemaInit.cpp
U    lib/Sema/Sema.h
U    lib/Sema/SemaExpr.cpp
U    lib/Sema/SemaTemplateInstantiateExpr.cpp
U    lib/AST/StmtProfile.cpp
U    lib/AST/Expr.cpp
U    lib/AST/StmtPrinter.cpp
U    lib/Parse/ParseExpr.cpp
U    lib/Parse/ParseExprCXX.cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-10 03:01:36 +00:00
Nate Begeman 25b4fdb9d6 AltiVec-style vector initializer syntax, vec4 a = (vec4)(a, b, c, d);
In addition to being defined by the AltiVec PIM, this is also the vector
initializer syntax used by OpenCL, so that vector literals are compatible
with macro arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78535 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-09 17:55:44 +00:00
Benjamin Kramer 21fde994b2 Remove duplicated colon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77891 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 12:12:11 +00:00
Mike Stump 738f8c278d Add beginnigs of rtti generation, wire up more of -fno-exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 23:15:31 +00:00
Argyrios Kyrtzidis 19b732a546 Add support for ObjC message expressions, in the Analyzer:
-Accept an ObjC method and find all message expressions that this method may respond to.
-Accept an ObjC message expression and find all methods that may respond to it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 00:03:55 +00:00
Argyrios Kyrtzidis 87bcb504f6 Support ObjC methods as Entities.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77547 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:41:46 +00:00
Argyrios Kyrtzidis 0f3984809f Add TranslationUnit::getSelectorMap().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77542 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:41:08 +00:00
Argyrios Kyrtzidis 7f4656eb6b -Introduce the idx::Analyzer class used for getting indexing information, like finding
references of a declaration across translation units.

-Modify the index-test tool to use it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77536 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:40:14 +00:00
Argyrios Kyrtzidis 768a6c94a5 Add getDeclReferenceMap() to the abstract interface of TranslationUnit class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77530 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:39:18 +00:00
Argyrios Kyrtzidis 0594545b5b Remove the TranslationUnit usage from clang-wpa.cpp since it's not really
necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77529 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:39:09 +00:00
Argyrios Kyrtzidis 94431b5b4c Introduce a helper template for the Handler classes and use it instead
of the iterator of the Indexer class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77528 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:39:03 +00:00
Argyrios Kyrtzidis b17dc46c79 -Make IndexProvider an abstract interface for getting indexing information.
-Introduce Indexer as an IndexProvider implementation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 23:38:21 +00:00
Daniel Dunbar 70186ab134 Destroy the ASTConsumer prior to the Context, HTMLPrinter for example wants to
do a significant amount of work in its destructor, which may access the
context. (PR4642).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 02:40:09 +00:00
Zhongxing Xu 56a5d80877 Add two nodes to the call graph:
- Root is the main function or 0.
 - ExternalCallingNode has edges to all external functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76876 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 13:39:38 +00:00
Argyrios Kyrtzidis f7cf15ca3c Change the semantics for Entity.
Entity can now refer to declarations that are not visible outside the translation unit.
It is a wrapper of a pointer union, it's either a Decl* for declarations that don't
"cross" translation units, or an EntityImpl* which is associated with the specific "visible" Decl.

Included is a test case for handling fields across translation units.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76515 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 00:07:06 +00:00
Argyrios Kyrtzidis ec930d3d81 Add '\n' to the end of error message.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 00:05:10 +00:00
Argyrios Kyrtzidis dc50c64c13 Introduce ASTLocation::getReferencedDecl(), for getting the declaration that the ASTLocation references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18 21:17:58 +00:00
Argyrios Kyrtzidis 1e4bc09988 Introduce a redecl_iterator in Decl class, so that we can do a "iterate over all declarations of the same decl" without knowing the exact type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76298 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18 08:50:35 +00:00
Daniel Dunbar 237a31bf66 Fix indentation / trailing white space.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76200 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 18:10:27 +00:00
Daniel Dunbar e3d6023cbf [llvm up] Add support for '#' component of QA_OVERRIDE_GCC3_OPTIONS.
- This silences the output about how command line arguments are being changed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76107 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 21:32:51 +00:00
Ted Kremenek 0d9ff0bcba Add 'clang-wpa' to the CMake-based build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76091 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 18:10:20 +00:00
Daniel Dunbar 9797a8760b Unbreak build?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75887 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 02:02:48 +00:00
Zhongxing Xu c5965992f5 update makefile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75878 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 01:05:34 +00:00
Zhongxing Xu 22daf79314 add copyright comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 01:03:49 +00:00
Zhongxing Xu dc3240c5b7 Add a primitive clang whole primitive analyzer tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75874 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 01:00:25 +00:00
Owen Anderson d720046f18 Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 00:14:12 +00:00
Dan Gohman 92db284169 Update for raw_fd_ostream API changes. raw_fd_ostream now has a
Force flag to control whether the case of opening an existing
file is considered an error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75802 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 17:32:18 +00:00
Argyrios Kyrtzidis c7377632d0 Handle redeclarations properly at the index-test tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75605 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 03:20:31 +00:00
Argyrios Kyrtzidis be125444cf For index-test, if the ASTLocation points at a CallExpr, get a Decl out of it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75599 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 03:19:30 +00:00
Argyrios Kyrtzidis 12585542f5 Handle struct fields through the index-test tool.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 03:18:40 +00:00
Zhongxing Xu 96bac6b48e Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 07:14:55 +00:00
Douglas Gregor e650c8c3bc Introduce the notion of "Relocatable" precompiled headers, which are built
with a particular system root directory and can be used with a different
system root directory when the headers it depends on have been installed.
Relocatable precompiled headers rewrite the file names of the headers used
when generating the PCH file into the corresponding file names of the 
headers available when using the PCH file.

Addresses <rdar://problem/7001604>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 00:12:59 +00:00
Argyrios Kyrtzidis 44994051ca Use the "ASTLocation nomenclature" (instead of the ASTNode one) in index-test.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:35:26 +00:00
Argyrios Kyrtzidis 755c6b4215 Some changes to ASTLocation's methods
-Change hasStmt() to isStmt()
-Add isDecl()
-Add getSourceRange()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:35:20 +00:00
Argyrios Kyrtzidis 818e15b89f Move the 'ResolveLocationInAST' function from the Frontend library to the Index library.
Also, cut down its comments; more comments will be added to ASTLocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:35:02 +00:00
Argyrios Kyrtzidis ccbcb70ee9 Move ASTLocation and DeclReferenceMap from the AST library to the Index library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:34:47 +00:00
Argyrios Kyrtzidis 874012b1fb Rename 'ASTNode' -> 'ASTLocation'.
ASTLocation is a much better name for its intended purpose which to represent a "point" into the AST.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 21:34:20 +00:00
Argyrios Kyrtzidis 7b332d9ada 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
2009-07-05 22:22:35 +00:00
Argyrios Kyrtzidis 49dd5851c4 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
2009-07-05 22:21:40 +00:00
Douglas Gregor 2e22253e03 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
2009-07-02 17:08:52 +00:00
Owen Anderson 8f1ca78009 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
2009-07-01 23:14:14 +00:00
Owen Anderson c93f49832d 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
2009-07-01 21:23:16 +00:00
Daniel Dunbar c88a88f6f7 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
2009-07-01 20:03:04 +00:00
Owen Anderson 42253cc3bc Update for LLVMContext+Module change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74615 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 17:00:06 +00:00
Chris Lattner e4f2142d00 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
2009-06-30 01:26:17 +00:00
Argyrios Kyrtzidis 512230c49b Remove redundant leftover code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 17:38:09 +00:00
Bill Wendling 4ebe3e4c81 Make the StackProtector bitfield use enums instead of obscure numbers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-28 23:01:01 +00:00