diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-11-20 04:58:19 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-11-20 04:58:19 +0000 |
| commit | 17ed48794794373c00b42c499fa6b74f614819e0 (patch) | |
| tree | 133e445f46dc0a6fc06cbd6de896c929692f6e1d /clang/AST/Decl.cpp | |
| parent | 0d8b1a1efff2ca809cff4942cf0da4101eb75205 (diff) | |
| download | bcm5719-llvm-17ed48794794373c00b42c499fa6b74f614819e0.tar.gz bcm5719-llvm-17ed48794794373c00b42c499fa6b74f614819e0.zip | |
parse identifier expressions properly. This allows us diagnose this:
typedef int X;
int A() {
return X;
}
int B() {
return Y;
}
as:
/Users/sabre/test.c:5:10: error: unexpected type name 'X': expected expression
return X;
^
/Users/sabre/test.c:9:10: error: use of undeclared 'Y' value
return Y;
^
llvm-svn: 39192
Diffstat (limited to 'clang/AST/Decl.cpp')
| -rw-r--r-- | clang/AST/Decl.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/AST/Decl.cpp b/clang/AST/Decl.cpp index db3d632bdeb..73ee105271d 100644 --- a/clang/AST/Decl.cpp +++ b/clang/AST/Decl.cpp @@ -12,9 +12,14 @@ //===----------------------------------------------------------------------===// #include "clang/AST/Decl.h" +#include "clang/Lex/IdentifierTable.h" using namespace llvm; using namespace clang; // Out-of-line virtual method providing a home for Decl. Decl::~Decl() { } + +const char *Decl::getName() const { + return getIdentifier()->getName(); +} |

