]> granicus.if.org Git - clang/commitdiff
Fix some handling of AST nodes with diagnostics.
authorRichard Trieu <rtrieu@google.com>
Wed, 28 Mar 2018 04:16:13 +0000 (04:16 +0000)
committerRichard Trieu <rtrieu@google.com>
Wed, 28 Mar 2018 04:16:13 +0000 (04:16 +0000)
The diagnostic system for Clang can already handle many AST nodes.  Instead
of converting them to strings first, just hand the AST node directly to
the diagnostic system and let it handle the output.  Minor changes in some
diagnostic output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328688 91177308-0d34-0410-b5e6-96231b3b80d8

21 files changed:
include/clang/Basic/DiagnosticParseKinds.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/Lex/PPMacroExpansion.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Sema/AnalysisBasedWarnings.cpp
lib/Sema/SemaCUDA.cpp
lib/Sema/SemaChecking.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/TreeTransform.h
test/Preprocessor/has_include.c
test/Sema/warn-duplicate-enum.c
test/SemaCUDA/function-overload.cu
test/SemaCUDA/kernel-call.cu
test/SemaCXX/ms-interface.cpp
test/SemaCXX/typo-correction.cpp
test/SemaCXX/warn-thread-safety-analysis.cpp
test/SemaObjC/comptypes-legal.m
test/SemaObjC/protocol-expr-neg-1.m
test/SemaTemplate/warn-thread-safety-analysis.cpp

index e91a7872061f3582794b3e7fe91ba2cfac0f59d6..cc4232fc4f18c97b597f0766ac68b70e1527143d 100644 (file)
@@ -575,7 +575,7 @@ def err_cxx11_attribute_forbids_arguments : Error<
 def err_attribute_requires_arguments : Error<
   "parentheses must be omitted if %0 attribute's argument list is empty">;
 def err_cxx11_attribute_forbids_ellipsis : Error<
-  "attribute '%0' cannot be used as an attribute pack">;
+  "attribute %0 cannot be used as an attribute pack">;
 def err_cxx11_attribute_repeated : Error<
   "attribute %0 cannot appear multiple times in an attribute specifier">;
 def warn_cxx14_compat_using_attribute_ns : Warning<
index a353928991eafb62dd8e3247ed1d189e3c97bd70..06ae1b7a2a9b81e3754b7d51c7e83e64d52c98fb 100644 (file)
@@ -1329,7 +1329,7 @@ def err_invalid_member_in_interface : Error<
           "nested class }0%1 is not permitted within an interface type">;
 def err_invalid_base_in_interface : Error<
   "interface type cannot inherit from "
-  "%select{'struct|non-public 'interface|'class}0 %1'">;
+  "%select{struct|non-public interface|class}0 %1">;
 
 def err_abstract_type_in_decl : Error<
   "%select{return|parameter|variable|field|instance variable|"
@@ -1629,7 +1629,7 @@ def err_missing_default_ctor : Error<
   "%select{base class|member}2 %3 %select{which|which|of %1}0 "
   "does not have a default constructor">;
 def note_due_to_dllexported_class : Note<
-  "due to '%0' being dllexported%select{|; try compiling in C++11 mode}1">;
+  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
 
 def err_illegal_union_or_anon_struct_member : Error<
   "%select{anonymous struct|union}0 member %1 has a non-trivial "
@@ -2986,11 +2986,11 @@ def warn_lock_exclusive_and_shared : Warning<
 def note_lock_exclusive_and_shared : Note<
   "the other acquisition of %0 '%1' is here">;
 def warn_variable_requires_any_lock : Warning<
-  "%select{reading|writing}1 variable '%0' requires holding "
+  "%select{reading|writing}1 variable %0 requires holding "
   "%select{any mutex|any mutex exclusively}1">,
   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
 def warn_var_deref_requires_any_lock : Warning<
-  "%select{reading|writing}1 the value pointed to by '%0' requires holding "
+  "%select{reading|writing}1 the value pointed to by %0 requires holding "
   "%select{any mutex|any mutex exclusively}1">,
   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
 def warn_fun_excludes_mutex : Warning<
@@ -3014,25 +3014,25 @@ def warn_acquire_requires_negative_cap : Warning<
 
 // Thread safety warnings on pass by reference
 def warn_guarded_pass_by_reference : Warning<
-  "passing variable '%1' by reference requires holding %0 "
+  "passing variable %1 by reference requires holding %0 "
   "%select{'%2'|'%2' exclusively}3">,
   InGroup<ThreadSafetyReference>, DefaultIgnore;
 def warn_pt_guarded_pass_by_reference : Warning<
-  "passing the value that '%1' points to by reference requires holding %0 "
+  "passing the value that %1 points to by reference requires holding %0 "
   "%select{'%2'|'%2' exclusively}3">,
   InGroup<ThreadSafetyReference>, DefaultIgnore;
 
 // Imprecise thread safety warnings
 def warn_variable_requires_lock : Warning<
-  "%select{reading|writing}3 variable '%1' requires holding %0 "
+  "%select{reading|writing}3 variable %1 requires holding %0 "
   "%select{'%2'|'%2' exclusively}3">,
   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
 def warn_var_deref_requires_lock : Warning<
-  "%select{reading|writing}3 the value pointed to by '%1' requires "
+  "%select{reading|writing}3 the value pointed to by %1 requires "
   "holding %0 %select{'%2'|'%2' exclusively}3">,
   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
 def warn_fun_requires_lock : Warning<
-  "calling function '%1' requires holding %0 %select{'%2'|'%2' exclusively}3">,
+  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
 
 // Precise thread safety warnings
@@ -3050,7 +3050,7 @@ def note_found_mutex_near_match : Note<"found near match '%0'">;
 // Verbose thread safety warnings
 def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">, 
   InGroup<ThreadSafetyVerbose>, DefaultIgnore;
-def note_thread_warning_in_fun : Note<"Thread warning in function '%0'">;
+def note_thread_warning_in_fun : Note<"Thread warning in function %0">;
 def note_guarded_by_declared_here : Note<"Guarded_by declared here.">;
 
 // Dummy warning that will trigger "beta" warnings from the analysis if enabled. 
@@ -6186,9 +6186,9 @@ def err_objc_object_catch : Error<
 def err_incomplete_type_objc_at_encode : Error<
   "'@encode' of incomplete type %0">;
 def warn_objc_circular_container : Warning<
-  "adding '%0' to '%1' might cause circular dependency in container">,
+  "adding %0 to %1 might cause circular dependency in container">,
   InGroup<DiagGroup<"objc-circular-container">>;
-def note_objc_circular_container_declared_here : Note<"'%0' declared here">;
+def note_objc_circular_container_declared_here : Note<"%0 declared here">;
 def warn_objc_unsafe_perform_selector : Warning<
   "%0 is incompatible with selectors that return a "
   "%select{struct|union|vector}1 type">,
@@ -7137,7 +7137,7 @@ def err_va_arg_in_device : Error<
   "CUDA device code does not support va_arg">;
 def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
 def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
-  "constexpr function '%0' without __host__ or __device__ attributes cannot "
+  "constexpr function %0 without __host__ or __device__ attributes cannot "
   "overload __device__ function with same signature.  Add a __host__ "
   "attribute, or build with -fno-cuda-host-device-constexpr.">;
 def note_cuda_conflicting_device_function_declared_here : Note<
@@ -9336,7 +9336,8 @@ def ext_warn_gnu_final : ExtWarn<
   InGroup<GccCompat>;
 
 def warn_shadow_field :
-  Warning<"non-static data member '%0' of '%1' shadows member inherited from type '%2'">,
+  Warning<"non-static data member %0 of %1 shadows member inherited from "
+  "type %2">,
   InGroup<ShadowField>, DefaultIgnore;
 def note_shadow_field : Note<"declared here">;
 
index 6ab737d15c8bba8b135c3e849ea7b4362e1f1209..8814b23d3f9c56b8dd09f50fe8c6e0f706216b39 100644 (file)
@@ -1344,7 +1344,7 @@ static bool EvaluateHasIncludeCommon(Token &Tok,
 
   // These expressions are only allowed within a preprocessor directive.
   if (!PP.isParsingIfOrElifDirective()) {
-    PP.Diag(LParenLoc, diag::err_pp_directive_required) << II->getName();
+    PP.Diag(LParenLoc, diag::err_pp_directive_required) << II;
     // Return a valid identifier token.
     assert(Tok.is(tok::identifier));
     Tok.setIdentifierInfo(II);
index 207047b03c8c87fdc615c7bf814ebad216f43062..0c789c9b1c4b99fdd7a8a3b2209ff075453ef8db 100644 (file)
@@ -4036,7 +4036,7 @@ void Parser::ParseCXX11AttributeSpecifier(ParsedAttributes &attrs,
 
     if (TryConsumeToken(tok::ellipsis))
       Diag(Tok, diag::err_cxx11_attribute_forbids_ellipsis)
-        << AttrName->getName();
+        << AttrName;
   }
 
   if (ExpectAndConsume(tok::r_square))
index 8397a1f936b89b6ba90b9055182a2d58ec21a45f..2903f5399a81337689e56cd2fca1ce04a4e009f7 100644 (file)
@@ -1601,7 +1601,7 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
     if (Verbose && CurrentFunction) {
       PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(),
                                 S.PDiag(diag::note_thread_warning_in_fun)
-                                    << CurrentFunction->getNameAsString());
+                                    << CurrentFunction);
       return OptionalNotes(1, FNote);
     }
     return OptionalNotes();
@@ -1612,7 +1612,7 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
     if (Verbose && CurrentFunction) {
       PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(),
                                 S.PDiag(diag::note_thread_warning_in_fun)
-                                    << CurrentFunction->getNameAsString());
+                                    << CurrentFunction);
       ONS.push_back(std::move(FNote));
     }
     return ONS;
@@ -1626,7 +1626,7 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
     if (Verbose && CurrentFunction) {
       PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(),
                                 S.PDiag(diag::note_thread_warning_in_fun)
-                                    << CurrentFunction->getNameAsString());
+                                    << CurrentFunction);
       ONS.push_back(std::move(FNote));
     }
     return ONS;
@@ -1742,7 +1742,7 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
                         diag::warn_variable_requires_any_lock:
                         diag::warn_var_deref_requires_any_lock;
     PartialDiagnosticAt Warning(Loc, S.PDiag(DiagID)
-      << D->getNameAsString() << getLockKindFromAccessKind(AK));
+      << D << getLockKindFromAccessKind(AK));
     Warnings.emplace_back(std::move(Warning), getNotes());
   }
 
@@ -1770,7 +1770,7 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
           break;
       }
       PartialDiagnosticAt Warning(Loc, S.PDiag(DiagID) << Kind
-                                                       << D->getNameAsString()
+                                                       << D
                                                        << LockName << LK);
       PartialDiagnosticAt Note(Loc, S.PDiag(diag::note_found_mutex_near_match)
                                         << *PossibleMatch);
@@ -1800,12 +1800,11 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
           break;
       }
       PartialDiagnosticAt Warning(Loc, S.PDiag(DiagID) << Kind
-                                                       << D->getNameAsString()
+                                                       << D
                                                        << LockName << LK);
       if (Verbose && POK == POK_VarAccess) {
         PartialDiagnosticAt Note(D->getLocation(),
-                                 S.PDiag(diag::note_guarded_by_declared_here)
-                                     << D->getNameAsString());
+                                 S.PDiag(diag::note_guarded_by_declared_here));
         Warnings.emplace_back(std::move(Warning), getNotes(Note));
       } else
         Warnings.emplace_back(std::move(Warning), getNotes());
index ccd93fa48b81094d79a53640d9445c671b71e8fd..8224bd85f1871a06384ea3712d3242b9db7d7995 100644 (file)
@@ -521,7 +521,7 @@ void Sema::maybeAddCUDAHostDeviceAttrs(FunctionDecl *NewD,
     if (!getSourceManager().isInSystemHeader(Match->getLocation())) {
       Diag(NewD->getLocation(),
            diag::err_cuda_unattributed_constexpr_cannot_overload_device)
-          << NewD->getName();
+          << NewD;
       Diag(Match->getLocation(),
            diag::note_cuda_conflicting_device_function_declared_here);
     }
index 80ea1379d4d19cf925a43d6672209c566023848e..2efdcd36a69e62a12ff3ab6840acde43947d14da 100644 (file)
@@ -11521,7 +11521,7 @@ void Sema::CheckObjCCircularContainer(ObjCMessageExpr *Message) {
       if (ArgRE->isObjCSelfExpr()) {
         Diag(Message->getSourceRange().getBegin(),
              diag::warn_objc_circular_container)
-          << ArgRE->getDecl()->getName() << StringRef("super");
+          << ArgRE->getDecl() << StringRef("'super'");
       }
     }
   } else {
@@ -11537,11 +11537,11 @@ void Sema::CheckObjCCircularContainer(ObjCMessageExpr *Message) {
           ValueDecl *Decl = ReceiverRE->getDecl();
           Diag(Message->getSourceRange().getBegin(),
                diag::warn_objc_circular_container)
-            << Decl->getName() << Decl->getName();
+            << Decl << Decl;
           if (!ArgRE->isObjCSelfExpr()) {
             Diag(Decl->getLocation(),
                  diag::note_objc_circular_container_declared_here)
-              << Decl->getName();
+              << Decl;
           }
         }
       }
@@ -11551,10 +11551,10 @@ void Sema::CheckObjCCircularContainer(ObjCMessageExpr *Message) {
           ObjCIvarDecl *Decl = IvarRE->getDecl();
           Diag(Message->getSourceRange().getBegin(),
                diag::warn_objc_circular_container)
-            << Decl->getName() << Decl->getName();
+            << Decl << Decl;
           Diag(Decl->getLocation(),
                diag::note_objc_circular_container_declared_here)
-            << Decl->getName();
+            << Decl;
         }
       }
     }
index 68ad1cd78f5aeae3c474912e292fdf56070cd8c0..bc3e42739d33e6340e2b54a9e2d631fb75d61d54 100644 (file)
@@ -10336,7 +10336,7 @@ namespace {
 
       S.DiagRuntimeBehavior(DRE->getLocStart(), DRE,
                             S.PDiag(diag)
-                              << DRE->getNameInfo().getName()
+                              << DRE->getDecl()
                               << OrigDecl->getLocation()
                               << DRE->getSourceRange());
     }
@@ -16147,7 +16147,7 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef<Decl *> Elements,
     // Emit warning for one enum constant.
     ECDVector::iterator I = Vec->begin();
     S.Diag((*I)->getLocation(), diag::warn_duplicate_enum_values)
-      << (*I)->getName() << (*I)->getInitVal().toString(10)
+      << (*I) << (*I)->getInitVal().toString(10)
       << (*I)->getSourceRange();
     ++I;
 
@@ -16155,7 +16155,7 @@ static void CheckForDuplicateEnumValues(Sema &S, ArrayRef<Decl *> Elements,
     // the same value.
     for (ECDVector::iterator E = Vec->end(); I != E; ++I)
       S.Diag((*I)->getLocation(), diag::note_duplicate_element)
-        << (*I)->getName() << (*I)->getInitVal().toString(10)
+        << (*I) << (*I)->getInitVal().toString(10)
         << (*I)->getSourceRange();
     delete Vec;
   }
index 6160eccabe8efa097cd62face84925864fa10c5d..a56869f623446d77c8f0a7e3e19105080ac8aca3 100644 (file)
@@ -2404,7 +2404,7 @@ bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class,
           // The Microsoft extension __interface does not permit bases that
           // are not themselves public interfaces.
           Diag(KnownBase->getLocStart(), diag::err_invalid_base_in_interface)
-            << getRecordDiagFromTagKind(RD->getTagKind()) << RD->getName()
+            << getRecordDiagFromTagKind(RD->getTagKind()) << RD
             << RD->getSourceRange();
           Invalid = true;
         }
@@ -2862,7 +2862,7 @@ void Sema::CheckShadowInheritedFields(const SourceLocation &Loc,
     if (AS_none !=
         CXXRecordDecl::MergeAccess(P.Access, BaseField->getAccess())) {
       Diag(Loc, diag::warn_shadow_field)
-        << FieldName.getAsString() << RD->getName() << Base->getName();
+        << FieldName << RD << Base;
       Diag(BaseField->getLocation(), diag::note_shadow_field);
       Bases.erase(It);
     }
@@ -5528,7 +5528,7 @@ static void ReferenceDllExportedMembers(Sema &S, CXXRecordDecl *Class) {
         S.MarkFunctionReferenced(Class->getLocation(), MD);
         if (Trap.hasErrorOccurred()) {
           S.Diag(ClassAttr->getLocation(), diag::note_due_to_dllexported_class)
-              << Class->getName() << !S.getLangOpts().CPlusPlus11;
+              << Class << !S.getLangOpts().CPlusPlus11;
           break;
         }
 
index 07eb02bec06cf23b38f1f5e3156157a172a2ce96..c0533f7cc7dbb58cf1901b42ca489288d36a191d 100644 (file)
@@ -5511,7 +5511,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
       // CUDA: Kernel calls must be to global functions
       if (FDecl && !FDecl->hasAttr<CUDAGlobalAttr>())
         return ExprError(Diag(LParenLoc,diag::err_kern_call_not_global_function)
-            << FDecl->getName() << Fn->getSourceRange());
+            << FDecl << Fn->getSourceRange());
 
       // CUDA: Kernel function must have 'void' return type
       if (!FuncT->getReturnType()->isVoidType())
@@ -5521,7 +5521,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
       // CUDA: Calls to global functions must be configured
       if (FDecl && FDecl->hasAttr<CUDAGlobalAttr>())
         return ExprError(Diag(LParenLoc, diag::err_global_call_not_config)
-            << FDecl->getName() << Fn->getSourceRange());
+            << FDecl << Fn->getSourceRange());
     }
   }
 
@@ -8030,7 +8030,7 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &CallerRHS,
   if (Diagnose && isa<ObjCProtocolExpr>(PRE)) {
     ObjCProtocolDecl *PDecl = cast<ObjCProtocolExpr>(PRE)->getProtocol();
     if (PDecl && !PDecl->hasDefinition()) {
-      Diag(PRE->getExprLoc(), diag::warn_atprotocol_protocol) << PDecl->getName();
+      Diag(PRE->getExprLoc(), diag::warn_atprotocol_protocol) << PDecl;
       Diag(PDecl->getLocation(), diag::note_entity_declared_at) << PDecl;
     }
   }
@@ -13516,7 +13516,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
   if (DiagKind == diag::warn_incompatible_qualified_id &&
       PDecl && IFace && !IFace->hasDefinition())
       Diag(IFace->getLocation(), diag::note_incomplete_class_and_qualified_id)
-        << IFace->getName() << PDecl->getName();
+        << IFace << PDecl;
     
   if (SecondType == Context.OverloadTy)
     NoteAllOverloadCandidates(OverloadExpr::find(SrcExpr).Expression,
index 7d52394bd7ab4de0be729f83ff2a0664e195a059..4119e7a4ab857fe7c9be7f97525314658300a2cb 100644 (file)
@@ -10388,7 +10388,7 @@ bool TreeTransform<Derived>::TransformOverloadExprDecls(OverloadExpr *Old,
   //   the corresponding pack is empty
   if (AllEmptyPacks && !RequiresADL) {
     getSema().Diag(Old->getNameLoc(), diag::err_using_pack_expansion_empty)
-        << isa<UnresolvedMemberExpr>(Old) << Old->getNameInfo().getName();
+        << isa<UnresolvedMemberExpr>(Old) << Old->getName();
     return true;
   }
 
index ad7329390ef67b293c4129c9b1253a8ba3ea0b28..af1f6b8414e15cae12d809a13998a9b206435305 100644 (file)
 
 // Try as non-preprocessor directives
 void foo( void ) {
-  __has_include_next("stdint.h")  // expected-warning {{#include_next in primary source file}} expected-error {{__has_include_next must be used within a preprocessing directive}}
-  __has_include("stdint.h")  // expected-error {{__has_include must be used within a preprocessing directive}}
+  __has_include_next("stdint.h")  // expected-warning {{#include_next in primary source file}} expected-error {{'__has_include_next' must be used within a preprocessing directive}}
+  __has_include("stdint.h")  // expected-error {{'__has_include' must be used within a preprocessing directive}}
 }
 
-MACRO1  // expected-error {{__has_include must be used within a preprocessing directive}}
+MACRO1  // expected-error {{'__has_include' must be used within a preprocessing directive}}
 
 #if 1
-MACRO1  // expected-error {{__has_include must be used within a preprocessing directive}}
+MACRO1  // expected-error {{'__has_include' must be used within a preprocessing directive}}
 #endif
 
 #if 0
 #elif 1
-MACRO1  // expected-error {{__has_include must be used within a preprocessing directive}}
+MACRO1  // expected-error {{'__has_include' must be used within a preprocessing directive}}
 #endif
 
 #if 0
@@ -148,7 +148,7 @@ MACRO1  // This should be fine because it is never actually reached
 #if __has_include(stdint.h>)
 #endif
 
-// expected-error@+1 {{__has_include must be used within a preprocessing directive}}
+// expected-error@+1 {{'__has_include' must be used within a preprocessing directive}}
 __has_include
 
 // expected-error@+1 {{missing ')' after '__has_include'}} // expected-error@+1 {{expected value in expression}}  // expected-note@+1 {{to match this '('}}
index f108b3aa6c328da3c463c93d52aa59d76bc60815..84fdeb4f8fd4d6bb94b9e5806367be5d98076331 100644 (file)
@@ -1,29 +1,29 @@
 // RUN: %clang_cc1 %s -fsyntax-only -verify -Wduplicate-enum
 // RUN: %clang_cc1 %s -x c++ -fsyntax-only -verify -Wduplicate-enum
 enum A {
-  A1 = 0,  // expected-note {{element A1 also has value 0}}
+  A1 = 0,  // expected-note {{element 'A1' also has value 0}}
   A2 = -1,
-  A3,  // expected-warning {{element A3 has been implicitly assigned 0 which another element has been assigned}}
+  A3,  // expected-warning {{element 'A3' has been implicitly assigned 0 which another element has been assigned}}
   A4};
 
 enum B {
-  B1 = -1,  // expected-note {{element B1 also has value -1}}
-  B2,       // expected-warning {{element B2 has been implicitly assigned 0 which another element has been assigned}}
+  B1 = -1,  // expected-note {{element 'B1' also has value -1}}
+  B2,       // expected-warning {{element 'B2' has been implicitly assigned 0 which another element has been assigned}}
   B3,
   B4 = -2,
-  B5,  // expected-warning {{element B5 has been implicitly assigned -1 which another element has been assigned}}
-  B6   // expected-note {{element B6 also has value 0}}
+  B5,  // expected-warning {{element 'B5' has been implicitly assigned -1 which another element has been assigned}}
+  B6   // expected-note {{element 'B6' also has value 0}}
 };
 
-enum C { C1, C2 = -1, C3 }; // expected-warning{{element C1 has been implicitly assigned 0 which another element has been assigned}} \
-  // expected-note {{element C3 also has value 0}}
+enum C { C1, C2 = -1, C3 }; // expected-warning{{element 'C1' has been implicitly assigned 0 which another element has been assigned}} \
+  // expected-note {{element 'C3' also has value 0}}
 
 enum D {
   D1,
   D2,
-  D3,  // expected-warning{{element D3 has been implicitly assigned 2 which another element has been assigned}}
+  D3,  // expected-warning{{element 'D3' has been implicitly assigned 2 which another element has been assigned}}
   D4 = D2,  // no warning
-  D5 = 2  // expected-note {{element D5 also has value 2}}
+  D5 = 2  // expected-note {{element 'D5' also has value 2}}
 };
 
 enum E {
index adf488b5eea3736e6c0c151fb4a93d88b7a3bd18..1d78636a7089b6fa3b51d1027fd2d2c751f57791 100644 (file)
@@ -119,7 +119,7 @@ __host__ void hostf() {
   HostReturnTy ret_cdh = cdh();
 
   GlobalFnPtr fp_g = g;
-  g(); // expected-error {{call to global function g not configured}}
+  g(); // expected-error {{call to global function 'g' not configured}}
   g<<<0, 0>>>();
 }
 
@@ -202,7 +202,7 @@ __host__ __device__ void hostdevicef() {
 #if defined (__CUDA_ARCH__)
   // expected-error@-2 {{reference to __global__ function 'g' in __host__ __device__ function}}
 #else
-  // expected-error@-4 {{call to global function g not configured}}
+  // expected-error@-4 {{call to global function 'g' not configured}}
 #endif
 
   g<<<0,0>>>();
index 47d7762f59ea1f33621cf5e2325775b136fc4102..b2433c956e25130f64c792d61753ed798ad7ec58 100644 (file)
@@ -13,13 +13,13 @@ int h2(int x) { return 1; }
 
 int main(void) {
   g1<<<1, 1>>>(42);
-  g1(42); // expected-error {{call to global function g1 not configured}}
+  g1(42); // expected-error {{call to global function 'g1' not configured}}
   g1<<<1>>>(42); // expected-error {{too few execution configuration arguments to kernel function call}}
   g1<<<1, 1, 0, 0, 0>>>(42); // expected-error {{too many execution configuration arguments to kernel function call}}
 
   t1(1);
 
-  h1<<<1, 1>>>(42); // expected-error {{kernel call to non-global function h1}}
+  h1<<<1, 1>>>(42); // expected-error {{kernel call to non-global function 'h1'}}
 
   int (*fp)(int) = h2;
   fp<<<1, 1>>>(42); // expected-error {{must have void return type}}
index 66ce376e2a9494b0d196ca8fa325b5075385538c..c827f4c5703c4e6fd9a281e8980808387b02fe50 100644 (file)
@@ -47,7 +47,7 @@ __interface I4 : I1, I2 {
   void fn2() final;
 };
 
-// expected-error@+1 {{interface type cannot inherit from non-public 'interface I1'}}
+// expected-error@+1 {{interface type cannot inherit from non-public interface 'I1'}}
 __interface I5 : private I1 {
 };
 
@@ -65,12 +65,12 @@ static_assert(!__is_interface_class(C), "oops");
 static_assert(!__is_interface_class(I), "oops");
 static_assert(!__is_interface_class(U), "oops");
 
-// expected-error@55 {{interface type cannot inherit from 'struct S'}}
+// expected-error@55 {{interface type cannot inherit from struct 'S'}}
 // expected-note@+1 {{in instantiation of template class 'I6<S>' requested here}}
 struct S1 : I6<S> {
 };
 
-// expected-error@55 {{interface type cannot inherit from 'class C'}}
+// expected-error@55 {{interface type cannot inherit from class 'C'}}
 // expected-note@+1 {{in instantiation of template class 'I6<C>' requested here}}
 class C1 : I6<C> {
 };
index 2d78f06c5d331f1cad70ab1b4821a757f5ea33b1..ed845c3e833bb31d96dbff0b938cfb8353274825 100644 (file)
@@ -647,7 +647,7 @@ namespace testArraySubscriptIndex {
 
 namespace crash_has_include {
 int has_include(int); // expected-note {{'has_include' declared here}}
-// expected-error@+1 {{__has_include must be used within a preprocessing directive}}
+// expected-error@+1 {{'__has_include' must be used within a preprocessing directive}}
 int foo = __has_include(42); // expected-error {{use of undeclared identifier '__has_include'; did you mean 'has_include'?}}
 }
 
index 829e2e4916272a16df104ead181d1fd4f324e002..db1373d5a1e676070e72d29e0bfd5e9507787dad 100644 (file)
@@ -1933,7 +1933,7 @@ void test() {
 
   f1.mu_.Unlock();
   bt.barTD(&f1);  // \
-    // expected-warning {{calling function 'barTD' requires holding mutex 'f1.mu_' exclusively}} \
+    // expected-warning {{calling function 'barTD<TestTemplateAttributeInstantiation::Foo1>' requires holding mutex 'f1.mu_' exclusively}} \
     // expected-note {{found near match 'bt.fooBase.mu_'}}
 
   bt.fooBase.mu_.Unlock();
@@ -2130,10 +2130,10 @@ void test() {
   myFoo.foo3(&myFoo);  // \
     // expected-warning {{calling function 'foo3' requires holding mutex 'myFoo.mu_' exclusively}}
   myFoo.fooT1(dummy);  // \
-    // expected-warning {{calling function 'fooT1' requires holding mutex 'myFoo.mu_' exclusively}}
+    // expected-warning {{calling function 'fooT1<int>' requires holding mutex 'myFoo.mu_' exclusively}}
 
   myFoo.fooT2(dummy);  // \
-    // expected-warning {{calling function 'fooT2' requires holding mutex 'myFoo.mu_' exclusively}}
+    // expected-warning {{calling function 'fooT2<int>' requires holding mutex 'myFoo.mu_' exclusively}}
 
   fooF1(&myFoo);  // \
     // expected-warning {{calling function 'fooF1' requires holding mutex 'myFoo.mu_' exclusively}}
@@ -3565,7 +3565,7 @@ void Foo::elr(Cell<T>* c1) { }
 void Foo::test() {
   Cell<int> cell;
   elr(&cell); // \
-    // expected-warning {{calling function 'elr' requires holding mutex 'cell.mu_' exclusively}}
+    // expected-warning {{calling function 'elr<int>' requires holding mutex 'cell.mu_' exclusively}}
 }
 
 
@@ -3578,7 +3578,7 @@ void globalELR(Cell<T>* c1) { }
 void globalTest() {
   Cell<int> cell;
   globalELR(&cell); // \
-    // expected-warning {{calling function 'globalELR' requires holding mutex 'cell.mu_' exclusively}}
+    // expected-warning {{calling function 'globalELR<int>' requires holding mutex 'cell.mu_' exclusively}}
 }
 
 
@@ -3599,7 +3599,7 @@ void globalELR2(Cell<T>* c4);
 void globalTest2() {
   Cell<int> cell;
   globalELR2(&cell); // \
-    // expected-warning {{calling function 'globalELR2' requires holding mutex 'cell.mu_' exclusively}}
+    // expected-warning {{calling function 'globalELR2<int>' requires holding mutex 'cell.mu_' exclusively}}
 }
 
 
index 05f18977cc4e96d489d386acb6c0236ca2a322dd..7ac4e143338a385ff6649fbdecfbc31666f170af 100644 (file)
@@ -42,7 +42,7 @@ void foo(void)
 - (void) Meth : (id <NSCopying>)aKey; // expected-note {{passing argument to parameter 'aKey' here}}
 @end
 
-@class ForwarClass; // expected-note 3 {{conformance of forward class ForwarClass to protocol NSCopying can not be confirmed}}
+@class ForwarClass; // expected-note 3 {{conformance of forward class 'ForwarClass' to protocol 'NSCopying' can not be confirmed}}
 
 ForwarClass *Test10751015 (I* pi, ForwarClass *ns_forward) {
 
index aed56c016b08c7e5e657ce9561794a02a7cf3008..26cdac70ae8db8f796e33638ebaa5db7985ad843 100644 (file)
@@ -12,7 +12,7 @@
 int main()
 {
        Protocol *proto = @protocol(p1);
-        Protocol *fproto = @protocol(fproto); // expected-warning {{@protocol is using a forward protocol declaration of fproto}}
+        Protocol *fproto = @protocol(fproto); // expected-warning {{@protocol is using a forward protocol declaration of 'fproto'}}
        Protocol *pp = @protocol(i); // expected-error {{cannot find protocol declaration for 'i'}}
        Protocol *p1p = @protocol(cl); // expected-error {{cannot find protocol declaration for 'cl'}}
 }
@@ -26,9 +26,9 @@ int main()
 @end
 
 int doesConform(id foo) {
-  return [foo conformsToProtocol:@protocol(TestProtocol)]; // expected-warning {{@protocol is using a forward protocol declaration of TestProtocol}}
+  return [foo conformsToProtocol:@protocol(TestProtocol)]; // expected-warning {{@protocol is using a forward protocol declaration of 'TestProtocol'}}
 }
 
 int doesConformSuper(id foo) {
-  return [foo conformsToProtocol:@protocol(SuperProtocol)]; // expected-warning {{@protocol is using a forward protocol declaration of SuperProtocol}}
+  return [foo conformsToProtocol:@protocol(SuperProtocol)]; // expected-warning {{@protocol is using a forward protocol declaration of 'SuperProtocol'}}
 }
index 03bae7a292580c92fe80e801f2f6a360e39f5788..710f424c17dc71b5b1c5734989513216aa8b9567 100644 (file)
@@ -23,8 +23,8 @@ void f() {
   a.mu2.Lock();
   a.bar<int>();
   a.mu2.Unlock();
-  a.bar<int>(); // expected-warning {{calling function 'bar' requires holding mutex 'a.mu2' exclusively}}
+  a.bar<int>(); // expected-warning {{calling function 'bar<int>' requires holding mutex 'a.mu2' exclusively}}
   a.mu1.Unlock();
-  a.bar<int>(); // expected-warning {{calling function 'bar' requires holding mutex 'a.mu1' exclusively}} \
-                   expected-warning {{calling function 'bar' requires holding mutex 'a.mu2' exclusively}}
+  a.bar<int>(); // expected-warning {{calling function 'bar<int>' requires holding mutex 'a.mu1' exclusively}} \
+                   expected-warning {{calling function 'bar<int>' requires holding mutex 'a.mu2' exclusively}}
 }