diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-19 23:45:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-19 23:45:49 +0000 |
commit | 810d330cd3d33eb9867cb813326b8bdd7b7fcb19 (patch) | |
tree | dafa9d01d29c0c1c538770383d9f23af883ac874 /clang/lib/Basic/Diagnostic.cpp | |
parent | 513f0b147e1ac64064a04992aa287e68d8c24efc (diff) | |
download | bcm5719-llvm-810d330cd3d33eb9867cb813326b8bdd7b7fcb19.tar.gz bcm5719-llvm-810d330cd3d33eb9867cb813326b8bdd7b7fcb19.zip |
Fix a long standard problem with clang retaining "too much" sugar
information about types. We often print diagnostics where we say
"foo_t" is bad, but the user doesn't know how foo_t is declared
(because it is a typedef). Fix this by expanding sugar when present
in a diagnostic (and not one of a few special cases, like vectors).
Before:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' and 'typeof(F)')
MAX(P, F);
^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
^
After:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
MAX(P, F);
^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
^
llvm-svn: 65081
Diffstat (limited to 'clang/lib/Basic/Diagnostic.cpp')
-rw-r--r-- | clang/lib/Basic/Diagnostic.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index 3f94a033475..83ccd22e284 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/lib/Basic/Diagnostic.cpp @@ -648,9 +648,9 @@ FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const { } // ---- NAMES and TYPES ---- case Diagnostic::ak_identifierinfo: { - OutStr.push_back('\''); const IdentifierInfo *II = getArgIdentifier(ArgNo); assert(ModifierLen == 0 && "No modifiers for strings yet"); + OutStr.push_back('\''); OutStr.append(II->getName(), II->getName() + II->getLength()); OutStr.push_back('\''); break; @@ -658,11 +658,9 @@ FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const { case Diagnostic::ak_qualtype: case Diagnostic::ak_declarationname: case Diagnostic::ak_nameddecl: - OutStr.push_back('\''); getDiags()->ConvertArgToString(getArgKind(ArgNo), getRawArg(ArgNo), Modifier, ModifierLen, Argument, ArgumentLen, OutStr); - OutStr.push_back('\''); break; } } |