moves the check for the invalid construct to a point where it doesn't
affect other uses of isIntegerConstantExpr, and we can warn properly
when the extension is used. This makes it a bit more complicated, but
it's a lot cleaner.
Steve, please tell me if this check is sufficient to handle the
relevant system header. I know it's enough to handle the testcase, but
I don't know what exactly the original looks like.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51918 91177308-0d34-0410-b5e6-96231b3b80d8
required by the standard (the standard doesn't know anything about
implicit casts).
Disallow pointers cast to non-integral arithmetic types as constant
expressions. This was previously allowed by accident.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51779 91177308-0d34-0410-b5e6-96231b3b80d8
encountered. Mixing up the decls is unintuitive, and confuses the AST
destruction code. Fixes PR2360.
Note that there is a need to look up the characteristics and
declarations of a function associated with a particular name or decl,
but the original swapping code doesn't solve it properly.
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001644.html is one
suggestion for how to fix that.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51584 91177308-0d34-0410-b5e6-96231b3b80d8
it fixes PR2204. Not too much to say about the implementation; it works
in a similar way to the vector size attribute.
At some point, we need to modify the targets to provide information
about the appropriate types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51577 91177308-0d34-0410-b5e6-96231b3b80d8
Turns out that there are multiple places where a redefinition diagnostic can be emitted. A cleaner solution (without touching Sema) is to have
the Driver turn off these diagnostics. (will submit this patch soon)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51502 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGExpr.cpp and to change include/clang/AST/Attr.h to
use its own enum for visibility types instead of using
llvm::GlobalValue::VisibilityTypes. These changes eliminate
dependencies in the AST library on LLVM's VMCore library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51398 91177308-0d34-0410-b5e6-96231b3b80d8
in Sema, per discussion on mailing list. This doesn't cause any changes
in the test results. I'll probably add some more tests at some point,
but it's an open question what we need to accept to be compatible with
real code.
This doesn't touch the existing isConstantExpr method on Expr; that
should be addressed somehow eventually (either removed or refined to
whatever is appropriate).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51318 91177308-0d34-0410-b5e6-96231b3b80d8
-identifierResolver exposes an iterator interface to get all decls through the scope chain.
-The semantic staff (checking IdentifierNamespace and Doug's checking for shadowed tags were moved out of IdentifierResolver and back into Sema. IdentifierResolver just gives an iterator for all reachable decls of an identifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50923 91177308-0d34-0410-b5e6-96231b3b80d8
Still need to iron out some of the semantics (fixmes are present).
This addresses <rdar://problem/5916348>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50866 91177308-0d34-0410-b5e6-96231b3b80d8
NOTE: This work is incomplete and still fails many tests (as a result, it isn't enabled yet). Nevertheless, I wanted to check it in so I can work on it from home.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50544 91177308-0d34-0410-b5e6-96231b3b80d8
-NamespaceDecl for the AST
-Checks for name clashes between namespaces and tag/normal declarations.
This commit doesn't implement proper name lookup for namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50321 91177308-0d34-0410-b5e6-96231b3b80d8
DeclContext *CtxDecl -> DeclContext *DeclCtx
DeclContext *CD -> DeclContext *DC
It makes the code more consistent."
Patch by Zhongxing Xu!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50105 91177308-0d34-0410-b5e6-96231b3b80d8
-Added TranslationUnitDecl class to serve as top declaration context
-ASTContext gets a TUDecl member and a getTranslationUnitDecl() function
-All ScopedDecls get the TUDecl as DeclContext when declared at global scope
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49855 91177308-0d34-0410-b5e6-96231b3b80d8
This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49748 91177308-0d34-0410-b5e6-96231b3b80d8
allows the parsing of "class" in addition to "struct" and "union" to
declare a record. So this patch allows:
class C { };
class C c1;
But it does not contain the lookup bits, so this won't work yet:
C c2;
Patch by Doug Gregor!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49613 91177308-0d34-0410-b5e6-96231b3b80d8
1) objc ivar processing is split out of ActOnField into its own ActOnIvar method.
2) the new objc ivar action takes visibility info directly, eliminating
AllVisibilities in ParseObjCClassInstanceVariables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49506 91177308-0d34-0410-b5e6-96231b3b80d8
-Added ContextDecl (no TranslationUnitDecl)
-ScopedDecl class has a ContextDecl member
-FieldDecl class has a ContextDecl member, so that a Field or a ObjCIvar can be traced back to their RecordDecl/ObjCInterfaceDecl easily
-FunctionDecl, ObjCMethodDecl, TagDecl, ObjCInterfaceDecl inherit from ContextDecl. With TagDecl as ContextDecl, enum constants have a EnumDecl as their context.
-Moved Decl class to a "DeclBase.h" along with ContextDecl class
-CurContext is handled by Sema
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49208 91177308-0d34-0410-b5e6-96231b3b80d8
I also finished unifying access to scope decl change by converting Sema::getObjCInterfaceDecl() to use Sema::LookupDecl(). This is much cleaner now:-)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49107 91177308-0d34-0410-b5e6-96231b3b80d8
(1) Remove IdLoc (it's never used).
(2) Add a bool to enable/disable lazy builtin creaation (defaults to true).
This enables us to use LookupDecl() in Sema::isTypeName(), which is also part of this commit.
To make this work, I changed isTypeName() to be a non-const member function. I'm not happy with this, however I fiddled with making LookupDecl() and friends const and it got ugly pretty quickly. We can certainly add it back if/when someone has time to fiddle with it. For now, I thought this simplification was more important than retaining the const-ness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49087 91177308-0d34-0410-b5e6-96231b3b80d8
First, we got several CVR propagation cases wrong, which Eli pointed
out in PR2039.
Second, we didn't propagate address space qualifiers correctly, leading
to incorrect lowering of code in CodeGen/address-space.c.
Third, we didn't uniformly propagate the specifier in the array to the
pointer ("int[restrict 4]" -> "int *restrict").
This adds an ASTContext::getArrayDecayedType member that handles the
non-trivial logic for this seemingly simple operation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49078 91177308-0d34-0410-b5e6-96231b3b80d8
- Added a DenseMap to associate an IdentifierInfo with the ObjCCompatibleAliasDecl.
- Renamed LookupScopedDecl->LookupDecl and changed it's return type to Decl. Also added lookup for ObjCCompatibleAliasDecl's.
- Removed Sema::LookupInterfaceDecl(). Converted clients to used LookupDecl().
- Some minor indentation changes.
Will deal with ObjCInterfaceDecl and getObjCInterfaceDecl() in a separate commit...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49058 91177308-0d34-0410-b5e6-96231b3b80d8
lib dir and move all the libraries into it. This follows the main
llvm tree, and allows the libraries to be built in parallel. The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in. This speeds
up parallel builds, particularly incremental ones.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8