[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2019-01-22 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping. It would indeed be very helpful to have information about the kind of an 
operator :-)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-12-07 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-11-23 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-10-31 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-10-09 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Any feedback is appreciated!


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-09-27 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping :)


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-09-07 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Hello Richard, what do you think about the printing context changes? Are they 
what you expected?


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-08-28 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping :)


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-08-21 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping :)


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-07-18 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping :)


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-07-09 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping :)


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-06-29 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi updated this revision to Diff 104655.
schroedersi added a comment.

I forgot to add the previous changes in Diff 104649 
 (it only contains the 
incremental diff of the printing context changes). This diff contains all 
changes between trunk and the current patch state. I apologize!


https://reviews.llvm.org/D30946

Files:
  include/clang/AST/Decl.h
  include/clang/AST/DeclBase.h
  include/clang/AST/NestedNameSpecifier.h
  include/clang/AST/PrettyPrinter.h
  include/clang/AST/TemplateBase.h
  include/clang/AST/TemplateName.h
  include/clang/AST/Type.h
  lib/AST/Decl.cpp
  lib/AST/DeclPrinter.cpp
  lib/AST/DeclarationName.cpp
  lib/AST/NestedNameSpecifier.cpp
  lib/AST/TemplateBase.cpp
  lib/AST/TemplateName.cpp
  lib/AST/TypePrinter.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/Tooling/Core/QualTypeNames.cpp
  test/CXX/class.access/p6.cpp
  test/Index/comment-cplus-decls.cpp
  unittests/AST/AbsoluteScopeTest.cpp
  unittests/AST/CMakeLists.txt
  unittests/AST/NamedDeclPrinterTest.cpp
  unittests/AST/TypePrinterTest.cpp

Index: unittests/AST/TypePrinterTest.cpp
===
--- /dev/null
+++ unittests/AST/TypePrinterTest.cpp
@@ -0,0 +1,464 @@
+//===- unittests/AST/TypePrinterTest.cpp -- TypePrinter printer tests -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file contains tests for TypePrinter::print(...).
+//
+// These tests have a coding convention:
+// * variable whose type to be printed is named 'A' unless it should have some
+// special name
+// * additional helper classes/namespaces/... are 'Z', 'Y', 'X' and so on.
+//
+//===--===//
+
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/SmallString.h"
+#include "gtest/gtest.h"
+
+using namespace clang;
+using namespace ast_matchers;
+using namespace tooling;
+namespace {
+
+class PrintMatch : public MatchFinder::MatchCallback {
+  SmallString<1024> Printed;
+  unsigned NumFoundDecls;
+  bool SuppressUnwrittenScope;
+  ScopePrintingKind::ScopePrintingKind Scope;
+
+public:
+  explicit PrintMatch(bool suppressUnwrittenScope,
+  ScopePrintingKind::ScopePrintingKind scope)
+  : NumFoundDecls(0), SuppressUnwrittenScope(suppressUnwrittenScope),
+Scope(scope) {}
+
+  void run(const MatchFinder::MatchResult ) override {
+const ValueDecl *VD = Result.Nodes.getNodeAs("id");
+if (!VD)
+  return;
+NumFoundDecls++;
+if (NumFoundDecls > 1)
+  return;
+
+llvm::raw_svector_ostream Out(Printed);
+PrintingPolicy Policy = Result.Context->getPrintingPolicy();
+Policy.SuppressUnwrittenScope = SuppressUnwrittenScope;
+Policy.Scope = Scope;
+QualType Type = VD->getType();
+Type.print(Out, Policy);
+  }
+
+  StringRef getPrinted() const { return Printed; }
+
+  unsigned getNumFoundDecls() const { return NumFoundDecls; }
+};
+
+::testing::AssertionResult
+PrintedTypeMatches(StringRef Code, const std::vector ,
+   bool SuppressUnwrittenScope,
+   const DeclarationMatcher ,
+   StringRef ExpectedPrinted, StringRef FileName,
+   ScopePrintingKind::ScopePrintingKind Scope) {
+  PrintMatch Printer(SuppressUnwrittenScope, Scope);
+  MatchFinder Finder;
+  Finder.addMatcher(NodeMatch, );
+  std::unique_ptr Factory =
+  newFrontendActionFactory();
+
+  if (!runToolOnCodeWithArgs(Factory->create(), Code, Args, FileName))
+return testing::AssertionFailure()
+   << "Parsing error in \"" << Code.str() << "\"";
+
+  if (Printer.getNumFoundDecls() == 0)
+return testing::AssertionFailure()
+   << "Matcher didn't find any value declarations";
+
+  if (Printer.getNumFoundDecls() > 1)
+return testing::AssertionFailure()
+   << "Matcher should match only one value declaration "
+  "(found "
+   << Printer.getNumFoundDecls() << ")";
+
+  if (Printer.getPrinted() != ExpectedPrinted)
+return ::testing::AssertionFailure()
+   << "Expected \"" << ExpectedPrinted.str()
+   << "\", "
+  "got \""
+   << Printer.getPrinted().str() << "\"";
+
+  return ::testing::AssertionSuccess();
+}
+
+::testing::AssertionResult
+PrintedTypeCXX11MatchesWrapper(StringRef Code, StringRef DeclName,
+   StringRef ExpectedPrinted,
+   ScopePrintingKind::ScopePrintingKind Scope) {
+  std::vector Args(1, "-std=c++11");
+  return PrintedTypeMatches(Code, Args,
+/*SuppressUnwrittenScope*/ true,
+ 

[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-06-29 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi updated this revision to Diff 104649.
schroedersi added a comment.

In https://reviews.llvm.org/D30946#792798, @rsmith wrote:

> I'd be interested to see how much complexity that adds, if you're prepared to 
> give it a try.


Thanks for your feedback :). I added a printing context and moved 
`TemporarySuppressScope` from `PrintingPolicy` to the printing context. The 
printing context is currently passed around by value. This is not ideal because 
changes to the context made inside a function are not available in the caller 
but it is sufficient for the temporary suppress scope functionality. And it 
gives an overview of the amount of code changes.

Passing the context around by reference would be better but it would also 
necessitate the creation of a overloaded version of almost each affected 
function. (Something like this:

  void print(const PrintingPolicy& Policy, PrintingContext& Context) { /*...*/ }
  
  void print(const PrintingPolicy& Policy) {
PrintingContext Context;
print(Policy, Context);
  }

).

> Yes, I think that's right -- `SuppressScope` isn't really an externally 
> useful "print without scopes" mechanism, it's an internal mechanism / 
> implementation detail used for printing an "inner" AST node when we've 
> already printed a scope for it based on outer sugar (eg, the entity is a type 
> component of a nested name specifier, or the type inside an elaborated type 
> specifier, or the class name in a destructor name). It's not really 
> `SuppressScope`, it's 
> `ScopeWasAlreadyPrintedForWhateverTopLevelThingIAskedYouToPrint` =)

Thanks for clarification :)


https://reviews.llvm.org/D30946

Files:
  include/clang/AST/Decl.h
  include/clang/AST/DeclBase.h
  include/clang/AST/NestedNameSpecifier.h
  include/clang/AST/PrettyPrinter.h
  include/clang/AST/TemplateBase.h
  include/clang/AST/TemplateName.h
  include/clang/AST/Type.h
  lib/AST/Decl.cpp
  lib/AST/DeclPrinter.cpp
  lib/AST/NestedNameSpecifier.cpp
  lib/AST/TemplateBase.cpp
  lib/AST/TemplateName.cpp
  lib/AST/TypePrinter.cpp

Index: lib/AST/TypePrinter.cpp
===
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -63,30 +63,28 @@
 bool SuppressTagKeyword;
 
   public:
-explicit ElaboratedTypePolicyRAII(PrintingPolicy ,
-  bool TemporarySuppressScope = true)
-: Policy(Policy) {
+explicit ElaboratedTypePolicyRAII(PrintingPolicy ) : Policy(Policy) {
   SuppressTagKeyword = Policy.SuppressTagKeyword;
   Policy.SuppressTagKeyword = true;
-  Policy.TemporarySuppressScope = TemporarySuppressScope;
 }
 
 ~ElaboratedTypePolicyRAII() {
   Policy.SuppressTagKeyword = SuppressTagKeyword;
-  Policy.TemporarySuppressScope = false;
 }
   };
   
   class TypePrinter {
 PrintingPolicy Policy;
+PrintingContext Context;
 unsigned Indentation;
 bool HasEmptyPlaceHolder;
 bool InsideCCAttribute;
 
   public:
-explicit TypePrinter(const PrintingPolicy , unsigned Indentation = 0)
-  : Policy(Policy), Indentation(Indentation),
-HasEmptyPlaceHolder(false), InsideCCAttribute(false) { }
+explicit TypePrinter(const PrintingPolicy , unsigned Indentation = 0,
+ PrintingContext Context = PrintingContext())
+: Policy(Policy), Context(Context), Indentation(Indentation),
+  HasEmptyPlaceHolder(false), InsideCCAttribute(false) {}
 
 void print(const Type *ty, Qualifiers qs, raw_ostream ,
StringRef PlaceHolder);
@@ -415,7 +413,8 @@
 
   PrintingPolicy InnerPolicy(Policy);
   InnerPolicy.IncludeTagDefinition = false;
-  TypePrinter(InnerPolicy).print(QualType(T->getClass(), 0), OS, StringRef());
+  TypePrinter(InnerPolicy, 0, Context)
+  .print(QualType(T->getClass(), 0), OS, StringRef());
 
   OS << "::*";
 }
@@ -590,21 +589,20 @@
   OS << ")))";
 }
 
-void 
-FunctionProtoType::printExceptionSpecification(raw_ostream , 
-   const PrintingPolicy )
- const {
-  
+void FunctionProtoType::printExceptionSpecification(
+raw_ostream , const PrintingPolicy ,
+PrintingContext Context) const {
+
   if (hasDynamicExceptionSpec()) {
 OS << " throw(";
 if (getExceptionSpecType() == EST_MSAny)
   OS << "...";
 else
   for (unsigned I = 0, N = getNumExceptions(); I != N; ++I) {
 if (I)
   OS << ", ";
-
-OS << getExceptionType(I).stream(Policy);
+
+OS << getExceptionType(I).stream(Policy, Twine(), 0, Context);
   }
 OS << ')';
   } else if (isNoexceptExceptionSpec(getExceptionSpecType())) {
@@ -768,7 +766,7 @@
 OS << " &&";
 break;
   }
-  T->printExceptionSpecification(OS, Policy);
+  T->printExceptionSpecification(OS, Policy, Context);
 
   if (T->hasTrailingReturn()) {
 OS << " -> ";
@@ 

[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-06-14 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Would it help the acceptance of the patch if I add a fourth option 
`LegacySuppressScope` (or similar) that emulates the current/pre-patch 
`SuppressScope==true`? This way the patched type printing would be a real 
superset of the current/non-patched type printing (except for some small 
changes to `SuppressScope==false`/`DefaultScope` as seen in the diff of tests 
`p6.cpp` and `comment-cplus-decls.cpp`).


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-06-12 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping :)


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-06-01 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping :)


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-05-13 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

In https://reviews.llvm.org/D30946#740567, @bkramer wrote:

> Also the mutable state in PrintingPolicy is really really ugly, is there no 
> better way for this? :(


Thanks for your comment :-)

I assume with mutable state you mean `PrintingPolicy::TemporarySuppressScope`? 
I do not really like it either. But other states of the policy are also mutated 
during the printing process (e.g. SuppressScope, SuppressTagKeyword and 
SuppressSpecifiers inside the RAII helpers).

A little background: It is necessary that scope printing can be temporarily 
suppressed without changing the actual scope printing kind setting. For 
example, in the case of an ElaboratedType, it is necessary that the underlying 
type is printed without the outer scope (because it has already been printed 
based on how it was written in the source and based on the scope printing kind 
setting). However, the internal type should be printed according to the scope 
printing kind setting. Another example are types inside a nested name 
specifier. Again, the outer scope can not be printed. However, inner scopes 
(e.g. for template arguments) must be printed according to the scope printing 
kind setting.
For this temporal suppression, the information about whether a scope has 
already been suppressed and thus the scope printing kind setting must be used, 
must be shared over all member functions involved in the printing. These member 
functions are the TypePrinter member functions and
`TemplateName::print`, `NestedNameSpecifier::print`, and 
`NamedDecl::printQualifiedName`. Currently, the only object shared across all 
these member functions is the PrintingPolicy. That is why I added the state to 
the PrintingPolicy.

As an alternative to the current solution, the above-mentioned member functions 
could each be extended by a "PrintingContext" argument, which then contains the 
variable states.

And a bit of clarification: Without the patch, even with `SuppressScope = true` 
it is not possible to suppress all scopes, and inner types are printed with a 
scope most of the time (which seems to lead to the desired effect for most 
users). For example, printing the type of `A` in `namespace N{class B{}; 
template class C{}; C<::N::B> A;}` with `SuppressScope = true` 
results in `C< ::N::B>` which still includes scopes. That is, there is already 
some kind of temporary suppress scope functionality, but it is called 
SuppressScope. The patch only expands this functionality to full scopes (see 
summary above), makes the behavior more consistent, and ensures that the 
settings do what - at least I - would expect from their name and documentation.

I hope this explains my decision. Either way, I look forward to further 
comments :-).


https://reviews.llvm.org/D30946



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.

2017-05-13 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi updated this revision to Diff 98887.
schroedersi added a comment.

- Ran clang-format (current trunk version) on the changes (except on some test 
files)
- Adapted patch to current trunk version


https://reviews.llvm.org/D30946

Files:
  include/clang/AST/PrettyPrinter.h
  include/clang/AST/TemplateName.h
  lib/AST/Decl.cpp
  lib/AST/DeclPrinter.cpp
  lib/AST/DeclarationName.cpp
  lib/AST/NestedNameSpecifier.cpp
  lib/AST/TemplateName.cpp
  lib/AST/TypePrinter.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/Tooling/Core/QualTypeNames.cpp
  test/CXX/class.access/p6.cpp
  test/Index/comment-cplus-decls.cpp
  unittests/AST/AbsoluteScopeTest.cpp
  unittests/AST/CMakeLists.txt
  unittests/AST/NamedDeclPrinterTest.cpp
  unittests/AST/TypePrinterTest.cpp

Index: unittests/AST/TypePrinterTest.cpp
===
--- /dev/null
+++ unittests/AST/TypePrinterTest.cpp
@@ -0,0 +1,464 @@
+//===- unittests/AST/TypePrinterTest.cpp -- TypePrinter printer tests -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file contains tests for TypePrinter::print(...).
+//
+// These tests have a coding convention:
+// * variable whose type to be printed is named 'A' unless it should have some
+// special name
+// * additional helper classes/namespaces/... are 'Z', 'Y', 'X' and so on.
+//
+//===--===//
+
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/SmallString.h"
+#include "gtest/gtest.h"
+
+using namespace clang;
+using namespace ast_matchers;
+using namespace tooling;
+namespace {
+
+class PrintMatch : public MatchFinder::MatchCallback {
+  SmallString<1024> Printed;
+  unsigned NumFoundDecls;
+  bool SuppressUnwrittenScope;
+  ScopePrintingKind::ScopePrintingKind Scope;
+
+public:
+  explicit PrintMatch(bool suppressUnwrittenScope,
+  ScopePrintingKind::ScopePrintingKind scope)
+  : NumFoundDecls(0), SuppressUnwrittenScope(suppressUnwrittenScope),
+Scope(scope) {}
+
+  void run(const MatchFinder::MatchResult ) override {
+const ValueDecl *VD = Result.Nodes.getNodeAs("id");
+if (!VD)
+  return;
+NumFoundDecls++;
+if (NumFoundDecls > 1)
+  return;
+
+llvm::raw_svector_ostream Out(Printed);
+PrintingPolicy Policy = Result.Context->getPrintingPolicy();
+Policy.SuppressUnwrittenScope = SuppressUnwrittenScope;
+Policy.Scope = Scope;
+QualType Type = VD->getType();
+Type.print(Out, Policy);
+  }
+
+  StringRef getPrinted() const { return Printed; }
+
+  unsigned getNumFoundDecls() const { return NumFoundDecls; }
+};
+
+::testing::AssertionResult
+PrintedTypeMatches(StringRef Code, const std::vector ,
+   bool SuppressUnwrittenScope,
+   const DeclarationMatcher ,
+   StringRef ExpectedPrinted, StringRef FileName,
+   ScopePrintingKind::ScopePrintingKind Scope) {
+  PrintMatch Printer(SuppressUnwrittenScope, Scope);
+  MatchFinder Finder;
+  Finder.addMatcher(NodeMatch, );
+  std::unique_ptr Factory =
+  newFrontendActionFactory();
+
+  if (!runToolOnCodeWithArgs(Factory->create(), Code, Args, FileName))
+return testing::AssertionFailure()
+   << "Parsing error in \"" << Code.str() << "\"";
+
+  if (Printer.getNumFoundDecls() == 0)
+return testing::AssertionFailure()
+   << "Matcher didn't find any value declarations";
+
+  if (Printer.getNumFoundDecls() > 1)
+return testing::AssertionFailure()
+   << "Matcher should match only one value declaration "
+  "(found "
+   << Printer.getNumFoundDecls() << ")";
+
+  if (Printer.getPrinted() != ExpectedPrinted)
+return ::testing::AssertionFailure()
+   << "Expected \"" << ExpectedPrinted.str()
+   << "\", "
+  "got \""
+   << Printer.getPrinted().str() << "\"";
+
+  return ::testing::AssertionSuccess();
+}
+
+::testing::AssertionResult
+PrintedTypeCXX11MatchesWrapper(StringRef Code, StringRef DeclName,
+   StringRef ExpectedPrinted,
+   ScopePrintingKind::ScopePrintingKind Scope) {
+  std::vector Args(1, "-std=c++11");
+  return PrintedTypeMatches(Code, Args,
+/*SuppressUnwrittenScope*/ true,
+valueDecl(hasName(DeclName)).bind("id"),
+ExpectedPrinted, "input.cc", Scope);
+}
+
+::testing::AssertionResult
+PrintedTypeCXX11Matches(StringRef Code, StringRef DeclName,
+StringRef ExpectedPrintedAllScopes,
+StringRef