[cfe-commits] r39225 - in /cfe/cfe/trunk: Parse/DeclSpec.cpp Parse/ParseDecl.cpp include/clang/Parse/DeclSpec.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:41:29 PDT 2007
Author: sabre
Date: Wed Jul 11 11:41:29 2007
New Revision: 39225
URL: http://llvm.org/viewvc/llvm-project?rev=39225&view=rev
Log:
add loc info for the inline specifier, fix some fixme's by using it.
Modified:
cfe/cfe/trunk/Parse/DeclSpec.cpp
cfe/cfe/trunk/Parse/ParseDecl.cpp
cfe/cfe/trunk/include/clang/Parse/DeclSpec.h
Modified: cfe/cfe/trunk/Parse/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/DeclSpec.cpp?rev=39225&r1=39224&r2=39225&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/DeclSpec.cpp (original)
+++ cfe/cfe/trunk/Parse/DeclSpec.cpp Wed Jul 11 11:41:29 2007
@@ -181,9 +181,10 @@
return false;
}
-bool DeclSpec::SetFunctionSpecInline(const char *&PrevSpec) {
+bool DeclSpec::SetFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec){
// 'inline inline' is ok.
FS_inline_specified = true;
+ FS_inlineLoc = Loc;
return false;
}
Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=39225&r1=39224&r2=39225&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:41:29 2007
@@ -185,15 +185,18 @@
if (Specs == DeclSpec::PQ_None)
Diag(Tok, diag::err_typename_requires_specqual);
+ // Issue diagnostic and remove storage class if present.
if (Specs & DeclSpec::PQ_StorageClassSpecifier) {
- Diag(Loc, diag::err_typename_invalid_storageclass);
- // FIXME: better loc info for this!
- // Remove storage class.
+ if (DS.getStorageClassSpecLoc().isValid())
+ Diag(DS.getStorageClassSpecLoc(),diag::err_typename_invalid_storageclass);
+ else
+ Diag(DS.getThreadSpecLoc(), diag::err_typename_invalid_storageclass);
DS.ClearStorageClassSpecs();
}
+
+ // Issue diagnostic and remove function specfier if present.
if (Specs & DeclSpec::PQ_FunctionSpecifier) {
- // FIXME: better loc info for this!
- Diag(Loc, diag::err_typename_invalid_functionspec);
+ Diag(DS.getInlineSpecLoc(), diag::err_typename_invalid_functionspec);
DS.ClearFunctionSpecs();
}
}
@@ -374,11 +377,12 @@
// function-specifier
case tok::kw_inline:
- isInvalid = DS.SetFunctionSpecInline(PrevSpec);
+ isInvalid = DS.SetFunctionSpecInline(Loc, PrevSpec);
break;
}
// If the specifier combination wasn't legal, issue a diagnostic.
if (isInvalid) {
+ // FIXME: emit a matching caret at the previous illegal spec combination.
assert(PrevSpec && "Method did not return previous specifier!");
if (isInvalid == 1) // Error.
Diag(Tok, diag::err_invalid_decl_spec_combination, PrevSpec);
Modified: cfe/cfe/trunk/include/clang/Parse/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/DeclSpec.h?rev=39225&r1=39224&r2=39225&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/DeclSpec.h Wed Jul 11 11:41:29 2007
@@ -121,7 +121,7 @@
// SourceLocation info. These are null if the item wasn't specified or if
// the setting was synthesized.
SourceLocation StorageClassSpecLoc, SCS_threadLoc;
-
+ SourceLocation FS_inlineLoc;
public:
DeclSpec()
@@ -165,8 +165,10 @@
// function-specifier
bool isInlineSpecified() const { return FS_inline_specified; }
+ SourceLocation getInlineSpecLoc() const { return FS_inlineLoc; }
void ClearFunctionSpecs() {
FS_inline_specified = false;
+ FS_inlineLoc = SourceLocation();
}
/// hasTypeSpecifier - Return true if any type-specifier has been found.
@@ -195,7 +197,7 @@
bool SetTypeQual(TQ T, const char *&PrevSpec, const LangOptions &Lang);
- bool SetFunctionSpecInline(const char *&PrevSpec);
+ bool SetFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec);
/// Finish - This does final analysis of the declspec, issuing diagnostics for
/// things like "_Imaginary" (lacking an FP type). After calling this method,
More information about the cfe-commits
mailing list