summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Diagnostic.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-23 21:45:46 +0000
committerChris Lattner <sabre@nondot.org>2008-11-23 21:45:46 +0000
commite3d20d954503fef1256b50977f7e2c9507452c1e (patch)
tree8473d3824da844a9fcc3808aa798a1bdcf5b2b16 /clang/lib/Basic/Diagnostic.cpp
parentf7e69d5a77b21fd98e29df84411506527faa62b3 (diff)
downloadbcm5719-llvm-e3d20d954503fef1256b50977f7e2c9507452c1e.tar.gz
bcm5719-llvm-e3d20d954503fef1256b50977f7e2c9507452c1e.zip
Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
Diffstat (limited to 'clang/lib/Basic/Diagnostic.cpp')
-rw-r--r--clang/lib/Basic/Diagnostic.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index efdb3291716..8547ef49a05 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -482,6 +482,7 @@ FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const {
unsigned ArgNo = *DiagStr++ - '0';
switch (getArgKind(ArgNo)) {
+ // ---- STRINGS ----
case Diagnostic::ak_std_string: {
const std::string &S = getArgStdStr(ArgNo);
assert(ModifierLen == 0 && "No modifiers for strings yet");
@@ -494,12 +495,7 @@ FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const {
OutStr.append(S, S + strlen(S));
break;
}
- case Diagnostic::ak_identifierinfo: {
- const IdentifierInfo *II = getArgIdentifier(ArgNo);
- assert(ModifierLen == 0 && "No modifiers for strings yet");
- OutStr.append(II->getName(), II->getName() + II->getLength());
- break;
- }
+ // ---- INTEGERS ----
case Diagnostic::ak_sint: {
int Val = getArgSInt(ArgNo);
@@ -535,6 +531,15 @@ FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const {
}
break;
}
+ // ---- NAMES and TYPES ----
+ case Diagnostic::ak_identifierinfo: {
+ OutStr.push_back('\'');
+ const IdentifierInfo *II = getArgIdentifier(ArgNo);
+ assert(ModifierLen == 0 && "No modifiers for strings yet");
+ OutStr.append(II->getName(), II->getName() + II->getLength());
+ OutStr.push_back('\'');
+ break;
+ }
case Diagnostic::ak_qualtype:
case Diagnostic::ak_declarationname:
OutStr.push_back('\'');
OpenPOWER on IntegriCloud